Re: Strange logic for partial index proving

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: laser <laser(at)toping(dot)com(dot)cn>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Strange logic for partial index proving
Date: 2005-06-23 14:43:39
Message-ID: 5042.1119537819@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Richard Huxton <dev(at)archonet(dot)com> writes:
> laser wrote:
>> Aggregate (cost=13933.39..13933.39 rows=1 width=0) (actual
>> time=1901.761..1901.762 rows=1 loops=1)
>> -> Index Scan using partial_idx on partial_idx_t (cost=0.00..12622.93
>> rows=524183 width=0) (actual time=0.130..1230.634 rows=524288 loops=1)
>> Index Cond: ((id >= 1) AND (id <= 2000000000))
>> Total runtime: 1901.876 ms

>> Aggregate (cost=100009638.60..100009638.60 rows=1 width=0) (actual
>> time=1567.317..1567.318 rows=1 loops=1)
>> -> Seq Scan on partial_idx_t (cost=100000000.00..100008327.88
>> rows=524288 width=0) (actual time=0.046..906.747 rows=524288 loops=1)
>> Total runtime: 1567.401 ms

> I'd say your configuration settings are a long way from accurate.

Actually, I'd say these estimates are pretty good. Ignoring the
100000000 penalty from "set enable_seqscan off", we have:

Planner cost ratio: 13933.39 / 9638.60 = 1.45
Actual cost ratio: 1901.876 / 1567.401 = 1.21

Given all the inaccuracies in the planning process, getting as close as
that is about the best you can hope for.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-06-23 14:47:34 Re: HEAD initdb failing on OSX
Previous Message Dave Cramer 2005-06-23 14:33:00 Re: HEAD initdb failing on OSX, addendum