List:General Discussion« Previous MessageNext Message »
From:Terence Date:August 25 2005 4:38am
Subject:Re: Birthday strategy
View as plain text  
Try to avoid running functions against columns, unless you have very 
little data, as it doesnt scale well (I'm talking 6 figure tables).

Two options I can suggest are:
1. Write a scheduled job using your MONTH() DAY() to replace the values 
into a birthdays table on a daily basis
2. Use 2 seperate columns day_birthday, month_birthday (int both) and 
index them if you have a large number

Good luck

Pooly wrote:
> 2005/8/24, Cummings, Shawn (GNAPs) <shawn@stripped>:
> 
>>The 29th wouldn't be an issue because if that is their birthday -- and
>>today is 2/29 -- it will show up.
> 
> 
> It will only happen once every 4 years... I'll go with the two fields
> solution and make a special case for leap years.
> thanks for your help.
> 
> 
>>
>>Pooly wrote:
>>
>>
>>>Hi,
>>>
>>>I would like to display a list of members who have their birthday a
>>>given day (today for instance).
>>>My idea is to store their birth date in a column, and then query the
>>>table against the column. But the query would be like :
>>>select id from members where MONTH(birthday) = MONTH(NOW()) AND
>>>DAY(birthday)=DAY(NOW())
>>>but it would perform a entire table scan with that.
>>>What would be your best strategy for that sort of query ?
>>>And how would you deal with 29th of february ?
>>>
>>>
>>>
>>
>>
>>
> 
> 
Thread
Birthday strategyPooly24 Aug
  • Re: Birthday strategyJason Pyeron24 Aug
  • Re: Birthday strategyDan Baker24 Aug
  • Re: Birthday strategyGleb Paharenko24 Aug
    • Re: Birthday strategyTerence25 Aug
      • Re: Birthday strategyGleb Paharenko25 Aug
  • Re: Birthday strategyJigal van Hemert25 Aug
    • Re: Birthday strategyPooly25 Aug
Re: Birthday strategyPooly24 Aug
  • Re: Birthday strategyTerence25 Aug