pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
DISTINCT Question
4+ messages / 4 participants
[nested] [flat]

* DISTINCT Question
@ 2007-05-08 19:52  Y Sidhu <ysidhu@gmail.com>
  0 siblings, 3 replies; 4+ messages in thread

From: Y Sidhu @ 2007-05-08 19:52 UTC (permalink / raw)
  To: pgsql-performance

Does using DISTINCT in a query force PG to abandon any index search it might
have embarked upon?

-- 
Yudhvir Singh Sidhu
408 375 3134 cell

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DISTINCT Question
@ 2007-05-08 19:55  Steinar H. Gunderson <sgunderson@bigfoot.com>
  parent: Y Sidhu <ysidhu@gmail.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Steinar H. Gunderson @ 2007-05-08 19:55 UTC (permalink / raw)
  To: Y Sidhu <ysidhu@gmail.com>; +Cc: pgsql-performance

On Tue, May 08, 2007 at 12:52:35PM -0700, Y Sidhu wrote:
> Does using DISTINCT in a query force PG to abandon any index search it might
> have embarked upon?

No.

If you need help with a specific query, please post it, along with your table
definitions and EXPLAIN ANALYZE output.

/* Steinar */
-- 
Homepage: http://www.sesse.net/



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DISTINCT Question
@ 2007-05-08 19:57  Joshua D. Drake <jd@commandprompt.com>
  parent: Y Sidhu <ysidhu@gmail.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Joshua D. Drake @ 2007-05-08 19:57 UTC (permalink / raw)
  To: Y Sidhu <ysidhu@gmail.com>; +Cc: pgsql-performance

Y Sidhu wrote:
> Does using DISTINCT in a query force PG to abandon any index search it 
> might have embarked upon?

Depends on the where clause.

> 
> -- 
> Yudhvir Singh Sidhu
> 408 375 3134 cell


-- 

       === The PostgreSQL Company: Command Prompt, Inc. ===
Sales/Support: +1.503.667.4564 || 24x7/Emergency: +1.800.492.2240
Providing the most comprehensive  PostgreSQL solutions since 1997
              http://www.commandprompt.com/

Donate to the PostgreSQL Project: http://www.postgresql.org/about/donate
PostgreSQL Replication: http://www.commandprompt.com/products/




^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: DISTINCT Question
@ 2007-05-08 20:28  Scott Marlowe <smarlowe@g2switchworks.com>
  parent: Y Sidhu <ysidhu@gmail.com>
  2 siblings, 0 replies; 4+ messages in thread

From: Scott Marlowe @ 2007-05-08 20:28 UTC (permalink / raw)
  To: Y Sidhu <ysidhu@gmail.com>; +Cc: pgsql-performance

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. 



^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2007-05-08 20:28 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2007-05-08 19:52 DISTINCT Question Y Sidhu <ysidhu@gmail.com>
2007-05-08 19:55 ` Steinar H. Gunderson <sgunderson@bigfoot.com>
2007-05-08 19:57 ` Joshua D. Drake <jd@commandprompt.com>
2007-05-08 20:28 ` Scott Marlowe <smarlowe@g2switchworks.com>

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