Thursday 1 September 2022

READPAST SQL hint

 We had a batch process that retrieved 1,000s of rows from SQL Server, processed them and updated them.

Multiple readers were operating in parallel. We found that throughput hit some limitations because of the number of locked rows.


READPAST is a good SQL hint that will ignore locked rows when returning a resultset. If the rows are locked, they are excluded.

This allows a processor to read unlocked rows and process them. Once the locked rows are released they can be processed if applicable.

Using NOLOCK and READPAST table hints in SQL Server | TechRepublic

No comments:

Post a Comment