action.purge_circulation can be extremely slow
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Evergreen |
New
|
Undecided
|
Unassigned |
Bug Description
I have noticed that the action.
"UPDATE ONLY "action"
In the context of: "DELETE FROM action.circulation WHERE id = circ_chain_tail.id"
Explain analyze does its thing:
Update on usr_circ_history (cost=0.
-> Seq Scan on usr_circ_history (cost=0.
Filter: (source_circ = 1)
Rows Removed by Filter: 1006736
Planning time: 0.309 ms
Execution time: 304.521 ms
Sequential scan of every single circ history entry for every circ aged out.
A simple index on source_circ gives us a new plan:
Update on usr_circ_history (cost=0.42..8.44 rows=1 width=50) (actual time=0.060..0.060 rows=0 loops=1)
-> Index Scan using usr_circ_
Index Cond: (source_circ = 1)
Planning time: 0.326 ms
Execution time: 0.114 ms
That's more like it. Branch on its way.