Re: subselect query time and loops problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pankaj naug <pankajnaug(at)yahoo(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: subselect query time and loops problem
Date: 2005-04-09 23:26:19
Message-ID: 24401.1113089179@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

pankaj naug <pankajnaug(at)yahoo(dot)com> writes:
> Both servers have same version with same postgresql.conf. But the time taken by both the servers with subselect are way different. 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Carlos Moreno 2005-04-09 23:47:05 Re: Question on triggers and plpgsql
Previous Message pankaj naug 2005-04-09 20:21:54 subselect query time and loops problem