16.20 - Syntax - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ Time Series Tables and Operations

Teradata Database
Teradata Vantage NewSQL Engine
Release Number
March 2019
English (United States)
Last Update

Syntax Elements

PTI tables can be defined as SET or MULTISET tables. By default they are permanent tables, but optionally can be defined as GLOBAL TEMPORARY or VOLATILE tables.
The name of the table, optionally prefaced by a database or user name.
All standard CREATE TABLE options for non-PTI tables apply to PTI tables. Syntax for these options is described in Teradata Vantage™ SQL Data Definition Language Syntax and Examples, B035-1144.
These columns are generated and maintained automatically by Teradata Database. They are described in Automatically Generated Columns in PTI Tables.
Standard column definitions for the time series data that will be stored in the PTI table. For more information about standard column definitions in CREATE TABLE statements, see Teradata Vantage™ SQL Data Definition Language Syntax and Examples, B035-1144.
The Time Series system automatically generates the first usable column of the table to accommodate the timestamp portion of the time series data. You do not need to explicitly create a column for the timestamp.
An optional name for the PTI. For information about naming database objects, see Teradata Vantage™ SQL Fundamentals, B035-1141.
The timecode_data_type should reflect the form of the timestamp data in the time series. It can be one of the following data types:
  • TIMESTAMP(n), where n is the decimal precision of the fractional seconds in the timestamp.
  • DATE
For more information on these data types, see Teradata Vantage™ Data Types and Literals, B035-1143.
A date that precedes the earliest date in the time series data.
timezero_date specifies the earliest time series data that the PTI table will accept. Teradata Database generates an error if inserted data has a timestamp earlier than timezero_date.
timezero_date must be of the format: DATE 'YYYY-MM-DD'.
The default value is DATE '1970-01-01'.
Although this parameter is optional, best practice is to specify a date near to the earliest timestamp in the time series data.
A duration that serves to break up the time continuum in the time series data into discrete groups or buckets. The time bucket value for each row is used, together with the timezero date, to help determine the data distribution among the AMPs.
timebucket_duration can be specified using the formal form time_unit(n), where n is a positive integer, and time_unit can be any of the following: CAL_YEARS, CAL_MONTHS, CAL_DAYS, WEEKS, DAYS, HOURS, MINUTES, SECONDS, MILLISECONDS, or MICROSECONDS.
For example, HOURS(2).
You can also use a shorthand form to represent the timebucket_duration, as described in Shorthand Equivalents for Time Unit Representation.
The optimal size of timebucket_duration depends on the analysis needs and application. Use a duration that matches the periods to be analyzed. For example, if your application analyzes data from two hour periods, you might specify a timebucket_duration as HOURS(2).
A list of one or more PTI table columns, separated by commas. These columns are used, together with the PTI, to determine how rows are distributed among the AMPs.
Specifies whether the time series data readings are unique in time. Depending on the granularity of timecode_data_type and the frequency of sensor data collection, there could be multiple readings from a sensor that share the same timestamp.
  • NONSEQUENCED assumes that there is only one sensor reading per timestamp. This is the default.

    Teradata Database orders the rows in a nonsequenced PTI table based on the timestamp.

  • SEQUENCED means more than one reading from the same sensor may have the same timestamp.

    Teradata Database automatically inserts an extra column named TD_SEQNO in the PTI table to hold a unique sequential number to differentiate readings that have the same timestamp. It is the responsibility of the application collecting and sending the data to Teradata Database to populate the TD_SEQNO column with sequence numbers.

    Teradata Database orders the rows in a sequenced table based on the timestamp, and within a single timestamp value, orders the rows according to the sequence number.
A positive integer from 1 through 2147483647 that represents the maximum TD_SEQNO value. This specifies the maximum number of sensor data rows that can have the same timestamp. The default is 20000. If the value of the TD_SEQNO field exceeds seq_max, Teradata Database generates an error.
PTI tables can have USIs and NUSIs. Syntax for defining these indexes is described in Teradata Vantage™ SQL Data Definition Language Syntax and Examples, B035-1144.
Determine whether to delete or preserve the rows of global temporary or volatile tables when a transaction completes. For more information on these commit_options, see Teradata Vantage™ SQL Data Definition Language Syntax and Examples, B035-1144.