Results 1 to 4 of 4
  1. #1
    Join Date
    Jan 2007
    Posts
    12

    Unanswered: Performance question: check by date or check by bool?

    This is just a simple question about performance: say you have a big list of events, some past and some in the future. The past events will not be used other than for statistics. What's the best way to query the database about future events:

    ... WHERE date > NOW()

    ...or...

    ... WHERE hasbeenprocessed = FALSE

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    i would go with the date comparison, simply because as far as i know mysql doesn't support booleans
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  3. #3
    Join Date
    Jan 2007
    Posts
    12
    I really meant to ask if calculating this by date was slower than an other way (I gave the example of a bool, but it could be a tinyint or enum). Is would seem that checking for a "flag" is quicker than comparing dates.

  4. #4
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    it would seem? you'll need to run a volume test then
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •