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

Teradata Vantage™ - SQL Fundamentals

Advanced SQL Engine
Teradata Database
Release Number
Release Date
July 2021
Content Type
Programming Reference
Publication ID
English (United States)

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.


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

To perform a … Use the …
FIFO push INSERT 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.