Re: Why index used/not used

From: Anton Maksimenkov <engineer(at)hlebprom(dot)ru>
To: Scott Marlowe <smarlowe(at)qwest(dot)net>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: Why index used/not used
Date: 2004-07-21 08:20:44
Message-ID: 40FE275C.7060508@hlebprom.ru
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Scott Marlowe wrote:

> There are several settings that tune the planner to tell it when to
> switch from an index scan to a seq scan. random_page_cost is the most
> commonly adusted one. Try dropping it from the default of 4 to
> something around 1.4 to 2.0 or so.
...
> and run the query again. Test several of your queries and find out
> where the turning point is, and then adjust the random_page_cost to
> cause it to switch at about the right time.

Thank's for explain. With "random_page_cost = 2.0" situation is much
better. I will follow you tips.

EXPLAIN ANALYZE SELECT * FROM traf_raw WHERE sip_id='19' LIMIT 10 OFFSET
100000;
...
Limit (cost=5042.22..5042.56 rows=1 width=56) (actual
time=110.32..110.32 rows=0 loops=1)
-> Index Scan using traf_raw_sip on traf_raw (cost=0.00..5042.56
rows=11020 width=56) (actual time=0.30..95.95 rows=10977 loops=1)
Index Cond: (sip_id = 19)
Total runtime: 110.52 msec

--
engineer

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Peter Eisentraut 2004-07-21 10:16:39 Re: Aligned Output!!
Previous Message Scott Marlowe 2004-07-21 08:14:49 Re: Why index used/not used