Hi there,

I tried to force query to use index by specifying high execution cost, but
without success, even seqscan cost doesn't changed. This is 8.4.1

=# explain select count(*) from spots where coordinates <@ 
'(0,0),(0.1,0.1)'::box;
QUERY PLAN --------------------------------------------------------------------
 Aggregate  (cost=26620.84..26620.85 rows=1 width=0)
   ->  Seq Scan on spots  (cost=0.00..25328.12 rows=517085 width=0)
         Filter: (coordinates <@ '(0.1,0.1),(0,0)'::box)
(3 rows)

Time: 1.944 ms
=# alter FUNCTION pt_contained_box(point, box) COST 10000;
ALTER FUNCTION
Time: 369.800 ms
=# explain select count(*) from spots where coordinates <@ 
'(0,0),(0.1,0.1)'::box;
QUERY PLAN --------------------------------------------------------------------
 Aggregate  (cost=26620.84..26620.85 rows=1 width=0)
   ->  Seq Scan on spots  (cost=0.00..25328.12 rows=517085 width=0)
         Filter: (coordinates <@ '(0.1,0.1),(0,0)'::box)
(3 rows)

Time: 0.891 ms


        Regards,
                Oleg
_____________________________________________________________
Oleg Bartunov, Research Scientist, Head of AstroNet (www.astronet.ru),
Sternberg Astronomical Institute, Moscow University, Russia
Internet: o...@sai.msu.su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

--
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to