Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XVM9x-0006ju-LZ for pgsql-performance@arkaria.postgresql.org; Sat, 20 Sep 2014 15:01:13 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XVM9w-0005pb-P2 for pgsql-performance@arkaria.postgresql.org; Sat, 20 Sep 2014 15:01:12 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XVM9u-0005pS-Mx for pgsql-performance@postgresql.org; Sat, 20 Sep 2014 15:01:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XVM9r-0003ZH-Hz for pgsql-performance@postgresql.org; Sat, 20 Sep 2014 15:01:09 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id s8KF11v8010464; Sat, 20 Sep 2014 11:01:01 -0400 From: Tom Lane To: Greg Stark cc: Josh Berkus , Merlin Moncure , pgsql-performance@postgresql.org Subject: Re: Yet another abort-early plan disaster on 9.3 In-reply-to: References: <541A2335.3060100@agliodbs.com> <541C7891.7000902@agliodbs.com> Comments: In-reply-to Greg Stark message dated "Sat, 20 Sep 2014 07:38:03 +0100" Date: Sat, 20 Sep 2014 11:01:01 -0400 Message-ID: <10463.1411225261@sss.pgh.pa.us> X-Pg-Spam-Score: -2.6 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Greg Stark writes: > On 19 Sep 2014 19:40, "Josh Berkus" 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 -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance