Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

FASTFIRSTROW Hint Expand / Collapse
Author
Message
Posted Thursday, January 10, 2013 2:57 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, July 18, 2014 9:09 AM
Points: 870, Visits: 2,385
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
Post #1405298
Posted Thursday, January 10, 2013 3:27 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 3:45 AM
Points: 1,231, Visits: 9,671
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.
Post #1405309
Posted Thursday, January 10, 2013 3:33 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, July 18, 2014 9:09 AM
Points: 870, Visits: 2,385
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
Post #1405313
Posted Thursday, January 10, 2013 3:44 AM


SSC-Forever

SSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-ForeverSSC-Forever

Group: General Forum Members
Last Login: Yesterday @ 12:11 PM
Points: 42,470, Visits: 35,541
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 2008, MVP
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

We walk in the dark places no others will enter
We stand on the bridge and no one may pass

Post #1405320
Posted Thursday, January 10, 2013 4:03 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Friday, July 18, 2014 9:09 AM
Points: 870, Visits: 2,385
Thanks Howard (sorry I forgot in my first reply) and Gail.



_________________________________________________________________________
SSC Guide to Posting and Best Practices
Post #1405328
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse