MySQL table as a FIFO/Queue
fifo, mysql, queue, stack
Solution
Past Mysql 5 you could use a trigger to achieve this.
http://dev.mysql.com/doc/refman/5.0/en/create-trigger.html
then your triggered sql would be along the lines off:
DELETE FROM foo WHERE id NOT IN (SELECT id FROM foo ORDER BY id DESC LIMIT 10)
Problem
How can we treat a Mysql table as a limited FIFO buffer (Queue). Objectives are : - The table at a time can have only N number of rows. - When a row is inserted, the oldest row shpuld be deleted to maintain the row count as N. Pls suggest approaches. UPDATE: Sorry guys, as many pointed I changed my question from STACK to FIFO queue