|
|
Archives of the TeradataForum
Message Posted: Fri, 20 Jul 2012 @ 09:49:45 GMT
Subj: | | Re: What is difference between Sample 10 and Top 10? |
|
From: | | Lenka, Dipti Prakash |
Anomy.Anom wrote:
| 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. | |
If I look at the explain plan for : Select Top 5 * from cedw.mr_report_selected order by column_name; then it says
3) We do an all-AMPs STAT FUNCTION step from cedw.mr_report_selected
by way of an all-rows scan with no residual conditions into Spool
5 (Last Use), which is redistributed by hash code to all AMPs.
The result rows are put into Spool 1 (all_amps), which is built
locally on the AMPs. This step is used to retrieve the TOP 5 rows.
The size is estimated with low confidence to be 5 rows (755 bytes).
What does it mean by all-AMPs STAT FUNCTION ?? Can anyone help me in understanding the whole explain plan here.
Thanks,
Dipti
| |