Query Design using nTile(x)

  • Wondering if anyone has any ideas on how to engineer this...

    So I have a 92 million row table with a clustered index on the sessionID. Contained in the table is the sessionID, URLId and page load duration(the amount of time the page took to load)

    What I need to do is find a take the 50th, 75 and 95th percentile of page load durations for each URLId (936 of them). Trying to just use the ntile function blows up hash matches and tables spools into the quadrillions for the execution plan. Anyone have any ideas as to how to break this down into something manageable?

  • SELECT TOP 50 PERCENT ?


    N 56°04'39.16"
    E 12°55'05.25"

  • There have been several post lately identifying poor performance with the ntile feature and some alternate methods have been proposed

    ex: http://sqljunkies.com/WebLog/sqlbi/archive/2006/04/19/20482.aspx

     

    Give that a shot!

     

    Cheers,

     


    * Noel

  • Yeah I just found that.  tweaked it to what I want and I got buckets.  Thanks a bunch.  Was working on this for about a week and kind of sad that after 30 minutes of searching I found a solution.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply