From: Alex Lai <alai@sesda2.com>
To: Andrew Schetinin <aschetinin@gmail.com>
Cc: pgsql-bugs@postgresql.org
Subject: Re: BUG #6426: Complex query runs 10 times longer with "LIMIT 20"
Date: Wed, 01 Feb 2012 15:19:53 -0500
Message-ID: <4F299E69.4080605@sesda2.com> (raw)
In-Reply-To: <CA+fUw71dQu9enLViyHnMfe7i2ChwJXUKcVWPg6bdsN_NwMvBcg@mail.gmail.com>
References: <E1Rscoq-0002pv-Ep@wrigleys.postgresql.org>
<4F2995BB.6050708@sesda2.com>
<CA+fUw71dQu9enLViyHnMfe7i2ChwJXUKcVWPg6bdsN_NwMvBcg@mail.gmail.com>
Andrew Schetinin wrote:
> Hi Alex,
>
> Thank you. I played with subqueries, but in this case I did not see a
> good enough improvement.
>
> In my specific case, what I've seen from the query execution plans, is
> that without LIMIT the query uses Hash Joins, but once I add LIMIT, it
> starts using Nested Loop Joins almost everywhere.
>
> Regards,
>
> Andrew
>
> On Wed, Feb 1, 2012 at 9:42 PM, Alex Lai <alai@sesda2.com
> <mailto:alai@sesda2.com>> wrote:
>
> Hi Andrew,
> I posted for another post, its may give you a workaround.
> I still not fully understand how PG choose execute plan that slow
> down so much.
>
> I had the same situation in one of my query.
> Use the subquery can speed up almost by 100 times faster.
>
> ..........
>
>
>
> Hope this help.
>
>
> Best Regards,
> Alex Lai
>
> --
> Best regards,
>
>
> Alex Lai
> OMI SIPS DBA ADNET Systems , Inc. 7515 Mission Drive, Suite A100
> Lanham, MD 20706 301-352-4657 (phone) 301-352-0437 (fax)
> alai@sesda2.com <mailto:alai@sesda2.com>
>
>
>
>
> --
> --
> Andrew Schetinin
Hi Andrew,
I am interested in see your query.
--
Best regards,
Alex Lai
OMI SIPS DBA ADNET Systems , Inc.
7515 Mission Drive,
Suite A100 Lanham, MD 20706
301-352-4657 (phone)
301-352-0437 (fax)
alai@sesda2.com
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-bugs@postgresql.org
Cc: alai@sesda2.com, aschetinin@gmail.com
Subject: Re: BUG #6426: Complex query runs 10 times longer with "LIMIT 20"
In-Reply-To: <4F299E69.4080605@sesda2.com>
References: <E1Rscoq-0002pv-Ep@wrigleys.postgresql.org> <4F2995BB.6050708@sesda2.com> <CA+fUw71dQu9enLViyHnMfe7i2ChwJXUKcVWPg6bdsN_NwMvBcg@mail.gmail.com> <4F299E69.4080605@sesda2.com>
* 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