The scenario is a STABLE function that calls out to an AWS service that charges micro pennies per row, so periodically inserting CHECK_FOR_INTERRUPTS() should be able to prevent charges from accumulating for a statement that has already failed in another parallel worker. I think it's safe to declare such functions as PARALLEL SAFE. Thank you! ----- Jim Finnerty, AWS, Amazon Aurora PostgreSQL -- Sent from: https://www.postgresql-archive.org/PostgreSQL-general-f1843780.html