From: Tom Lane <tgl@sss.pgh.pa.us>
To: pankaj naug <pankajnaug@yahoo.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: subselect query time and loops problem
Date: Sat, 09 Apr 2005 19:26:19 -0400
Message-ID: <24401.1113089179@sss.pgh.pa.us> (raw)
In-Reply-To: <20050409202154.71561.qmail@web30507.mail.mud.yahoo.com>
References: <20050409202154.71561.qmail@web30507.mail.mud.yahoo.com>
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 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: tgl@sss.pgh.pa.us, pankajnaug@yahoo.com
Subject: Re: subselect query time and loops problem
In-Reply-To: <24401.1113089179@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox