From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
---|---|
To: | "Wetzel, Juergen (Juergen)" <wetzel(at)avaya(dot)com> |
Cc: | "pgsql-general(at)postgresql(dot)org" <pgsql-general(at)postgresql(dot)org> |
Subject: | Re: Slow query plan used |
Date: | 2017-06-02 06:06:49 |
Message-ID: | 26767.1496383609@sss.pgh.pa.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
"Wetzel, Juergen (Juergen)" <wetzel(at)avaya(dot)com> writes:
> Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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
From | Date | Subject | |
---|---|---|---|
Next Message | PAWAN SHARMA | 2017-06-02 08:16:57 | Oracle database into PostgreSQL using Ora2PG tool. |
Previous Message | Wetzel, Juergen (Juergen) | 2017-06-02 05:51:49 | Re: Slow query plan used |