Gunther writes:
> I have 250 rows to delete, but they are a target to a bunch of child
> tables with foreign key on delete cascade.
> EXPLAIN DELETE FROM Foo WHERE id = (SELECT fooId FROM Garbage);
> shows me that it uses the nested loop by Foo_pkey index to find the 250
> items from Garbage t
Hi,
I have 250 rows to delete, but they are a target to a bunch of child
tables with foreign key on delete cascade.
EXPLAIN DELETE FROM Foo WHERE id = (SELECT fooId FROM Garbage);
shows me that it uses the nested loop by Foo_pkey index to find the 250
items from Garbage to be deleted.
But
Thanks David Rowley and Andrew Gierth.
On 3/20/2019 23:46, Andrew Gierth wrote:
If you did WHERE mod(id,2) = mod(8934,2) AND id = 8934
then the index would likely be used - because the prover can then treat
mod(id,2) as an atom (call it X), constant-fold mod(8934,2) to 0 because
mod() is immut