Monday, 14 October 2013
Teradata DISTINCT VS GROUP BY
Which is better DISTINCT or GROUP BY in Teradata?
Till Teradata 12,
we all knew that DISTINCT uses more spool since it picks the each row from ever
amp and redistributes them to appropriate AMP then SORT the data to find the
duplicates.(So the output has sorted output)
Whereas GROUP BY uses
"Aggregate" concept (AMP local grouping) to remove duplicates so
consumes less spool(Output won’t be sorted, you need to add ORDER BY incase of
sorted output)
From Teradata 13/14, All
DISTINCT will automatically rewritten to GROUP BY and apply some new algorithms
developed by Teradata to get faster response…
Monday, 14 October 2013
Teradata DISTINCT VS GROUP BY
Which is better DISTINCT or GROUP BY in Teradata?
Till Teradata 12,
we all knew that DISTINCT uses more spool since it picks the each row from ever
amp and redistributes them to appropriate AMP then SORT the data to find the
duplicates.(So the output has sorted output)
Whereas GROUP BY uses
"Aggregate" concept (AMP local grouping) to remove duplicates so
consumes less spool(Output won’t be sorted, you need to add ORDER BY incase of
sorted output)
From Teradata 13/14, All
DISTINCT will automatically rewritten to GROUP BY and apply some new algorithms
developed by Teradata to get faster response…
You can run a simple query for
distinct and group by. You can observe they have same explain plan from TD 13
Explain SEL Distinct COL1 FROM DB.TABLE1; -- No Sorted output now
Explain SEL COL1 FROM DB.TABLE1 GROUP BY 1; -- Same explain as above
So use DISTINCT and GROUP BY for its created purpose, i.e. Distinct to find unique records and group by for analytic functions to give an aggregate result. don’t worry about performance or spool space issues any more.
9 comments:
Thanks for Information Teradata is a Relational Database Management System (RDBMS) for the world’s largest commercial databases. Teradata can store data upto Teradata bytes in size. This makes the Teradata as a market leader in data warehousing applications. Teradata Online Training
ReplyDeleteRepliesWhich is better DISTINCT or GROUP BY in Teradata?
Delete
Till Teradata 12, we all knew that DISTINCT uses more spool since it picks the each row from ever amp and redistributes them to appropriate AMP then SORT the data to find the duplicates.(So the output has sorted output)
Whereas GROUP BY uses "Aggregate" concept (AMP local grouping) to remove duplicates so consumes less spool(Output won’t be sorted, you need to add ORDER BY incase of sorted output)
From Teradata 13/14, All DISTINCT will automatically rewritten to GROUP BY and apply some new algorithms developed by Teradata to get faster response…
You can run a simple query for distinct and group by. You can observe they have same explain plan from TD 13
Cloud Computing Final Year Projects
Big Data Projects For Final Year Students
python projects for final year students
Thank you for sharing nice information.
ReplyDelete
It is very useful to me and who are searching for Teradata online trainingnice article thanks for sharing the post..!
ReplyDelete
http://www.kitsonlinetrainings.com/scom-2012-online-training.html
http://www.kitsonlinetrainings.com/spark-online-training.html
http://www.kitsonlinetrainings.com/teradata-online-training.html
http://www.kitsonlinetrainings.com/testing-tools-online-training.htmlnice article thanks for sharing the post..!
ReplyDelete
http://www.kitsonlinetrainings.com/microsoft-azure-online-training.html
http://www.kitsonlinetrainings.com/oracle-dba-online-training.html
http://www.kitsonlinetrainings.com/oracle-soa-online-training.html
http://www.kitsonlinetrainings.com/r-programming-online-course.htmlnice article thanks for sharing the post..!
ReplyDelete
IELTS Coaching in chennai
German Classes in Chennai
GRE Coaching Classes in Chennai
TOEFL Coaching in Chennai
spoken english classes in chennai | Communication training
Thanks for Information Teradata is a Relational Database Management System (RDBMS) for the world’s largest commercial databases. Teradata can store data upto Teradata bytes in size. This makes the Teradata as a market leader in data warehousing applications. Teradata Online Training
ReplyDeleteWhich is better DISTINCT or GROUP BY in Teradata?
DeleteTill Teradata 12, we all knew that DISTINCT uses more spool since it picks the each row from ever amp and redistributes them to appropriate AMP then SORT the data to find the duplicates.(So the output has sorted output)
Whereas GROUP BY uses "Aggregate" concept (AMP local grouping) to remove duplicates so consumes less spool(Output won’t be sorted, you need to add ORDER BY incase of sorted output)
From Teradata 13/14, All DISTINCT will automatically rewritten to GROUP BY and apply some new algorithms developed by Teradata to get faster response…
You can run a simple query for distinct and group by. You can observe they have same explain plan from TD 13
Cloud Computing Final Year Projects
Big Data Projects For Final Year Students
python projects for final year students
Thanks for sharing the very informative content on Teradata
ReplyDeleteThank you for sharing nice information.
ReplyDeleteIt is very useful to me and who are searching for Teradata online training
Nice Information Big Data Hadoop Online Training
ReplyDeletenice article thanks for sharing the post..!
ReplyDeletehttp://www.kitsonlinetrainings.com/vmware-online-training.html
http://www.kitsonlinetrainings.com/azure-training.html
http://www.kitsonlinetrainings.com/scom-training.html
nice article thanks for sharing the post..!
ReplyDeletehttp://www.kitsonlinetrainings.com/scom-2012-online-training.html
http://www.kitsonlinetrainings.com/spark-online-training.html
http://www.kitsonlinetrainings.com/teradata-online-training.html
http://www.kitsonlinetrainings.com/testing-tools-online-training.html
nice article thanks for sharing the post..!
ReplyDeletehttp://www.kitsonlinetrainings.com/microsoft-azure-online-training.html
http://www.kitsonlinetrainings.com/oracle-dba-online-training.html
http://www.kitsonlinetrainings.com/oracle-soa-online-training.html
http://www.kitsonlinetrainings.com/r-programming-online-course.html
nice article thanks for sharing the post..!
ReplyDeleteIELTS Coaching in chennai
German Classes in Chennai
GRE Coaching Classes in Chennai
TOEFL Coaching in Chennai
spoken english classes in chennai | Communication training