Re: Fastest way / best practice to calculate "next birthdays"

Поиск
Список
Период
Сортировка
От David G. Johnston
Тема Re: Fastest way / best practice to calculate "next birthdays"
Дата
Msg-id CAKFQuwaVNgfp6nUMz+_sR-H=KCN9aS_srJn44f5qW3MHR_vTvw@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Fastest way / best practice to calculate "next birthdays"  (Bosco Rama <postgres@boscorama.com>)
Список pgsql-performance
On Thursday, May 21, 2015, Bosco Rama <postgres@boscorama.com> wrote:
On 05/20/15 20:22, David G. Johnston wrote:
> On Monday, May 18, 2015, er.tejaspatel88@gmail.com <
> er.tejaspatel88@gmail.com> wrote:
>
>> If I have to find upcoming birthdays in current week and the current week
>> fall into different months - how would you handle that?
>>
>
> Extract(week from timestamptz_column)
>
> ISO weeks are not affected by month boundaries but do start on Monday.

There is the year start/end boundary conditions to worry about there.

If the current week covers Dec28-Jan02 then week of year won't help for
a birthday on Jan01 or Jan02 if 'today' is in the Dec portion.  Ditto
for birthday in Dec portion when 'today' is in the Jan portion.


You need to read the documentation regarding ISO year and ISO week more carefully.  There is no issue with years only ensuring that your definition of week starts with Monday and contains 7 days.  The ISO year for January 1st can be different than the Gregorian year for the same.

David J. 

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

Предыдущее
От: Bosco Rama
Дата:
Сообщение: Re: Fastest way / best practice to calculate "next birthdays"
Следующее
От: Josh Berkus
Дата:
Сообщение: Re: PostgreSQL disk fragmentation causes performance problems on Windows