Re: join on three tables is slow

From: Gerry Reno <greno(at)verizon(dot)net>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: join on three tables is slow
Date: 2007-12-12 14:29:49
Message-ID: 475FF05D.9040009@verizon.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Tom Lane wrote:
> Gerry Reno <greno(at)verizon(dot)net> writes:
>
>> Pavel Stehule wrote:
>>
>>> there is diference in agg position. Send, please, query and explain
>>> analyze output.
>>>
>
> [ explain analyze output ]
>
> The rowcount estimates seem pretty far off, even for simple cases that
> I'd expect it to get right, eg
>
>
>> -> Seq Scan on res_partner_address a (cost=0.00..88.40
>> rows=16 width=552) (actual time=0.851..16.131 rows=559 loops=1)
>> Filter: ((("type")::text = 'default'::text) OR ("type" IS
>> NULL))
>>
>
> Are the ANALYZE stats up to date for these tables?
>
> What PG version is this, anyway?
>
> regards, tom lane
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend
>
>
-bash-3.2$ yum list postgresql
Loading "installonlyn" plugin
Installed Packages
postgresql.i386 8.2.4-1.fc7
installed

You were right on the money Tom. I vacuumed the database and now the
query with the boolean executes in only 50% more time than without.
About 15 secs instead of 10 secs. Big improvement. I hadn't seen a
vacuum produce this much of an improvement in performance before.

Thanks,
Gerry

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Scott Marlowe 2007-12-12 15:48:05 Re: Query design assistance - getting daily totals
Previous Message A. Kretschmer 2007-12-12 07:29:46 Re: Query design assistance - getting daily totals