From: Josh Berkus <josh@agliodbs.com>
To: Jaime Casanova <systemguards@gmail.com>
Cc: performance pgsql <pgsql-performance@postgresql.org>
Subject: Re: estimated rows vs. actual rows
Date: Sun, 13 Feb 2005 13:41:09 -0800
Message-ID: <200502131341.09811.josh@agliodbs.com> (raw)
In-Reply-To: <c2d9e70e0502131327c95e63d@mail.gmail.com>
References: <c2d9e70e0502131327c95e63d@mail.gmail.com>
Jaime,
> Why is this query using a seq scan rather than a index scan?
Because it thinks a seq scan will be faster.
> i notice
> the diff between the estimated rows and actual rows (almost 2000).
Yes, ANALYZE, and possibly increasing the column stats, should help that.
> Can this affect the query plan? i think this is a problem of
> statistics, am i right? if so, what can be done?
Well, if the estimate was accurate, PG would be even *more* likely to use a
seq scan (more rows).
I think maybe you should establish whether a seq scan actually *is* faster?
Perhaps do SET enable_seqscan = false and then re-run the query a few times?
--
Josh Berkus
Aglio Database Solutions
San Francisco
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: josh@agliodbs.com, systemguards@gmail.com
Subject: Re: estimated rows vs. actual rows
In-Reply-To: <200502131341.09811.josh@agliodbs.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