diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2005-11-25 19:47:50 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2005-11-25 19:47:50 +0000 |
commit | 290166f93404d8759f4bf60ef1732c8ba9a52785 (patch) | |
tree | b7b9b00e3b3c1defea0e78b4f9b982e21963aa0f /src/include/optimizer/paths.h | |
parent | dab52ab13d3d3cce26e9bcc3193eb285c195d430 (diff) | |
download | postgresql-290166f93404d8759f4bf60ef1732c8ba9a52785.tar.gz postgresql-290166f93404d8759f4bf60ef1732c8ba9a52785.zip |
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.
Diffstat (limited to 'src/include/optimizer/paths.h')
-rw-r--r-- | src/include/optimizer/paths.h | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/include/optimizer/paths.h b/src/include/optimizer/paths.h index 4020f4bf49a..eba65c699c0 100644 --- a/src/include/optimizer/paths.h +++ b/src/include/optimizer/paths.h @@ -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); |