query question

Поиск
Список
Период
Сортировка
От Laurette Cisneros
Тема query question
Дата
Msg-id Pine.LNX.4.44.0212061531340.7895-100000@visor.corp.nextbus.com
обсуждение исходный текст
Ответы Re: query question
Список 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)
ORDER BY x;

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.)!

Thanks,

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



В списке pgsql-performance по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: Speeding up aggregates
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: query question