Issue Task Under Review Stale

#110519Improve Symfony Messenger queue lookup performance

Wouter Wolters 08/21/26, 21:20 updated 08/21/26, 21:21

Description

The sys_messenger_messages table currently has separate indexes for queue_name, available_at, and delivered_at. Symfony Messenger’s dequeue query filters and orders using these
columns together with id, so the individual indexes cannot efficiently cover the complete query.

Replace the three indexes with a composite index on:

(queue_name, available_at, delivered_at, id)

Benefits:

- Matches Symfony Doctrine Transport’s queue lookup pattern
- Avoids unnecessary row scans and temporary sorting
- Reduces index storage and write maintenance from three indexes to one
- Improves a synthetic 100,000-row query from approximately 1.479 ms to 0.004 ms (~369× faster)

Reviews 1

History 01