Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1ZLZH6-0004lK-Nr for pgsql-bugs@arkaria.postgresql.org; Sat, 01 Aug 2015 16:04:40 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1ZLZH6-0004u6-9s for pgsql-bugs@arkaria.postgresql.org; Sat, 01 Aug 2015 16:04:40 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZLZH5-0004tv-MH for pgsql-bugs@postgresql.org; Sat, 01 Aug 2015 16:04:39 +0000 Received: from cl-1892.mbx-01.si.sixxs.net ([2001:15c0:65ff:763::2] helo=zeno.hjp.at) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1ZLZH2-0007DE-1f for pgsql-bugs@postgresql.org; Sat, 01 Aug 2015 16:04:38 +0000 Received: by zeno.hjp.at (Postfix, from userid 1000) id 54E214011; Sat, 1 Aug 2015 18:04:30 +0200 (CEST) Date: Sat, 1 Aug 2015 18:04:30 +0200 From: "Peter J. Holzer" To: Tom Lane Cc: "Peter J. Holzer" , pgsql-bugs@postgresql.org Subject: Re: 9.5alpha1: Partial index not used Message-ID: <20150801160429.GA18043@hjp.at> References: <20150731173213.GB2423@hjp.at> <13924.1438387421@sss.pgh.pa.us> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="1yeeQ81UyVL57Vl7" Content-Disposition: inline In-Reply-To: <13924.1438387421@sss.pgh.pa.us> User-Agent: Mutt/1.5.23 (2014-03-12) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org --1yeeQ81UyVL57Vl7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2015-07-31 20:03:41 -0400, Tom Lane wrote: > "Peter J. Holzer" writes: > > Consider this table: > > ... > > "concept_start_idx" btree (start) WHERE start IS NOT NULL >=20 > > and this query: >=20 > > select id as IdValue, canonicalname as Description, null as IsLeaf from= public.concept where start; >=20 > > Clearly this should be able to use the partial index (if start is true > > it is also not null) >=20 > As you surmise, there's no proof rule for that. >=20 > > 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). >=20 > ... 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.=20 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 --=20 _ | Peter J. Holzer | I want to forget all about both belts and |_|_) | | suspenders; instead, I want to buy pants=20 | | | hjp@hjp.at | that actually fit. __/ | http://www.hjp.at/ | -- http://noncombatant.org/ --1yeeQ81UyVL57Vl7 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIVAwUBVbzuDPIOSFES/ihdAQKaghAAhda8m7KoZ42QKoyHGTmskJV5QWtgN5Fc wVsV4UQ9/+agQmnX9k8lQNdN3icv4m9Pbe6wM04pGjWUML1Oi+idCKFctTyAGGQy uE+DPy9bCW3niKbO493qXPFhZhS0DJdxncnW7+w8Uvm/CmeHVW/8whg3pmJ21SPP 4JELShVJaexHDIb4bLkGmcdyi/GZxarFy9nf9Ptrymvlh4nqzyv0nvcssW1Hh/up OXisyHI/K7gYzpNHe91tGnSQa0H0ZtuN99YquAM4+u/29AiYTKb0Lz/0nXT0baZi AHGIBjRxt9QvuWjafS9so9K8UEE5fsxX5GCDwpBK+c27S1KUEbPAhM1Nu3EyVyf5 7Oy0j8OpuibZ97qgKtF+VZ7bIhtag6iDlfXmftc6GwEfuXzf5km9oFgTvuOG6TXH 8FQiez8a266tYmD9SEB1Mc2fF7vDd4oQQ9DbQMrZKr6cCxl5vC0LRV0mbDnLgAap uNLCJIFPMtJr/bVhevxvq/5jwxkl/L/wwddjrWgN9Sy1pSQ0HcHh2d1kwNf8neiq ufu8DnPaMq2xzQF1ht1Y0sOT68pzIvUtGk5DzBp1ZQkq25rjwt+9YMkXII2Zd8hp vdL7x7V/ckc5Af0SrDk26skTp4Cx5vDc/yTvldozaZfi2n9ptamjWzqwsuYfELZR oFgVwsBCVQs= =d1bg -----END PGP SIGNATURE----- --1yeeQ81UyVL57Vl7--