|
Archives of the TeradataForumMessage Posted: Tue, 29 May 2012 @ 13:09:24 GMT
<-- Anonymously Posted: Tuesday, May 29, 2012 07:05 --> Hi, As you have mentioned, the difference comes into picture when you have an ORDER by clause. TOP 10 will give the top 10 rows after sorting the result set, whereas SAMPLE 10 will chose 10 rows randomly after sorting the result set. Please check the Explain for the below sqls to get an idea about it. Select Top 5 * from dbc.tables order by tablename; Select * sample 5 from dbc.tables order by tablename; Regarding the performance - From what I have seen, SAMPLE will perform better than TOP. HTH.
| ||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||
Copyright 2016 - All Rights Reserved | ||||||||||||||||||||||||||||||||||||||||||||||||
Last Modified: 15 Jun 2023 | ||||||||||||||||||||||||||||||||||||||||||||||||