In my program I have very few inserts, and any which are run frequently are not needed instantly and therefore have been changed to INSERT DELAYED. Should I go through my code and see which fields are referenced in the WHERE clause and add an index for each of them? If so what type of index do I use? Is it just inserts that are slowed down?
Also can I use these indexes on any data type?
There are two major places where we can consider indexing: columns referenced in the WHERE clause and columns used in JOIN clauses. In short, such columns should be indexed against which you are required to search particular records.
clauses. Indexing columns in abundance will result in some
disadvantages.
the indexing, so that NULL values will never be stored.
indexes. In this way, you can examine this log file and adjust your
queries accordingly. Also slow-query log.
a query. It shows how and in what order tables are joined. This can
be much useful for determining how to write optimized queries, and
whether the columns are needed to be indexed.
This blog is good.