pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Christopher Browne <cbbrowne@acm.org>
To: pgsql-performance@postgresql.org
Subject: Re: estimated rows vs. actual rows
Date: Mon, 14 Feb 2005 07:41:13 -0500
Message-ID: <m3r7jjpb4m.fsf@knuth.knuth.cbbrowne.com> (raw)
References: <c2d9e70e0502131327c95e63d@mail.gmail.com>
	<200502131341.09811.josh@agliodbs.com>
	<c2d9e70e05021319182db34831@mail.gmail.com>

After takin a swig o' Arrakan spice grog, systemguards@gmail.com (Jaime Casanova) belched out:
> On Sun, 13 Feb 2005 13:41:09 -0800, Josh Berkus <josh@agliodbs.com> wrote:
>> Jaime,
>> 
>> > Why is this query using a seq scan rather than a index scan?
>> 
>> Because it thinks a seq scan will be faster.
>> 
> I will suggest him to probe with seq scans disabled.
>
> But, IMHO, if the table has 143902 and it thinks will retrieve 2610
> (almost 1.81% of the total). it won't be faster with an index?

If the 2610 rows are scattered widely enough, it may be cheaper to do
a seq scan.

After all, with a seq scan, you read each block of the table's pages
exactly once.

With an index scan, you read index pages _and_ table pages, and may do
and redo some of the pages.

It sounds as though it's worth forcing the matter and trying it both
ways and comparing them.  Don't be surprised if the seq scan is in
fact faster...
-- 
select 'cbbrowne' || '@' || 'gmail.com';
http://cbbrowne.com/info/emacs.html
When aiming for the common denominator, be prepared for the occasional
division by zero.



view thread (6+ messages)

Message-ID: <m3r7jjpb4m.fsf@knuth.knuth.cbbrowne.com>
Permalink:  ../m3r7jjpb4m.fsf@knuth.knuth.cbbrowne.com/
Also on:    postgresql.org/message-id/m3r7jjpb4m.fsf@knuth.knuth.cbbrowne.com

 · 

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: cbbrowne@acm.org
  Subject: Re: estimated rows vs. actual rows
  In-Reply-To: <m3r7jjpb4m.fsf@knuth.knuth.cbbrowne.com>

* 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