Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Just thinking that maybe you had a single core lookup that you needed to optimise. A slow running "find all events that repeat on today." If it's something that's more deeply scattered through the system then it might not be worth attacking.

If you just needed the events for today you should be able to do something simpler. Depends on the complexity of the frequency controls. But imagine weekly recurring - you should be able to do something like "(today - start day) mod 7 == 0" to find all weekly events that hit today. You could then construct a similar rule for each different frequency:

    -- not real code!
    select * from event where
    (frequency = 'daily')
    or (frequency = 'weekly' and (today - starts) % 7 == 0)
    or (frequency = 'monthly' and day(today) == day(starts))
    or (frequency = ...)

Just a thought.


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: