sql - Save row in %ROWTYPE and delete it efficiently afterwards? -
this how currently:
declare tmp message%rowtype; begin; select * tmp [...] delete message m m.id = tmp.id; end;
i'm afraid db 2 queries here: 1 doing select
, 1 delete
. in case true - can create more efficient somehow? after row should deleted found in select
query.
n.b. i'm storing select
query , homecoming function. above simplified.
delete message m using ( select * ... ) s m.id = s.id returning s.*
sql postgresql plpgsql
No comments:
Post a Comment