Re: Yet another abort-early plan disaster on 9.3

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Stark <stark(at)mit(dot)edu>
Cc: Josh Berkus <josh(at)agliodbs(dot)com>, Merlin Moncure <mmoncure(at)gmail(dot)com>, pgsql-performance(at)postgresql(dot)org
Subject: Re: Yet another abort-early plan disaster on 9.3
Date: 2014-09-20 15:01:01
Message-ID: 10463.1411225261@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-performance

Greg Stark <stark(at)mit(dot)edu> writes:
> On 19 Sep 2014 19:40, "Josh Berkus" <josh(at)agliodbs(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2014-09-20 16:36:36 Re: pg_receivexlog and replication slots
Previous Message Andrew Dunstan 2014-09-20 14:03:43 Re: Should we excise the remnants of borland cc support?

Browse pgsql-performance by date

  From Date Subject
Next Message Josh Berkus 2014-09-20 18:33:35 Re: Yet another abort-early plan disaster on 9.3
Previous Message Claudio Freire 2014-09-20 11:51:49 Re: Yet another abort-early plan disaster on 9.3