Re: Feature request: smarter use of conditional indexes

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: John Siracusa <siracusa(at)mindspring(dot)com>
Cc: Postgres Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Feature request: smarter use of conditional indexes
Date: 2004-03-03 23:53:56
Message-ID: 19341.1078358036@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

John Siracusa <siracusa(at)mindspring(dot)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

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Paul Thomas 2004-03-04 00:52:08 Re: Scaling further up
Previous Message Neil Conway 2004-03-03 23:50:04 Re: [PERFORM] WAL Optimisation - configuration and usage