| From: | Josh Berkus <josh(at)agliodbs(dot)com> |
|---|---|
| To: | Jaime Casanova <systemguards(at)gmail(dot)com> |
| Cc: | performance pgsql <pgsql-performance(at)postgresql(dot)org> |
| Subject: | Re: estimated rows vs. actual rows |
| Date: | 2005-02-13 21:41:09 |
| Message-ID: | 200502131341.09811.josh@agliodbs.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
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
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jaime Casanova | 2005-02-14 03:18:52 | Re: estimated rows vs. actual rows |
| Previous Message | Jaime Casanova | 2005-02-13 21:27:45 | estimated rows vs. actual rows |