DELETE con LIMIT en Postgres

Sucio y desprolijo:

WITH cte AS (

SELECT my_rowid /* your PK */
FROM batch
WHERE bat_close_time_stamp <= 1507381943.93144 /* your condition */
/* ORDER BY ??? */ /* optional */
LIMIT 500
FOR UPDATE /* SKIP LOCKED */

)
DELETE FROM batch tbl
USING cte
WHERE tbl.my_rowid = cte.my_rowid;

Fuente: stackoverflow.com/questions/52950430/batch-delete-in-postgres-using-a-cursor


Posted

in

by

Tags: