sql - Does select top 10 * from tablename give same result every time? -
i want know select top 10 * tablename give same result every time?
thanks in advance
no. result set unordered unless specify order by
clause. then, order by
needs stable, meaning keys have no ties (you accomplish putting primary key last keys ordering).
there several reason why results might differ. obviously, underlying data might change, guessing not gist of question.
the primary reason on multi-threaded machine, different threads reading data. thread returns data indeterminate, don't know first ten rows (without order by
).
sql not guarantee tables read in order processing queries. however, in practice, think sql server read pages in order.
Comments
Post a Comment