16.20 - Hash Index - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Data Definition Language Syntax and Examples

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-24
dita:mapPath
wkf1512081455740.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval
hash_index_name
The name of the hash index whose most recent SQL create text is to be reported.

Example: SHOW HASH INDEX

This example uses the following CREATE HASH INDEX statement to create ord_cust_hidx:

     CREATE HASH INDEX ord_cust_hidx
     (o_date) ON orders
     BY (o_date)
     
     ORDER BY VALUES;
The SHOW HASH INDEX report differs from the text of the CREATE HASH INDEX DDL as follows:
  • All names are qualified
  • Fallback protection and checksum options display
  • Map assignment

When you do not specify a BY or ORDER clause in the CREATE HASH INDEX DDL, the default values for those clauses are not reported.

SHOW HASH INDEX ord_cust_hidx;
 *** Text of DDL statement returned. 
 *** Total elapsed time was 1 second.
     ------------------------------------------------------------
CREATE HASH INDEX YourDB.ord_cust_hidx ,NO FALLBACK ,CHECKSUM = DEFAULT, 
MAP = TD_MAP1
(o_date )
 ON YourDB.orders 
 BY (o_date )
 ORDER BY VALUES
;

Example: SHOW HASH INDEX in XML Format

Assume you alter the hash index to use a sparse map:

     ALTER HASH INDEX ord_cust_hidx, MAP=SmallTableMap;

This example returns the create text for hash index ord_cust_hidx in XML format:

     SHOW IN XML HASH INDEX ord_cust_hidx;

The XML document generated reports all of the information required to recreate the hash index:

     <?xml version="1.0" encoding="UTF-8" standalone="no" ?><TeradataDBObjectSet version="1.0" xmlns="http://schemas.teradata.com/dbobject" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://schemas.teradata.com/dbobject http://schemas.teradata.com/dbobject/DBObject.xsd">
<HashIndex baseDBName="YourDB" baseTableName="orders" checkSumLevel="Default" colocateName="YourDB_ord_cust_hidx" dbName="YourDB" fallback="false" map="SmallTableMap" map_kind="sparse" name="ord_cust_hidx" objId="0:3655" objVer="2"><IndexColumnList><Column name="o_date" order="1"/></IndexColumnList><DistributeColumnList><Column name="o_date" order="1"/></DistributeColumnList><OrderBy mode="Value"/>
<SQLText><![CDATA[CREATE HASH INDEX YourDB.ord_cust_hidx ,NO FALLBACK 
,CHECKSUM = DEFAULT, 
MAP = SmallTableMap COLOCATE USING YourDB_ord_cust_hidx
(o_date )
 ON YourDB.orders 
 BY (o_date )
 ORDER BY VALUES
;]]></SQLText></HashIndex><Environment><Server dbRelease="16.10" dbVersion="16.10" hostName="localhost"/><User userId="00000704" userName="User"/><Session charset="UTF8" dateTime="2017-03-24T17:22:48"/></Environment></TeradataDBObjectSet>