Skip site navigation (1) Skip section navigation (2)

query question

From: Laurette Cisneros <laurette(at)nextbus(dot)com>
To: pgsql-performance(at)postgresql(dot)org
Subject: query question
Date: 2002-12-06 23:32:01
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-performance
Silly question (and just because I would like to know exactly why):

This query:
select distinct x, y 
  from table1 t 
  join table2 t2
 using (col1) 
order by x;

is *slower* than this query:

select disting x, y 
  from table1 
 where col1 = (select col1 from table2) 

Is this because in the latter case the select col1 is cached?

Ooo, I would love to have a web page full of these tidbits (along with how 
to get around the max and min aggregates and why as an example..., etc.)!


Laurette Cisneros
The Database Group
(510) 420-3137
NextBus Information Systems, Inc.
There is more to life than just SQL.


pgsql-performance by date

Next:From: Josh BerkusDate: 2002-12-07 00:38:18
Subject: Re: query question
Previous:From: Tom LaneDate: 2002-12-06 23:07:08
Subject: Re: Speeding up aggregates

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group