I have two SQL operations:
delete from names where bucket=%(bucket)s and id=%(name)s returning store, hash, oid;
and using the output of this:
delete from objects where store=%(store)s and hash=%(hash)s and id=%(oid)s and not exists (select 1 from names where store=%(store)s and hash=%(hash)s and oid=%(oid)s)
Is it possible (I guess maybe with CTE) to issue these as a single query, so I can spare network round trip time and additional costs?