diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2008-04-14 17:05:34 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2008-04-14 17:05:34 +0000 |
commit | 9b5c8d45f62bd3d243a40cc84deb93893f2f5122 (patch) | |
tree | 2d75607f7bdb96cfa1d73a3a36a4b3328118ff08 /contrib/btree_gist/btree_time.c | |
parent | 10be77c173211a75718f50fe6061862f6a0cb4a2 (diff) | |
download | postgresql-9b5c8d45f62bd3d243a40cc84deb93893f2f5122.tar.gz postgresql-9b5c8d45f62bd3d243a40cc84deb93893f2f5122.zip |
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.
Diffstat (limited to 'contrib/btree_gist/btree_time.c')
-rw-r--r-- | contrib/btree_gist/btree_time.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/contrib/btree_gist/btree_time.c b/contrib/btree_gist/btree_time.c index fd5e63e2bbc..6c1ec80a314 100644 --- a/contrib/btree_gist/btree_time.c +++ b/contrib/btree_gist/btree_time.c @@ -151,14 +151,18 @@ gbt_time_consistent(PG_FUNCTION_ARGS) { GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); TimeADT query = PG_GETARG_TIMEADT(1); + StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + /* Oid subtype = PG_GETARG_OID(3); */ + bool *recheck = (bool *) PG_GETARG_POINTER(4); timeKEY *kkk = (timeKEY *) DatumGetPointer(entry->key); GBT_NUMKEY_R key; - StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); + + /* All cases served by this function are exact */ + *recheck = false; key.lower = (GBT_NUMKEY *) & kkk->lower; key.upper = (GBT_NUMKEY *) & kkk->upper; - PG_RETURN_BOOL( gbt_num_consistent(&key, (void *) &query, &strategy, GIST_LEAF(entry), &tinfo) ); @@ -170,11 +174,15 @@ gbt_timetz_consistent(PG_FUNCTION_ARGS) GISTENTRY *entry = (GISTENTRY *) PG_GETARG_POINTER(0); TimeTzADT *query = PG_GETARG_TIMETZADT_P(1); StrategyNumber strategy = (StrategyNumber) PG_GETARG_UINT16(2); - + /* Oid subtype = PG_GETARG_OID(3); */ + bool *recheck = (bool *) PG_GETARG_POINTER(4); timeKEY *kkk = (timeKEY *) DatumGetPointer(entry->key); TimeADT qqq; GBT_NUMKEY_R key; + /* All cases served by this function are inexact */ + *recheck = true; + #ifdef HAVE_INT64_TIMESTAMP qqq = query->time + (query->zone * INT64CONST(1000000)); #else |