pg.ddx.io  pgsql-bugs@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: toruvinn@lain.pl
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #12763: Planner refuses to do index-only-scan on partial indexes despite having all the required data
Date: Wed, 11 Feb 2015 16:57:39 -0500
Message-ID: <13813.1423691859@sss.pgh.pa.us> (raw)
In-Reply-To: <20150211212848.5126.51787@wrigleys.postgresql.org>
References: <20150211212848.5126.51787@wrigleys.postgresql.org>
List-Unsubscribe: <mailto:majordomo@postgresql.org?body=unsub%20pgsql-bugs>

toruvinn@lain.pl writes:
> johto told me on irc it may be worth reporting it here - thanks!

Not really.  See comment in check_index_only():

    /*
     * Check that all needed attributes of the relation are available from the
     * index.
     *
     * XXX this is overly conservative for partial indexes, since we will
     * consider attributes involved in the index predicate as required even
     * though the predicate won't need to be checked at runtime.  (The same is
     * true for attributes used only in index quals, if we are certain that
     * the index is not lossy.)  However, it would be quite expensive to
     * determine that accurately at this point, so for now we take the easy
     * way out.
     */

This is the same reason why expression indexes are difficult to use in
index-only scans: if the query refers to f(x), the information available
to check_index_only() says that the index must be able to return the value
of "x", not "f(x)".  It'd be nice to improve, but the only obvious ways to
do that would result in entirely unacceptable hits to planning speed.

			regards, tom lane


-- 
Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-bugs



view thread (2+ messages)

Message-ID: <13813.1423691859@sss.pgh.pa.us>
Permalink:  ../13813.1423691859@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/13813.1423691859@sss.pgh.pa.us

 · 

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: tgl@sss.pgh.pa.us, toruvinn@lain.pl
  Subject: Re: BUG #12763: Planner refuses to do index-only-scan on partial indexes despite having all the required data
  In-Reply-To: <13813.1423691859@sss.pgh.pa.us>
  References: <20150211212848.5126.51787@wrigleys.postgresql.org> <13813.1423691859@sss.pgh.pa.us>

* 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