Re: [GENERAL] Slow query plan used - Mailing list pgsql-general

From Tom Lane
Subject Re: [GENERAL] Slow query plan used
Date
Msg-id 26767.1496383609@sss.pgh.pa.us
Whole thread Raw
In response to Re: [GENERAL] Slow query plan used  ("Wetzel, Juergen (Juergen)" <wetzel@avaya.com>)
List pgsql-general
"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


pgsql-general by date:

Previous
From: "Wetzel, Juergen (Juergen)"
Date:
Subject: Re: [GENERAL] Slow query plan used
Next
From: PAWAN SHARMA
Date:
Subject: [GENERAL] Oracle database into PostgreSQL using Ora2PG tool.