mirror of
https://github.com/postgres/postgres.git
synced 2025-10-27 00:12:01 +03:00
Teach planner and executor to handle ScalarArrayOpExpr as an indexable
qualification when the underlying operator is indexable and useOr is true. That is, indexkey op ANY (ARRAY[...]) is effectively translated into an OR combination of one indexscan for each array element. This only works for bitmap index scans, of course, since regular indexscans no longer support OR'ing of scans. There are still some loose ends to clean up before changing 'x IN (list)' to translate as a ScalarArrayOpExpr; for instance predtest.c ought to be taught about it. But this gets the basic functionality in place.
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
|
||||
* Portions Copyright (c) 1994, Regents of the University of California
|
||||
*
|
||||
* $PostgreSQL: pgsql/src/include/optimizer/paths.h,v 1.88 2005/10/15 02:49:45 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/include/optimizer/paths.h,v 1.89 2005/11/25 19:47:50 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@@ -34,6 +34,14 @@ extern void debug_print_rel(PlannerInfo *root, RelOptInfo *rel);
|
||||
* indxpath.c
|
||||
* routines to generate index paths
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
/* Whether to use ScalarArrayOpExpr to build index qualifications */
|
||||
SAOP_FORBID, /* Do not use ScalarArrayOpExpr */
|
||||
SAOP_ALLOW, /* OK to use ScalarArrayOpExpr */
|
||||
SAOP_REQUIRE /* Require ScalarArrayOpExpr */
|
||||
} SaOpControl;
|
||||
|
||||
extern void create_index_paths(PlannerInfo *root, RelOptInfo *rel);
|
||||
extern List *generate_bitmap_or_paths(PlannerInfo *root, RelOptInfo *rel,
|
||||
List *clauses, List *outer_clauses,
|
||||
@@ -44,6 +52,7 @@ extern Path *best_inner_indexscan(PlannerInfo *root, RelOptInfo *rel,
|
||||
extern List *group_clauses_by_indexkey(IndexOptInfo *index,
|
||||
List *clauses, List *outer_clauses,
|
||||
Relids outer_relids,
|
||||
SaOpControl saop_control,
|
||||
bool *found_clause);
|
||||
extern bool match_index_to_operand(Node *operand, int indexcol,
|
||||
IndexOptInfo *index);
|
||||
|
||||
Reference in New Issue
Block a user