Re: Query too slow

From: Stephan Szabo <sszabo(at)megazone(dot)bigpanda(dot)com>
To: Rhaoni Chiu Pereira <rhaoni(at)sistemica(dot)info>
Cc: PostgreSQL Performance <pgsql-performance(at)postgresql(dot)org>
Subject: Re: Query too slow
Date: 2003-08-25 15:44:43
Message-ID: 20030825083343.H90125-100000@megazone.bigpanda.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On Mon, 25 Aug 2003, Rhaoni Chiu Pereira wrote:

> Hi List,
>
> As I said before, I'm not a DBA " yet" , but I'm learning ... and I
> already have a PostgreSQL running, so I have to ask some help...
> I got a SQL as folows :

...

Looking at the explain:

It's choosing lots of nested loops because it's expecting a small number
of rows to be returned at each step but in reality there are alot of rows
so that's may not really be a good choice.

For example the scan of ftnfco00 is expected to return 295 rows but
actually returns 9339, and it looks like it's not estimating the number of
matches between the tables very well either since the real count gets up
to 240000 in a step where the estimated rows goes to 1.

What does explain analyze give after set enable_nestloop=off;?

In response to

Responses

Browse pgsql-performance by date

  From Date Subject
Next Message Shridhar Daithankar 2003-08-25 16:35:05 Re: Query too slow
Previous Message Tomka Gergely 2003-08-25 15:27:32 Re: Tests