Re: Can this query be optimized?

Поиск
Список
Период
Сортировка
От Claus Heiko Niesen
Тема Re: Can this query be optimized?
Дата
Msg-id 5.1.0.14.2.20011108093538.00ae2858@pop.gmx.net
обсуждение исходный текст
Ответ на Re: Can this query be optimized?  (Tom Lane <tgl@sss.pgh.pa.us>)
Список pgsql-sql
Ooops, I posted one test SQL statements which really didn't make 
sense.  This is the correct one:

select distinct extract(year from date) as year, extract(month from date) 
as month from week_pics order by year desc, month desc;

I try to get a list of all the months that have a picture. So the day part 
of the date should be ignored.
  Claus

At 08:30 AM 11/08/2001, Tom wrote:
>Claus Heiko Niesen <cniesen@gmx.net> writes:
> > I'm stuck optimizing the following query:
> > select distinct extract(year from date) as year, extract(month from date)
> > as month, date from week_pics order by date desc;
>
>Perhaps it would work to forget the "distinct" and instead GROUP BY
>date.
>
>                         regards, tom lane




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

Предыдущее
От: "Josh Berkus"
Дата:
Сообщение: Re: Can this query be optimized?
Следующее
От: Claus Heiko Niesen
Дата:
Сообщение: Re: Can this query be optimized?