DELETE with LIMIT - workaround?

Поиск
Список
Период
Сортировка
Искать

DELETE with LIMIT - workaround?

От:
Chris Angelico <rosuav@gmail.com>
Дата:
I have something that I think is a fairly common code model, but with
an SQL query that feels like it's fighting the system.

The 'cron' table has a number of tasks (one row = one task), and the
primary loop of the program (massively simplified) fetches one row,
processes it, commits. One row/task is
performed in one transaction, atomically, including the removal of the
row (so if something crashes out, the row remains and will be
processed later). The top of the loop therefore
needs to fetch one row, and delete it. If I were deleting *all* the
appropriate rows, it would be:

DELETE FROM cron WHERE ts
FAQ