Re: PostgreSQL 10.0 SELECT LIMIT performance problem - Mailing list pgsql-bugs

From Tom Lane
Subject Re: PostgreSQL 10.0 SELECT LIMIT performance problem
Date
Msg-id 12108.1536860530@sss.pgh.pa.us
Whole thread Raw
In response to RE: PostgreSQL 10.0 SELECT LIMIT performance problem  (Mareks Kalnačs <Mareks.Kalnacs@datakom.lv>)
Responses RE: PostgreSQL 10.0 SELECT LIMIT performance problem  (Mareks Kalnačs <Mareks.Kalnacs@datakom.lv>)
List pgsql-bugs
=?utf-8?B?TWFyZWtzIEthbG5hxI1z?= <Mareks.Kalnacs@datakom.lv> writes:
> But we are using value indexes not a json index:

> CREATE INDEX idx_oss_alarms_dn
>   ON oss_alarms
>   USING btree
>   ((jdata ->> 'dn'::text) COLLATE pg_catalog."default");

I think you're outsmarting yourself by including those COLLATE clauses.
They don't do anything, since they're just selecting the default behavior
--- but they're enough to make the planner not realize that stats
collected on the index expression would be applicable to a plain
reference to oss_alarms.jdata ->> 'dn'.  In general you want the index
expression to be spelled exactly the same way that you refer to the
value in queries, else the system may not realize it's relevant.

            regards, tom lane


pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: BUG #15382: Error create dictionary in pg_dump
Next
From: Tom Lane
Date:
Subject: Re: BUG #15383: Join Filter cost estimation problem in 10.5