From: Scott Marlowe <smarlowe@g2switchworks.com>
To: Y Sidhu <ysidhu@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: DISTINCT Question
Date: Tue, 08 May 2007 15:28:22 -0500
Message-ID: <1178656101.7497.29.camel@state.g2switchworks.com> (raw)
In-Reply-To: <b09064f30705081252i27df3236hb12c13b923d0f45f@mail.gmail.com>
References: <b09064f30705081252i27df3236hb12c13b923d0f45f@mail.gmail.com>
On Tue, 2007-05-08 at 14:52, Y Sidhu wrote:
> Does using DISTINCT in a query force PG to abandon any index search it
> might have embarked upon?
explain analyze select distinct request from businessrequestsummary
where lastflushtime between now() - interval '30 minutes' and now();
QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Unique (cost=3.04..3.04 rows=1 width=17) (actual time=110.565..162.630
rows=75 loops=1)
-> Sort (cost=3.04..3.04 rows=1 width=17) (actual
time=110.555..135.252 rows=6803 loops=1)
Sort Key: request
-> Index Scan using businessrequestsummary_lastflushtime_dx on
businessrequestsummary (cost=0.01..3.03 rows=1 width=17) (actual
time=0.063..59.674 rows=6803 loops=1)
Index Cond: ((lastflushtime >= (now() -
'00:30:00'::interval)) AND (lastflushtime <= now()))
Total runtime: 163.925 ms
(6 rows)
I'd say no.
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: smarlowe@g2switchworks.com, ysidhu@gmail.com
Subject: Re: DISTINCT Question
In-Reply-To: <1178656101.7497.29.camel@state.g2switchworks.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