views:

19

answers:

1

I have some ad-hoc reporting users hitting some SQL Server views. Occasionally the read locks taken by these users for particularly lengthy queries causes trouble elsewhere in the system.

I am considering adding some strategic with(nolock) hints to the views but wanted to know if there are any gotchas associated with hints in views.

Please ignore the obvious issues with letting users run queries this close to the SQL metal :).

Also, I know that nolock hints are an advanced feature not to be used lightly and I am well aware that they introduce fun things like dirty reads. Finally, if you're thinking that read_committed_snapshot makes sense here, I must sadly say that it's not available for 2000.

+1  A: 

There is a potential for the report to show an inconsistent view of data. That kind of thing is rare, though.

Still, a better strategy is to use replication to create a completely separate reports database.

Joel Coehoorn
@Joel, thanks for the input and confirming what I recommended to my customer (transactional replication or something similar)! I'm looking at this to use in the mean time. Dirty reads are acceptable. +1, thanks!
Michael Haren

related questions