From: Heikki Linnakangas <heikki@enterprisedb.com>
To: Brian Cox <brian.cox@ca.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: limit + order by is slow if no rows in result set
Date: Mon, 12 Feb 2007 23:26:04 +0000
Message-ID: <45D0F78C.40000@enterprisedb.com> (raw)
In-Reply-To: <45D0DDED.1070400@ca.com>
References: <45D0DDED.1070400@ca.com>
Brian Cox wrote:
>
> There are 1.9M rows in ts_defects and indexes on b.ts_id (primary key)
> d.ts_biz_event_id and d.ts_occur_date. Both queries below return 0
> rows. The 1st runs fast and the 2nd > 400x slower. The 2nd query
> differs from the 1st only by the addition of "limit 1".
>
> Why the big difference in performance?
Please run EXPLAIN ANALYZE on both queries, and send back the results.
Also, what indexes are there on the tables involved?
--
Heikki Linnakangas
EnterpriseDB http://www.enterprisedb.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 using the --to and --cc options:
reply via email
To: pgsql-performance@postgresql.org
Cc: heikki@enterprisedb.com, brian.cox@ca.com
Subject: Re: limit + order by is slow if no rows in result set
In-Reply-To: <45D0F78C.40000@enterprisedb.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