1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-02 09:02:37 +03:00

While determining the filter clauses for an index scan (either plain

or bitmap), use pred_test to be a little smarter about cases where a
filter clause is logically unnecessary.  This may be overkill for the
plain indexscan case, but it's definitely useful for OR'd bitmap scans.
This commit is contained in:
Tom Lane
2005-04-25 03:58:30 +00:00
parent 79a1b00226
commit 1fcd4b7a07
2 changed files with 51 additions and 15 deletions

View File

@ -9,7 +9,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.178 2005/04/25 01:30:13 tgl Exp $
* $PostgreSQL: pgsql/src/backend/optimizer/path/indxpath.c,v 1.179 2005/04/25 03:58:29 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -500,8 +500,14 @@ choose_bitmap_and(Query *root, RelOptInfo *rel, List *paths)
* And we consider an index redundant if all its index conditions were
* already used by earlier indexes. (We could use pred_test() to have
* a more intelligent, but much more expensive, check --- but in most
* cases simple equality should suffice, since after all the index
* conditions are all coming from the same query clauses.)
* cases simple pointer equality should suffice, since after all the
* index conditions are all coming from the same RestrictInfo lists.)
*
* XXX is there any risk of throwing away a useful partial index here
* because we don't explicitly look at indpred? At least in simple
* cases, the partial index will sort before competing non-partial
* indexes and so it makes the right choice, but perhaps we need to
* work harder.
*/
/* Convert list to array so we can apply qsort */
@ -530,7 +536,7 @@ choose_bitmap_and(Query *root, RelOptInfo *rel, List *paths)
if (IsA(newpath, IndexPath))
{
newqual = ((IndexPath *) newpath)->indexclauses;
if (list_difference(newqual, qualsofar) == NIL)
if (list_difference_ptr(newqual, qualsofar) == NIL)
continue; /* redundant */
}