HASH BY Clause - Teradata Database

SQL Data Manipulation Language

Product
Teradata Database
Release Number
15.10
Language
English (United States)
Last Update
2018-10-06
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata® Database

HASH BY Clause

 

Syntax Element …

Specifies …

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” on page 80.

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.