force index problem in 8.4.1

From: Oleg Bartunov <oleg(at)sai(dot)msu(dot)su>
To: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: force index problem in 8.4.1
Date: 2009-11-25 22:35:55
Message-ID: Pine.LNX.4.64.0911260124500.6801@sn.sai.msu.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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: oleg(at)sai(dot)msu(dot)su, http://www.sai.msu.su/~megera/
phone: +007(495)939-16-83, +007(495)939-23-83

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2009-11-25 22:54:29 Deleted WAL files held open by backends in Linux
Previous Message Tom Lane 2009-11-25 22:01:35 Re: Application name patch - v3