dbTalk Databases Forums  

[BUGS] BUG #2196: Useless RECHECK on RTREE index

mailing.database.pgsql-bugs mailing.database.pgsql-bugs


Discuss [BUGS] BUG #2196: Useless RECHECK on RTREE index in the mailing.database.pgsql-bugs forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
 
Posts: n/a

Default [BUGS] BUG #2196: Useless RECHECK on RTREE index - 01-23-2006 , 10:59 AM







The following bug has been logged online:

Bug reference: 2196
Logged by:
Email address: agattik (AT) gmail (DOT) com
PostgreSQL version: 8.1.2
Operating system: alphaev68-dec-osf5.1a
Description: Useless RECHECK on RTREE index
Details:

create table tpoints (x int, y int);
CREATE INDEX i_tpoints ON tpoints USING RTREE (box(point(x,y),
point(x,y)));
explain select * from tpoints where box '((0,0),(1,1))' && box(point(x,y),
point(x,y));


QUERY PLAN

----------------------------------------------------------------------------
----------------------------------------------------------------------------
---
Bitmap Heap Scan on tpoints (cost=1.05..10.46 rows=10 width=8)
Recheck Cond: ('(1,1),(0,0)'::box && box(point((x)::double precision,
(y)::double precision), point((x)::double precision, (y)::double
precision)))
-> Bitmap Index Scan on i_tpoints (cost=0.00..1.05 rows=10 width=0)
Index Cond: ('(1,1),(0,0)'::box && box(point((x)::double precision,
(y)::double precision), point((x)::double precision, (y)::double
precision)))
(4 rows)

The RECHECK is necessary in case of polygons, but useless in case of box
overlap.

pg_amop.amopreqcheck is correctly set to false, but the planner seems to
ignore that.

select pg_amop.* from pg_amop join pg_opclass c ON (amopclaid=c.oid) join
pg_operator op ON (amopopr=op.oid) where opcname='box_ops' and
oprname='&&';
amopclaid | amopsubtype | amopstrategy | amopreqcheck | amopopr
-----------+-------------+--------------+--------------+---------
425 | 0 | 3 | f | 500
2593 | 0 | 3 | f | 500
(2 rows)

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Reply With Quote
  #2  
Old   
Tom Lane
 
Posts: n/a

Default Re: [BUGS] BUG #2196: Useless RECHECK on RTREE index - 01-23-2006 , 11:26 AM






"" <agattik (AT) gmail (DOT) com> writes:
Quote:
Bitmap Heap Scan on tpoints (cost=1.05..10.46 rows=10 width=8)
Recheck Cond: ('(1,1),(0,0)'::box && box(point((x)::double precision,
(y)::double precision), point((x)::double precision, (y)::double
precision)))
-> Bitmap Index Scan on i_tpoints (cost=0.00..1.05 rows=10 width=0)
Index Cond: ('(1,1),(0,0)'::box && box(point((x)::double precision,
(y)::double precision), point((x)::double precision, (y)::double
precision)))
(4 rows)

The RECHECK is necessary in case of polygons, but useless in case of box
overlap.
You don't understand what a bitmap scan's recheck condition is for.
The above plan is correct.

regards, tom lane

---------------------------(end of broadcast)---------------------------
TIP 1: if posting/reading through Usenet, please send an appropriate
subscribe-nomail command to majordomo (AT) postgresql (DOT) org so that your
message can get through to the mailing list cleanly


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.