Archives of the TeradataForum
Message Posted: Fri, 20 Dec 2013 @ 13:54:16 GMT
I use a queue table for stats collection, see developer.teradata.com/...
Usually SELECT AND CONSUME is called in WHILE or REPEAT loop. But when the queue is empty this loop will wait forever, you can do a SELECT COUNT before to determine the current number of rows to avoid peeking at each row before you consume it.
I couldn't do this as I use multiple SPs to process a single queue, so I insert a special row ('9999-12-31') to stop the queue when all rows are processed.
Whe the SP is called I decide to stop after all rows are processed (insert the special row when SP starts) or to run forever (there's a EXEC StopQueue macro which insert this special row).
Optionally I define a maximum timestamp when the queue should stop even if there are rows left in the queue.
|Copyright 2016 - All Rights Reserved|
|Last Modified: 24 Jul 2020|