how does SELECT TOP works when no order by is specified?

how does SELECT TOP works when no order by is specified?

There is no guarantee which two rows you get. It will just be the first two retrieved from the table scan.post

The TOP iterator in the execution plan will stop requesting rows once two have been returned.this

Likely for a scan of a heap this will be the first two rows in allocation order but this is not guaranteed. For example SQL Server might use the advanced scanning feature which means that your scan will read pages recently read from another concurrent scan.code

相關文章
相關標籤/搜索