SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


FASTFIRSTROW Hint


FASTFIRSTROW Hint

Author
Message
Jason-299789
Jason-299789
SSCarpal Tunnel
SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)

Group: General Forum Members
Points: 4671 Visits: 3232
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
HowardW
HowardW
SSCertifiable
SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)SSCertifiable (5.9K reputation)

Group: General Forum Members
Points: 5875 Visits: 9892
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.
Jason-299789
Jason-299789
SSCarpal Tunnel
SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)

Group: General Forum Members
Points: 4671 Visits: 3232
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
GilaMonster
GilaMonster
SSC Guru
SSC Guru (211K reputation)SSC Guru (211K reputation)SSC Guru (211K reputation)SSC Guru (211K reputation)SSC Guru (211K reputation)SSC Guru (211K reputation)SSC Guru (211K reputation)SSC Guru (211K reputation)

Group: General Forum Members
Points: 211519 Visits: 46257
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

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


Jason-299789
Jason-299789
SSCarpal Tunnel
SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)SSCarpal Tunnel (4.7K reputation)

Group: General Forum Members
Points: 4671 Visits: 3232
Thanks Howard (sorry I forgot in my first reply) and Gail.

_________________________________________________________________________
SSC Guide to Posting and Best Practices
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search