"Wetzel, Juergen (Juergen)" <wetzel@avaya.com> writes:
> Tom Lane <tgl@sss.pgh.pa.us> writes:
>> You might get some traction by creating indexes on lower(searchfield1) etc.
> I will try that. Does that mean the column statistics will only be collected when there's an index on the
table/column?
No; ANALYZE collects stats on plain columns automatically. The point
is that your query is not on the plain column searchfield1, it is on
lower(searchfield1). The planner cannot make a reasonable estimate
for "something LIKE constant-pattern" unless it can find statistics
that are specifically for the "something" value.
regards, tom lane