Re: Question about rtrees (overleft replacing left in nodes)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "bwhite" <bwhite(at)frognet(dot)net>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Question about rtrees (overleft replacing left in nodes)
Date: 2004-03-31 15:05:32
Message-ID: 4658.1080745532@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general pgsql-patches

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

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Tom Lane 2004-03-31 15:17:25 Re: Slow IN query
Previous Message Tom Lane 2004-03-31 14:57:38 Re: Question about rtrees (overleft replacing left in nodes)

Browse pgsql-patches by date

  From Date Subject
Next Message Andrew Dunstan 2004-03-31 15:23:28 Re: logging statement levels
Previous Message Tom Lane 2004-03-31 14:57:38 Re: Question about rtrees (overleft replacing left in nodes)