HASH BY Clause - Teradata Database - Teradata Vantage NewSQL Engine

SQL Data Manipulation Language

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-03
dita:mapPath
fbo1512081269404.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata Vantage™
HASH BY column_name
Hashes rows across the AMPs in preparation to be input to a table function.
HASH BY is a Teradata extension to the ANSI SQL:2011 standard.
You can only specify a HASH BY clause for a statement whose result is to be input to a table function.
HASH BY must be specified as part of a FROM clause. See FROM Clause.
The scope of input to the HASH BY clause is limited to:
  • Derived tables
  • Views
  • WITH clause objects
You cannot specify a HASH BY clause with a derived table, view, or WITH clause object that specifies set operations.
You cannot specify more than one HASH BY clause per statement.
You can specify a HASH BY clause by itself or with a LOCAL ORDER BY clause. If you specify both, the HASH BY clause must precede the LOCAL ORDER BY clause.
When you use a multiple input table operator that has multiple hash by clauses, the following restrictions apply:
  • All columns must have the same number of partitioning attributes.
  • The corresponding attributes must be the same type or must be types that are compatible so that they can be implicitly cast.
If you specify a LOCAL ORDER BY clause with HASH BY input, the following is required:
  • All of the ON clauses must have the same number of LOCAL ORDER BY columns.
  • The data types of the columns must be the same or matched using an implicit cast.