Tom Allison <tom(at)tacocat(dot)net> writes:
> I have ~250K rows in this table.
> the token_idx is referenced in two other tables, both of whom have a
> foreign key constraint to ON DELETE CASCADE.
> Of the other two tables, one has ~1M rows and the other ~350K rows.
> Problem:
> Deleting one row can take 2 seconds.
> Is there something I can do to improve the speed.
Put indexes on the referencing columns. Without that, a seqscan is
required to look for referencing rows.
regards, tom lane