pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter J. Holzer <hjp-pgsql@hjp.at>
To: pgsql-general@lists.postgresql.org
Subject: Re: Strange Behaviour with multicolumn indexes
Date: Thu, 12 Sep 2019 21:56:22 +0200
Message-ID: <20190912195622.GA29488@hjp.at> (raw)
In-Reply-To: <20190912190425.GA23651@hjp.at>
References: <20190912164105.GA17616@hjp.at>
	<3175.1568307295@sss.pgh.pa.us>
	<20190912190425.GA23651@hjp.at>

On 2019-09-12 21:04:25 +0200, Peter J. Holzer wrote:
> On 2019-09-12 12:54:55 -0400, Tom Lane wrote:
> > It's not taking the partial-index filter into account in that, I
> > suspect, which skews the results in this case --- but that would be
> > hard to account for accurately.
> 
> Hmm. Wouldn't that be a problem for partial indexes in general? They
> usually cover only a small portion of the table and if the selectivity
> is computed relative to the whole table the result may be way off.
> 
> I think it should be possible to adjust for a "WHERE column IS NOT NULL"
> filter, because null_frac is in the statistics. For the general case you
> would need an estimate of the number of rows covered by the index, which
> I don't think we have.

Looking through the source I see that the planner does estimate the
number of tuples in the index.

        hp



-- 
   _  | Peter J. Holzer    | we build much bigger, better disasters now
|_|_) |                    | because we have much more sophisticated
| |   | hjp@hjp.at         | management tools.
__/   | http://www.hjp.at/ | -- Ross Anderson <https://www.edge.org/;

Attachments:

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

view thread (4+ messages)

Message-ID: <20190912195622.GA29488@hjp.at>
Permalink:  ../20190912195622.GA29488@hjp.at/
Also on:    postgresql.org/message-id/20190912195622.GA29488@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-general@postgresql.org
  Cc: hjp-pgsql@hjp.at
  Subject: Re: Strange Behaviour with multicolumn indexes
  In-Reply-To: <20190912195622.GA29488@hjp.at>
  References: <20190912164105.GA17616@hjp.at> <3175.1568307295@sss.pgh.pa.us> <20190912190425.GA23651@hjp.at> <20190912195622.GA29488@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