I have developed a small patch to optimizer/util/plancat.c that
eliminates one of hte caveats associated with constraint exclusions,
namely the inability to avoid searching tables based on the results of
stable functions. The new code expands non-volatile functions into
constant values so they can be used in the plan to determine which
tables to search. If volatile functions are used in the query
constraints, they are correctly ignored in the planning process.
This is particularly useful for tables partitioned on a time column
where queries relative to the current system time are desirable.
I'll attach the patch file and a small SQL test case that exercises the
code. The patch is relative to the 8.2.4 release; the SQL uses
backslash commands, so its really only appropriate for use with the psql
utility. However, it does create a test database called test_ce_db and
run all the tests with a single command, e.g. psql -f test_ce_patch.sql
I'd appreciate any feedback anyone has, particularly on any corner cases
I may have missed.
pgsql-hackers by date
|Next:||From: Henry B. Hotz||Date: 2007-04-30 22:23:25|
|Subject: Fwd: [PATCHES] Preliminary GSSAPI Patches|
|Previous:||From: Tom Lane||Date: 2007-04-30 21:30:07|
|Subject: Re: When the locially dropped column is also physically dropped |