Re: subselect query time and loops problem - Mailing list pgsql-sql

From Tom Lane
Subject Re: subselect query time and loops problem
Date
Msg-id 24401.1113089179@sss.pgh.pa.us
Whole thread Raw
In response to subselect query time and loops problem  (pankaj naug <pankajnaug@yahoo.com>)
List pgsql-sql
pankaj naug <pankajnaug@yahoo.com> writes:
> Both servers have same version with same postgresql.conf. But the time taken by both the servers with subselect are
waydifferent. the loops and the query time are completely different. both servers have same indexes.
 

Evidently one has been analyzed much more recently than the other,
because the estimated row counts are wildly different.

You didn't say which PG version this is, but I gather that it's pre-7.4,
which means that the performance of IN (SELECT ...) is generally going
to be awful.  Either rewrite as a join or update to 7.4 or later.
        regards, tom lane


pgsql-sql by date:

Previous
From: pankaj naug
Date:
Subject: subselect query time and loops problem
Next
From: Carlos Moreno
Date:
Subject: Re: Question on triggers and plpgsql