Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: [PGSQL v8.2.5] Similar queries behave differently


  • From: Gregory Stark <stark(at)enterprisedb(dot)com>
  • To: "Reg Me Please" <regmeplease(at)gmail(dot)com>
  • Cc: <pgsql-general(at)postgresql(dot)org>
  • Subject: Re: [PGSQL v8.2.5] Similar queries behave differently
  • Date: Thu, 25 Oct 2007 12:20:40 +0100
  • Message-id: <87lk9rl9tj(dot)fsf(at)oxford(dot)xeocode(dot)com>

"Gregory Stark" <stark(at)enterprisedb(dot)com> writes:

> "Reg Me Please" <regmeplease(at)gmail(dot)com> writes:
>
>>                ->  Seq Scan on tt_elem  (cost=0.00..29.40 rows=1940 width=8) 
>>                                         (actual time=0.012..0.013 rows=1 loops=1)
>
> The discrepancy etween the estimated rows and actual rows makes me think
> you've not analyzed this table in a long time. It's probably best to analyze
> the whole database to have a consistent set of statistics and to catch any
> other old table stats.
>
> There could be other misestimations based due to Postgres limitations but
> first fix the out of date stats and re-post both plans.

Actually it's pretty clear there are some other bad estimations as well. You
should send along the view definition too.

And I would recommend you try it with a normal JOIN ON/USING instead of the
NATURAL JOIN. It's possible it's joining on some unexpected columns -- though
that doesn't really look like it's the case here.

-- 
  Gregory Stark
  EnterpriseDB          http://www.enterprisedb.com



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group