Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Data Bases > Pgsql Performance > Re: Fastest way...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 2 of 5 Topic 4046 of 4294
Post > Topic >>

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

by jd@[EMAIL PROTECTED] ("Joshua D. Drake") May 4, 2008 at 09:11 AM

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


-- 
Sent via pgsql-performance mailing list (pgsql-performance@[EMAIL PROTECTED]
)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-performance
 




 5 Posts in Topic:
Fastest way / best practice to calculate "next birthdays"
Hannes Dorbath <light@  2008-05-04 14:29:58 
Re: Fastest way / best practice to calculate "next birthdays"
jd@[EMAIL PROTECTED] (&q  2008-05-04 09:11:34 
Re: Fastest way / best practice to calculate "next birthdays"
Hannes Dorbath <light@  2008-05-04 19:50:37 
Re: Fastest way / best practice to calculate "next birthdays"
zb@[EMAIL PROTECTED] (Zo  2008-05-04 21:05:21 
Re: Fastest way / best practice to calculate "next birthdays"
pgsql@[EMAIL PROTECTED]   2008-05-05 15:11:38 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Sep 6 15:47:53 CDT 2008.