You can benchmark your scenario with and without constraint using a tool
like nancy:
https://gitlab.com/postgres-ai/nancy
it lets you A/B test different configurations with your own scenarios or
using pgbench synthetic workloads.
-Michel
On Wed, Jul 22, 2020 at 9:27 AM Samuel Nelson
wrote:
>
On Wed, Jul 22, 2020 at 9:03 AM Samuel Nelson
wrote:
> seems to fix it to work as we were expecting. Is that particularly
> costly? Should I only set the constraint to be deferred when we really
> need it? Would it be more efficient to perform the deletes explicitly
> within a transaction rath
I checked, and changing the `bazinga_foo_bar` constraint to:
alter table bazinga add constraint bazinga_foo_bar foreign key (foo_id,
bar_id) references foo_bar (foo_id, bar_id) deferrable initially deferred;
seems to fix it to work as we were expecting. Is that particularly
costly? Should I onl
On Wed, Jul 22, 2020 at 8:24 AM Samuel Nelson
wrote:
> Is there a way to force the delete to cascade to tables in a specific
> order?
>
No really, but you can defer constraint checking.
https://www.postgresql.org/docs/12/sql-set-constraints.html
David J.
Hi all,
We've got an interesting case where we want deletes to cascade if one table
was hit directly, but not another. We can show that the delete _would_
cascade from one foreign key relationship, but the delete is actually
blocked by the foreign key constraint from the other relationship.
A so