Queue Table was introduced from TD V2R6 onwards. It helps in job-control by using the FIFO algorithm. A Job that has waited the longest moves up, and will be executed first. Since Queue tables are implemented in Teradata using CREATE TABLE SQL, all A-C-I-D rules of RDBMS apply.Hence, if the job is aborted, the transaction is rolled-back.
The first column in a QITS or Queue table is always the QITS column ( Query Insertion Time Stamp).
Below is a sample implementation of Queue Tables:
CREATE TABLE DB_LOAD_TBLS.LAYWY_CONFIG
QITS_JOB_START TIMESTAMP(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6)
INSERT INTO DB_LOAD_TBLS.LAYWY_CONFIG
SELECT * FROM LCI_LOAD_TBLS.LAYWY_CONFIG;
SELECT AND CONSUME TOP 1 * FROM LCI_LOAD_TBLS.LAYWY_CONFIG;
The SELECT AND CONSUME statement helps you to simulate the FIFO Pop function.
So, the moment the job is executed successfully, the entry will be deleted. Thus, this also helps in removing re-runs.