Re: Fastest way / best practice to calculate "next birthdays"
От
Joshua D. Drake
Тема
Re: Fastest way / best practice to calculate "next birthdays"
Дата
Msg-id
481DE036.90706@commandprompt.com
Ответ на
Fastest way / best practice to calculate "next birthdays" (Hannes Dorbath)
Список
Дерево обсуждения
Fastest way / best practice to calculate "next birthdays" Hannes Dorbath <light@theendofthetunnel.de>
Re: Fastest way / best practice to calculate "next birthdays" "Joshua D. Drake" <jd@commandprompt.com>
Re: Fastest way / best practice to calculate "next birthdays" Hannes Dorbath <light@theendofthetunnel.de>
Re: Fastest way / best practice to calculate "next birthdays" Zoltan Boszormenyi <zb@cybertec.at>
Re: Fastest way / best practice to calculate "next birthdays" Shane Ambler <pgsql@Sheeky.Biz>
Re: Fastest way / best practice to calculate "next birthdays" "er.tejaspatel88@gmail.com" <er.tejaspatel88@gmail.com>
Re: Fastest way / best practice to calculate "next
birthdays" Kevin Grittner <kgrittn@ymail.com>
Re: Fastest way / best practice to calculate "next birthdays" "David G. Johnston" <david.g.johnston@gmail.com>
Re: Fastest way / best practice to calculate "next birthdays" Bosco Rama <postgres@boscorama.com>
Re: Fastest way / best practice to calculate "next birthdays" Jim Nasby <Jim.Nasby@BlueTreble.com>
Re: Fastest way / best practice to calculate "next birthdays" "David G. Johnston" <david.g.johnston@gmail.com>
Hannes Dorbath wrote:
> The subject basically says it all, I'm looking for the fastest
> (indexable) way to calculate the next birthdays relative to NOW() from a
> dataset of about 1 million users.
>
> I'm currently using a function based index, but leap year handling /
> mapping February 29 to February 28 gives me some headaches.
>
> Is there any best practice to do that in PostgreSQL?
postgres=# SELECT current_date|| ' a ' || to_char(current_date, 'Day'),
current_date + '1 Year'::interval || ' a ' || to_char(current_date + '1
Year'::interval, 'Day') as next_birthday;
?column? | next_birthday
------------------------+---------------------------------
2008-05-04 a Sunday | 2009-05-04 00:00:00 a Monday
?
Sincerely,
Joshua D. Drake
В списке pgsql-performance по дате отправления
От: Hannes Dorbath
Дата:
От: Hannes Dorbath
Дата: