Re: help with date_part & day of week

Поиск
Список
Период
Сортировка
От
Тема Re: help with date_part & day of week
Дата
Msg-id 0a9501c60ce1$6229cf80$6402a8c0@iwing
обсуждение исходный текст
Ответ на Re: help with date_part & day of week  (Bruce Momjian <pgman@candle.pha.pa.us>)
Ответы Re: help with date_part & day of week  (Bruce Momjian <pgman@candle.pha.pa.us>)
Список pgsql-novice
> You can really do it using CASE:
>
> CASE
> WHEN dow() = 0 THEN 6
> ELSE dow() - 1
> END

how good is this solution in regards to performance? i always thought CASE
and the such should only be used for last resorts. and now there is also a
date function involved that gets twice in 6/7 of all cases...

regarding these concerns, can you give me your opinion on this solution i
came up:

SELECT ((date_part('dow', now()) + 6) % 7) AS weekday

thanks,
thomas



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

Предыдущее
От: Bruce Momjian
Дата:
Сообщение: Re: help with date_part & day of week
Следующее
От: Michael Dean
Дата:
Сообщение: ecommerce soolution