KamoCRM

Fix N+1 query and add composite index for chat message loading

Performancekamo-shared-library
Shipped
12 மார்ச், 2026 அன்று 2:19 AM UTC
Author
Kamo
Commit
1a59c06

- Add LEFT JOIN FETCH m.msg to both repository queries to eagerly load MediaObjMsg in the same query, eliminating up to 100 extra SQL queries per chat window open - Add composite index (SESSION_ID, IS_REMOVED, DATE_CREATED) to cover the message fetch query pattern in a single efficient index scan

All changes

Like what you see shipping?

All of it arrives in your workspace on its own. Start on the free plan and read this page again in a month.

Start Free ForeverView Pricing