This note explains why deleting from account_move_line spikes CPU and provides step-by-step instructions to fix it natively in PostgreSQL.
When executing DELETE FROM account_move_line WHERE id IN ( ? ), PostgreSQL triggers internal system checks (RI_FKey_check_relation) for every table referencing account_move_line. If those referencing columns are not indexed, PostgreSQL performs a Sequential Full Table Scan across dozens of tables for every single ID deleted, melting your CPU.