Event Processing Using Queue Tables | SQL Fundamentals | Teradata Vantage - Event Processing Using Queue Tables - Advanced SQL Engine - Teradata Database

SQL Fundamentals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-28
dita:mapPath
uhe1592872955107.ditamap
dita:ditavalPath
uhe1592872955107.ditaval
dita:id
B035-1141
lifecycle
previous
Product Category
Teradata Vantage™

Vantage 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 Information

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.