August 2, 2014 at 12:36 pm
Daniel Matthee (8/2/2014)
Can you please explain then when using an inner select statement (to minimize the sample )on huge table. (+- 20 columns, 400mil rows) the query runs WAY longer than actually putting the minimized sampel into and temp table and then reading from it.
No, because there's nowhere near enough information (and we're hijacking the thread). If you want to discuss that, start a new thread, and read through my 'how to post performance problems' first to see exactly what's needed.
That said, an 'inner select', more properly called a derived table, doesn't minimise the sample. Like a view, the derived table will be unrolled during parsing and exactly how the query is executed depends on the optimiser's choices.
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
Viewing post 16 (of 15 total)
You must be logged in to reply to this topic. Login to reply