Re: : Cost calculation for EXPLAIN output

Поиск
Список
Период
Сортировка
Искать
От
Shaun Thomas
Тема
Re: : Cost calculation for EXPLAIN output
Дата
Msg-id
4F466FB6.8070609@peak6.com
Ответ на
Список
Дерево обсуждения
: Cost calculation for EXPLAIN output Venkat Balaji <venkat.balaji@verse.in>
Re: : Cost calculation for EXPLAIN output "Kevin Grittner" <Kevin.Grittner@wicourts.gov>
Re: : Cost calculation for EXPLAIN output Venkat Balaji <venkat.balaji@verse.in>
Re: : Cost calculation for EXPLAIN output Shaun Thomas <sthomas@peak6.com>
Re: : Cost calculation for EXPLAIN output Venkat Balaji <venkat.balaji@verse.in>
On 02/23/2012 06:21 AM, Venkat Balaji wrote:

> 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. :)

I suggest you set log_min_duration_statement to something like 1000, to 
send any query that takes longer than 1 second to the PG logs. 
Concentrate on those queries, because ones like this are already working 
right.

-- 
Shaun Thomas
OptionsHouse | 141 W. Jackson Blvd. | Suite 500 | Chicago IL, 60604
312-444-8534
sthomas@peak6.com

______________________________________________

See http://www.peak6.com/email_disclaimer/ for terms and conditions related to this email
В списке pgsql-performance по дате отправления
От: Kevin Grittner
Дата:
От: Alessandro Gagliardi
Дата:
Сообщение: Re: set autovacuum=off
FAQ