I have been seeing quite a large variation in response times regarding LIKE queries to a particular table in my database. Sometimes I will get results within 200-400 ms (very acceptable) but other times it might take as much as 30 seconds to return results. I understand that LIKE queries are very resource intensive but I just don't understand why there would be such a large difference in response times. I have built a btree index on the "owner1" field but I don't think these help with like queries. Anyone have any ideas?
Sample SQL: select gid, owner1 from parcels where owner1 ILIKE '%someones name%' limit 10
Have also tried: select gid, owner1 from parcels where lower(owner1) LIKE lower('%someones name%') limit 10
and select gid, owner1 from parcels where lower(owner1) LIKE lower('someones name%') limit 10
with similar results.
Table Row Count: about 95,000