From: aschetinin@gmail.com
To: pgsql-bugs@postgresql.org
Subject: BUG #6426: Complex query runs 10 times longer with "LIMIT 20"
Date: Wed, 01 Feb 2012 16:14:00 +0000
Message-ID: <E1Rscoq-0002pv-Ep@wrigleys.postgresql.org> (raw)
The following bug has been logged on the website:
Bug reference: 6426
Logged by: Andrew Schetinin
Email address: aschetinin@gmail.com
PostgreSQL version: 9.1.2
Operating system: Debian Linux
Description:
I have a complex query that, when unlimited, runs in 2.5 seconds and returns
400+ records.
The same query, with added "LIMIT 20 OFFSET 0" at the end, runs 25 seconds!
(and returns correct 20 records)
I think there is a bug in the query optimizer. Other variations of this
query (with slightly different constraints and joins) work fast with and
without LIMIT.
The same query works fast in PostgreSQL 8.4 (tested on another machine with
Ubuntu and not exactly the same but very-very similar database).
I can provide the query execution plans of the two cases (as long as they
are not published on the Web); but not the database because there is
customer's data in it.
Please let me know if anybody is interested in researching the problem.
Regards,
Andrew Schetinin
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: aschetinin@gmail.com
Subject: Re: BUG #6426: Complex query runs 10 times longer with "LIMIT 20"
In-Reply-To: <E1Rscoq-0002pv-Ep@wrigleys.postgresql.org>
References: <E1Rscoq-0002pv-Ep@wrigleys.postgresql.org>
* 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