Re: : Cost calculation for EXPLAIN output

From: Venkat Balaji <venkat(dot)balaji(at)verse(dot)in>
To: sthomas(at)peak6(dot)com
Cc: PGSQL Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: : Cost calculation for EXPLAIN output
Date: 2012-02-26 17:22:45
Message-ID: CAFrxt0jaySGjjYg5VrVjKHR=8+rad=Yf9-okEM-r9NKXDwz47Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Thanks for your valuable inputs !

The cost is "13.88" to fetch 1 row by scanning an Primary Key
>> indexed column.
>>
>> Isn't the cost for fetching 1 row is too high ?
>>
>
> Not really. The "cost" is really just an estimate to rank alternate query
> plans so the database picks the least expensive plan. The number '13.88' is
> basically meaningless. It doesn't translate to any real-world equivalent.
> What you actually care about is the execution time. If it takes 0.25ms or
> something per row, that's what really matters.
>
> For what it's worth, it looks like you have the right query plan, there.
> Scan the primary key for one row. What's wrong with that? Our systems have
> tables far larger than yours, handling 300M queries per day that are far
> more expensive than a simple primary key index scan. You'll be fine. :)

Execution time is 0.025 ms per row. I am quite happy with the execution
time, even the plan is going the correct way. The total execution time
reduced from 2.5 hrs to 5.5 seconds. I am looking for a room for further
improvement -- probably quite ambitious :-) ..

But, when i reduced random_page_cost to 2, the cost reduced to 7.03 and
execution also have reduced by almost 50%. Is this an gain ?

Please comment !

Thanks,
VB

_________________**________________

>
> See http://www.peak6.com/email_**disclaimer/<http://www.peak6.com/email_disclaimer/>for terms and conditions related to this email
>

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Stefan Keller 2012-02-26 19:11:24 Re: PG as in-memory db? How to warm up and re-populate buffers? How to read in all tuples into memory?
Previous Message Venkat Balaji 2012-02-26 17:14:51 Re: : Cost calculation for EXPLAIN output