pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: John Siracusa <siracusa@mindspring.com>
Cc: Postgres Performance <pgsql-performance@postgresql.org>
Subject: Re: Feature request: smarter use of conditional indexes
Date: Wed, 03 Mar 2004 18:53:56 -0500
Message-ID: <19341.1078358036@sss.pgh.pa.us> (raw)
In-Reply-To: <BC6BA286.833F4%siracusa@mindspring.com>
References: <BC6BA286.833F4%siracusa@mindspring.com>

John Siracusa <siracusa@mindspring.com> writes:
> Given an index like this:
>     CREATE UNIQUE INDEX i1 ON t1 (c1) WHERE c1 IS NOT NULL;
> and a query like this:
>     SELECT * FROM t1 WHERE c1 = 123;
> I'd like the planner to be smart enough to use an index scan using i1.

Send a patch ;-)

The routine you want to teach about this is pred_test_simple_clause() in
src/backend/optimizer/path/indxpath.c.  ISTM that it's legitimate to
conclude that "foo IS NOT NULL" is implied by "foo op anything" or
"anything op foo" if the operator is marked strict.

Note: please patch against CVS head, as that code got rewritten since
7.4.

			regards, tom lane



view thread (11+ messages)  latest in thread

Message-ID: <19341.1078358036@sss.pgh.pa.us>
Permalink:  ../19341.1078358036@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/19341.1078358036@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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, siracusa@mindspring.com
  Subject: Re: Feature request: smarter use of conditional indexes
  In-Reply-To: <19341.1078358036@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