16.20 - Event Processing Using Queue Tables - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Fundamentals

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-02
dita:mapPath
zce1519094756513.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval

Teradata Database provides queue tables that you can use for event processing. Queue tables are base tables with first-in-first-out (FIFO) queue properties.

When you create a queue table, you define a timestamp column. You can query the queue table to retrieve data from the row with the oldest timestamp.

Usage

An application can perform peek, FIFO push, and FIFO pop operations on queue tables.

To perform a … Use the …
FIFO push INSERT statement.
FIFO pop SELECT AND CONSUME statement.
peek SELECT statement.
Here is an example of how an application can process events using queue tables:
  • Define a trigger on a base table to insert a row into the queue table when the trigger fires.
  • From the application, submit a SELECT AND CONSUME statement that waits for data in the queue table.
  • When data arrives in the queue table, the waiting SELECT AND CONSUME statement returns a result to the application, which processes the event. Additionally, the row is deleted from the queue table.

Related Topics

For more information about:
  • Creating queue tables, see the CREATE/REPLACE TABLE statement in Teradata Vantage™ SQL Data Definition Language Syntax and Examples, B035-1144.
  • SELECT AND CONSUME, see Teradata Vantage™ SQL Data Manipulation Language , B035-1146 .