Re: Question about rtrees (overleft replacing left in nodes) - Mailing list pgsql-general

From Tom Lane
Subject Re: Question about rtrees (overleft replacing left in nodes)
Date
Msg-id 4658.1080745532@sss.pgh.pa.us
Whole thread Raw
In response to Re: Question about rtrees (overleft replacing left in nodes)  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: Question about rtrees (overleft replacing left in nodes)
List pgsql-general
I said:
> However, if this is indeed wrong, why have we not heard bug reports
> stating that rtree indexes don't work?  Can you generate a test case
> in which it fails?

Actually, it's not necessary to look very far: there's one rtree index
defined in the regression database, and guess what: it gets << queries
wrong.

regression=# explain select count(*) from fast_emp4000 where home_base << '(35565,5404),(35546,5360)';
                             QUERY PLAN
---------------------------------------------------------------------
 Aggregate  (cost=65.53..65.53 rows=1 width=0)
   ->  Seq Scan on fast_emp4000  (cost=0.00..64.75 rows=310 width=0)
         Filter: (home_base << '(35565,5404),(35546,5360)'::box)
(3 rows)

regression=# select count(*) from fast_emp4000 where home_base << '(35565,5404),(35546,5360)';
 count
-------
  2214
(1 row)

regression=# set enable_seqscan to 0;
SET
regression=# explain select count(*) from fast_emp4000 where home_base << '(35565,5404),(35546,5360)';
                                      QUERY PLAN
---------------------------------------------------------------------------------------
 Aggregate  (cost=112.96..112.96 rows=1 width=0)
   ->  Index Scan using rect2ind on fast_emp4000  (cost=0.00..112.18 rows=310 width=0)
         Index Cond: (home_base << '(35565,5404),(35546,5360)'::box)
(3 rows)

regression=# select count(*) from fast_emp4000 where home_base << '(35565,5404),(35546,5360)';
 count
-------
  1363
(1 row)

So we've got a problem here :-(

            regards, tom lane

pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Question about rtrees (overleft replacing left in nodes)
Next
From: Tom Lane
Date:
Subject: Re: Slow IN query