pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: Peter J. Holzer <hjp-pgsql@hjp.at>
Cc: pgsql-bugs@postgresql.org
Subject: Re: 9.5alpha1: Partial index not used
Date: Sat, 1 Aug 2015 18:04:30 +0200
Message-ID: <20150801160429.GA18043@hjp.at> (raw)
In-Reply-To: <13924.1438387421@sss.pgh.pa.us>
References: <20150731173213.GB2423@hjp.at>
	<13924.1438387421@sss.pgh.pa.us>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

On 2015-07-31 20:03:41 -0400, Tom Lane wrote:
> "Peter J. Holzer" <hjp-pgsql@hjp.at> writes:
> > Consider this table:
> > ...
> >     "concept_start_idx" btree (start) WHERE start IS NOT NULL
> 
> > and this query:
> 
> > select id as IdValue, canonicalname as Description, null as IsLeaf from public.concept where start;
> 
> > Clearly this should be able to use the partial index (if start is true
> > it is also not null)
> 
> As you surmise, there's no proof rule for that.
> 
> > and since there are only 3 out of 3 million rows in result it would
> > also be beneficial (and PostgreSQL 9.1 did use the index).
> 
> ... and there wasn't in 9.1 either.  I get a seqscan from examples like
> this in every branch back to 8.3, which is as far back as I can test
> conveniently.

This is weird. I do remember that I tested various indexes until I found
one which was actually used on the development server (which was 9.1 at
the time and upgraded to 9.5 recently). However, on the test system
(still on 9.1) I can't get postgres to use the index either. 

So I must assume that I'm either completely misremembering or that I
changed the index after that for some reason I don't remember.
Sorry, my bad.

> Only the last case produces use of the index.  I agree that it'd be better
> if they all did, but I'm disinclined to consider it a bug fix unless you
> can show a specific case in which there's a performance regression from
> older releases.

"grossly incorrect plan choices are cause for a bug report" (from
http://www.postgresql.org/docs/9.5/static/indexes-partial.html) ;-)

Yeah, not a regression, and even though I consider that "grossly
incorrect", not high on my priority list (since the "workaround" is
arguably "more correct" in my case). So please consider it a feature
request instead of a bug report.

	hp

-- 
   _  | Peter J. Holzer    | I want to forget all about both belts and
|_|_) |                    | suspenders; instead, I want to buy pants 
| |   | hjp@hjp.at         | that actually fit.
__/   | http://www.hjp.at/ |   -- http://noncombatant.org/

Attachments:

  signature.asc (application/pgp-signature, 810B) download

view thread (5+ messages)  latest in thread

Message-ID: <20150801160429.GA18043@hjp.at>
Permalink:  ../20150801160429.GA18043@hjp.at/
Also on:    postgresql.org/message-id/20150801160429.GA18043@hjp.at

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-bugs@postgresql.org
  Cc: hjp-pgsql@hjp.at, tgl@sss.pgh.pa.us
  Subject: Re: 9.5alpha1: Partial index not used
  In-Reply-To: <20150801160429.GA18043@hjp.at>
  References: <20150731173213.GB2423@hjp.at> <13924.1438387421@sss.pgh.pa.us> <20150801160429.GA18043@hjp.at>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox