Planner issue

From: Alex Turner <armtuk(at)gmail(dot)com>
To: "pgsql-performance(at)postgresql(dot)org" <pgsql-performance(at)postgresql(dot)org>
Subject: Planner issue
Date: 2005-03-22 14:56:02
Message-ID: 33c6269f05032206565ca4f9f1@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

I get the following output from explain analyze on a certain subset of
a large query I'm doing.

From the looks of it, I need to increase how often postgres uses an
index over a seq scan, but I'm not sure how to do that. I looked
through the run-time configuration docs on the website, but didn't see
anything pertaining to index selectivity.

Thanks,

Alex Turner
netEconomist

trendmls=# explain analyze select listnum from propmain where
listprice<=300000 and listprice>=220000;
QUERY PLAN
--------------------------------------------------------------------------------------------------------------
Seq Scan on propmain (cost=0.00..15556.05 rows=6228 width=4) (actual
time=0.093..506.730 rows=5671 loops=1)
Filter: ((listprice <= 300000::numeric) AND (listprice >= 220000::numeric))
Total runtime: 510.482 ms
(3 rows)

trendmls=# explain analyze select listnum from propmain where
listprice<=300000 and listprice>=250000;
QUERY PLAN
------------------------------------------------------------------------------------------------------------------------------------------
Index Scan using propmain_listprice_i on propmain
(cost=0.00..12578.65 rows=3486 width=4) (actual time=0.103..16.418
rows=3440 loops=1)
Index Cond: ((listprice <= 300000::numeric) AND (listprice >=
250000::numeric))
Total runtime: 18.528 ms
(3 rows)

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Bruno Wolff III 2005-03-22 15:17:07 Re: What about utility to calculate planner cost constants?
Previous Message Sabio - PSQL 2005-03-22 14:23:07 Too slow