1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-27 12:41:57 +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

@ -1,5 +1,5 @@
/******************************************************************************
$PostgreSQL: pgsql/contrib/cube/cube.c,v 1.34 2007/11/15 21:14:29 momjian Exp $
$PostgreSQL: pgsql/contrib/cube/cube.c,v 1.35 2008/04/14 17:05:32 tgl Exp $
This file contains routines that can be bound to a Postgres backend and
called by the backend in the process of processing queries. The calling
@ -381,8 +381,13 @@ g_cube_consistent(PG_FUNCTION_ARGS)
GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0);
NDBOX *query = PG_GETARG_NDBOX(1);
StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2);
/* Oid subtype = PG_GETARG_OID(3); */
bool *recheck = (bool *) PG_GETARG_POINTER(4);
bool res;
/* All cases served by this function are exact */
*recheck = false;
/*
* if entry is not leaf, use g_cube_internal_consistent, else use
* g_cube_leaf_consistent

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/contrib/cube/cube.sql.in,v 1.23 2007/11/13 04:24:27 momjian Exp $ */
/* $PostgreSQL: pgsql/contrib/cube/cube.sql.in,v 1.24 2008/04/14 17:05:32 tgl Exp $ */
-- Adjust this setting to control where the objects get created.
SET search_path = public;
@ -262,7 +262,7 @@ CREATE OPERATOR ~ (
-- define the GiST support methods
CREATE OR REPLACE FUNCTION g_cube_consistent(internal,cube,int4)
CREATE OR REPLACE FUNCTION g_cube_consistent(internal,cube,int,oid,internal)
RETURNS bool
AS 'MODULE_PATHNAME'
LANGUAGE C IMMUTABLE;
@ -317,7 +317,7 @@ CREATE OPERATOR CLASS gist_cube_ops
OPERATOR 8 <@ ,
OPERATOR 13 @ ,
OPERATOR 14 ~ ,
FUNCTION 1 g_cube_consistent (internal, cube, int4),
FUNCTION 1 g_cube_consistent (internal, cube, int, oid, internal),
FUNCTION 2 g_cube_union (internal, internal),
FUNCTION 3 g_cube_compress (internal),
FUNCTION 4 g_cube_decompress (internal),

View File

@ -1,4 +1,4 @@
/* $PostgreSQL: pgsql/contrib/cube/uninstall_cube.sql,v 1.7 2007/11/13 04:24:27 momjian Exp $ */
/* $PostgreSQL: pgsql/contrib/cube/uninstall_cube.sql,v 1.8 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 g_cube_decompress(internal);
DROP FUNCTION g_cube_compress(internal);
DROP FUNCTION g_cube_consistent(internal,cube,int4);
DROP FUNCTION g_cube_consistent(internal,cube,int,oid,internal);
DROP OPERATOR ~ (cube, cube);