1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-28 23:42:10 +03:00

Push index operator lossiness determination down to GIST/GIN opclass

"consistent" functions, and remove pg_amop.opreqcheck, as per recent
discussion.  The main immediate benefit of this is that we no longer need
8.3's ugly hack of requiring @@@ rather than @@ to test weight-using tsquery
searches on GIN indexes.  In future it should be possible to optimize some
other queries better than is done now, by detecting at runtime whether the
index match is exact or not.

Tom Lane, after an idea of Heikki's, and with some help from Teodor.
This commit is contained in:
Tom Lane
2008-04-14 17:05:34 +00:00
parent 10be77c173
commit 9b5c8d45f6
68 changed files with 1023 additions and 785 deletions

View File

@ -42,7 +42,11 @@ float32 seg_center(SEG * seg);
/*
** GiST support methods
*/
bool gseg_consistent(GISTENTRY *entry, SEG * query, StrategyNumber strategy);
bool gseg_consistent(GISTENTRY *entry,
SEG * query,
StrategyNumber strategy,
Oid subtype,
bool *recheck);
GISTENTRY *gseg_compress(GISTENTRY *entry);
GISTENTRY *gseg_decompress(GISTENTRY *entry);
float *gseg_penalty(GISTENTRY *origentry, GISTENTRY *newentry, float *result);
@ -202,8 +206,13 @@ seg_upper(SEG * seg)
bool
gseg_consistent(GISTENTRY *entry,
SEG * query,
StrategyNumber strategy)
StrategyNumber strategy,
Oid subtype,
bool *recheck)
{
/* All cases served by this function are exact */
*recheck = false;
/*
* if entry is not leaf, use gseg_internal_consistent, else use
* gseg_leaf_consistent

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/contrib/seg/seg.sql.in,v 1.16 2007/11/13 04:24:28 momjian Exp $ */
/* $PostgreSQL: pgsql/contrib/seg/seg.sql.in,v 1.17 2008/04/14 17:05:32 tgl Exp $ */
-- Adjust this setting to control where the objects get created.
SET search_path = public;
@ -322,7 +322,7 @@ CREATE OPERATOR ~ (
-- define the GiST support methods
CREATE OR REPLACE FUNCTION gseg_consistent(internal,seg,int4)
CREATE OR REPLACE FUNCTION gseg_consistent(internal,seg,int,oid,internal)
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE;
@ -382,7 +382,7 @@ AS
OPERATOR 8 <@ ,
OPERATOR 13 @ ,
OPERATOR 14 ~ ,
FUNCTION 1 gseg_consistent (internal, seg, int4),
FUNCTION 1 gseg_consistent (internal, seg, int, oid, internal),
FUNCTION 2 gseg_union (internal, internal),
FUNCTION 3 gseg_compress (internal),
FUNCTION 4 gseg_decompress (internal),

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/contrib/seg/uninstall_seg.sql,v 1.5 2007/11/13 04:24:28 momjian Exp $ */
/* $PostgreSQL: pgsql/contrib/seg/uninstall_seg.sql,v 1.6 2008/04/14 17:05:32 tgl Exp $ */
-- Adjust this setting to control where the objects get dropped.
SET search_path = public;
@ -19,7 +19,7 @@ DROP FUNCTION gseg_decompress(internal);
DROP FUNCTION gseg_compress(internal);
DROP FUNCTION gseg_consistent(internal,seg,int4);
DROP FUNCTION gseg_consistent(internal,seg,int,oid,internal);
DROP OPERATOR <@ (seg, seg);