Query SELECT filename, category, name, downloads FROM wallpapers WHERE pending='0' AND ((category LIKE '%".$search."%') OR (filename LIKE '%".$search."%') OR (tags LIKE '%".$search."%') OR (name LIKE '%".$search."%')) ORDER BY ordernum DESC PHP: Explain shows id select_type table type possible_keys key key_len ref rows Extra 1 SIMPLE wallpapers ALL pending NULL NULL NULL 1158 Using where; Using filesort PHP: I'm not sure what to index or how to optimize this query. Is there even anything that I could index to optimize it?
Most probably the problem is in "filename LIKE '%SOMETHING%'". Even if you have an index on field "filename" it will work only for leftmost part of string, for string beginn. If you would have "filename LIKE 'SOMETHING%'" your index on "filename" will work, but in case "filename LIKE '%SOMETHING%'" it behaves like there is no index .
Search the forums for people with your same problem using some sort of Full Text Indexing system. Refer to your unnamed database server supplier for documentation.