From: | "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com> |
---|---|
To: | Hannes Dorbath <light(at)theendofthetunnel(dot)de> |
Cc: | pgsql-performance(at)postgresql(dot)org |
Subject: | Re: Fastest way / best practice to calculate "next birthdays" |
Date: | 2008-05-04 16:11:34 |
Message-ID: | 481DE036.90706@commandprompt.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-performance |
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
From | Date | Subject | |
---|---|---|---|
Next Message | Hannes Dorbath | 2008-05-04 17:50:37 | Re: Fastest way / best practice to calculate "next birthdays" |
Previous Message | Hannes Dorbath | 2008-05-04 12:29:58 | Fastest way / best practice to calculate "next birthdays" |