[18.0][IMP] queue_job: add index for efficient autovacuum#798
[18.0][IMP] queue_job: add index for efficient autovacuum#798OCA-git-bot merged 1 commit intoOCA:18.0from
Conversation
|
Hi @guewen, |
2fb2d80 to
7942020
Compare
|
Thanks @florentx! The index is scanned backwards because the query sorts by DESC and the index goes ASC. |
|
You're right @guewen . I've forced an # EXPLAIN ANALYZE
SELECT id FROM "queue_job"
WHERE (("date_done" <= '2025-07-01' OR "date_cancelled" <= '2025-07-01') AND "channel" = 'root.custom.purchase')
ORDER BY date_done, date_created LIMIT 1000;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Limit (cost=0.55..3756.69 rows=1000 width=20) (actual time=0.138..0.877 rows=1000 loops=1)
-> Index Scan using queue_job_channel_date_done_date_created_index on queue_job (cost=0.55..301651.84 rows=80309 width=20) (actual time=0.137..0.842 rows=1000 loops=1)
Index Cond: ((channel)::text = 'root.custom.purchase'::text)
Filter: ((date_done <= '2025-07-01 00:00:00'::timestamp without time zone) OR (date_cancelled <= '2025-07-01 00:00:00'::timestamp without time zone))
Planning Time: 0.200 ms
Execution Time: 0.918 ms
(6 rows) |
6b0e2ba to
a6375fb
Compare
|
/ocabot merge minor |
|
This PR looks fantastic, let's merge it! |
|
Congratulations, your PR was merged at 45dabc7. Thanks a lot for contributing to OCA. ❤️ |
This query was part of the slowest.
Before:
After: