• Les Cardwell (3/15/2010)


    Interestingly enough, the biggest cost to the initial query, which probably exceeded benefits of denormalization, was using a 'function' in a WHERE predicate...

    WHERE P_MS.DateReceived > getdate() - 365

    ...would have been better expressed declaring a scalar variable:

    DECLARE @selectDate = getdate()-365

    ...

    WHERE P_MS.DateReceived > @selectDate

    ...

    ...which would allow the optimizer to use an index on DateReceived.

    Nicely said Grasshopper 🙂

    I like the idea of denormalization, but many people look for these types of articles to re-establish their non-existing point of designing a sloppy, good for nothing database. They just totally ignore the last paragraph! :rolleyes:

    It usually takes alot of time and effort to denormalize a database. But shouldn't you FIRST NORMALIZE then DENORMALIZE if benefit can be measured???? Right??? 😀