require-fk-index
Cascading or set-value FOREIGN KEY action lacks a child-table index.
Why
PostgreSQL does not automatically index referencing columns, so cascading deletes/updates and SET NULL/DEFAULT actions may scan and lock the child table.
Fix
Create an index whose leading columns cover the foreign-key columns on the child table.
Examples
CREATE TABLE orders ( customer_id BIGINT REFERENCES customer (id) ON DELETE CASCADE);CREATE TABLE orders ( customer_id BIGINT REFERENCES customer (id) ON DELETE CASCADE);
CREATE INDEX orders_customer_id_idx ON orders (customer_id);