January 10, 2013 at 2:57 am
I've been doing a review of a DW project and noticed that several of the views use a WITH (FASTFIRSTROW)
I need to start putting together a list of issues, but I'm unsure how to put this down as a possible issue, the first issue is a future compatibilty as I'm aware that the FASTFIRSTROW hint is being deprecated and replaced with OPTION(FAST n).
It is also my understanding that while you can get data being returned faster from the initial execute you can also end up with a sub optimal plan being used, is this correct?
Are there any other issues that anyone can point out.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
January 10, 2013 at 3:27 am
The views are used to populate the DW, rather than for end user queries?
Yes, they can definitely produce sub-optimal plans as by definition, they sacrifice overall execution time in order to get the first rows out quicker. So generally, unless statistics are incorrect or there's another reason that it's "tricking" the optimiser into picking a better plan, there's nothing to gain and much to lose from the hint.
The hint is generally only used for queries that an end-user is receiving the results for and implements client-side paging, to give the appearance of a more responsive system.
January 10, 2013 at 3:33 am
These are 'end user' views, and used to feed SSAS and reports, the tables are pretty small with around 100-150 million rows in, although it seems some of the developers have heard the 'good news' about this and it seems to be creeping into other areas as well.
I've done some 'prelim' testing using the views with and with out the hint and the results are interesting, in that data is returning around 4 times fast without the hint.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
January 10, 2013 at 3:44 am
Jason-299789 (1/10/2013)
It is also my understanding that while you can get data being returned faster from the initial execute you can also end up with a sub optimal plan being used, is this correct?
Correct. The point of the hint is that you want to ensure that the first few rows arrive fast and you don't mind if then entire resultset takes longer than it would otherwise. The optimiser avoids blocking operations (like sorts or hashes) as far as possible, even if they may be the lowest cost option.
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
January 10, 2013 at 4:03 am
Thanks Howard (sorry I forgot in my first reply) and Gail.
_________________________________________________________________________
SSC Guide to Posting and Best Practices
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply