pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Charlie Savage <cfis@interserv.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Index Scan Costs versus Sort
Date: Thu, 10 Nov 2005 13:04:41 -0500
Message-ID: <10461.1131645881@sss.pgh.pa.us> (raw)
In-Reply-To: <dkvu9b$305t$1@news.hub.org>
References: <dkvu9b$305t$1@news.hub.org>

Charlie Savage <cfis@interserv.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



view thread (5+ messages)  latest in thread

Message-ID: <10461.1131645881@sss.pgh.pa.us>
Permalink:  ../10461.1131645881@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/10461.1131645881@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: tgl@sss.pgh.pa.us, cfis@interserv.com
  Subject: Re: Index Scan Costs versus Sort
  In-Reply-To: <10461.1131645881@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox