Re: Yet another abort-early plan disaster on 9.3 - Mailing list pgsql-performance

From Tom Lane
Subject Re: Yet another abort-early plan disaster on 9.3
Date
Msg-id 10463.1411225261@sss.pgh.pa.us
Whole thread Raw
In response to Re: Yet another abort-early plan disaster on 9.3  (Greg Stark <stark@mit.edu>)
List pgsql-performance
Greg Stark <stark@mit.edu> writes:
> On 19 Sep 2014 19:40, "Josh Berkus" <josh@agliodbs.com> wrote:
>> Yeah, here's an example of the canonical case:
>>
>> Table t1 ( a, b, c )
>>
>> - "b" is low-cardinality
>> - "c" is high-cardinality
>> - There are separate indexes on both b and c.
>>
>> SELECT a, b, c FROM t1
>> WHERE b = 2
>> ORDER BY c LIMIT 1;

> You badly want a partial index on c WHERE b=2 for each value of 2 which
> appears in your queries.

Well, if it's *only* b = 2 that you ever search for, then maybe a partial
index would be a good answer.  Personally I'd use a plain btree index on
(b, c).  The planner's been able to match this type of query to
multicolumn indexes for a long time.

            regards, tom lane


pgsql-performance by date:

Previous
From: Claudio Freire
Date:
Subject: Re: Yet another abort-early plan disaster on 9.3
Next
From: Josh Berkus
Date:
Subject: Re: Yet another abort-early plan disaster on 9.3