Re: Index Scan Costs versus Sort

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Charlie Savage <cfis(at)interserv(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Index Scan Costs versus Sort
Date: 2005-11-10 18:04:41
Message-ID: 10461.1131645881@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

Charlie Savage <cfis(at)interserv(dot)com> writes:
> 1. Postgresql estimates the index scan will be 50 times more costly
> than the seq scan (112870376 vs 2229858) yet in fact it only takes 3
> times longer to execute (2312426 s vs. 768403 s). My understanding is
> that postgresql assumes, via the random_page_cost parameter, that an
> index scan will take 4 times longer than a sequential scan. So why is
> the analyzer estimating it is 50 times slower?

The other factors that are likely to affect this are index correlation
and effective cache size. It's fairly remarkable that a full-table
index scan only takes 3 times longer than a seqscan; you must have both
a high correlation and a reasonably large cache. You showed us your
effective_cache_size setting, but what's the pg_stats entry for
completechain.tlid contain? Can you quantify what the physical
ordering of tlid values is likely to be?

regards, tom lane

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Ashok Agrawal 2005-11-10 18:17:33 Re: Outer Join performance in PostgreSQL
Previous Message Steinar H. Gunderson 2005-11-10 17:58:43 Re: WAL sync behaviour