• Hugo Kornelis (2/17/2009)

    Anyhow, never indexing a datetime is not a wise decision.

    More of an avoidance than a hard-and-fast rule. As an ordering method, not a problem. As a clustered index, ok. I'm a little concerned about how a clustered datetime would affect multiple users inserting at the same time. But try querying for 2/16/09 8:17pm (the time right now MST), in a table where the datetime is acting like a timestamp. It's more like indexing a real number.

    As for high selectivity, I DO index GUIDs. But I would never make a user enter one!

    Finally, the datetime datatype is not inexact.

    Yes, dates are integers at some level. But my users' concept of dates don't extend to 3.333 milliseconds.

    Now, confession time. I actually LIKE Oracle's approach of storing the time as the decimal portion of a floating point number, where it's the fraction of the day. Maybe that's where the aversion for indexing dates comes from.

    Kevin

    --
    Please upgrade to .sig 2.0