iachat/enterprise/app/models/enterprise
Pranav 16b98b6017
fix: Add account_id to the query to force using a better index (#12420)
I've added the account_id filter to the
`get_agent_ids_over_assignment_limit` method. This optimization will
help the query leverage the existing composite index
`conv_acid_inbid_stat_asgnid_idx (account_id, inbox_id, status,
assignee_id)` for better performance.

**Before:**
```sql
HashAggregate (cost=224238.12..224256.27 rows=484 width=4)
Group Key: assignee_id
Filter: (count(*) >= 10)
-> Index Scan using index_conversations_on_inbox_id on conversations (cost=0.44..223963.67 rows=54891 width=4)
Index Cond: (inbox_id = ???)
Filter: (status = 0)
```

**After:**
```sql
GroupAggregate (cost=0.44..5688.30 rows=476 width=4)
Group Key: assignee_id
Filter: (count(*) >= 10)
-> Index Only Scan using conv_acid_inbid_stat_asgnid_idx on conversations (cost=0.44..5640.81 rows=5928 width=4)
Index Cond: ((account_id = ??) AND (inbox_id = ??) AND (status = 0))
```
2025-09-11 22:27:38 -07:00
..
account feat: Ability to delete account for administrators (#1874) 2025-04-03 10:41:39 +05:30
audit feat: Add conversation delete feature (#11677) 2025-06-05 15:53:17 -05:00
concerns feat: add saml model & controller [CW-2958] (#12289) 2025-09-03 13:30:42 -07:00
account_user.rb feat: Add APIs to manage custom roles in Chatwoot (#9995) 2024-08-23 17:18:28 +05:30
account.rb feat: add saml model & controller [CW-2958] (#12289) 2025-09-03 13:30:42 -07:00
activity_message_handler.rb feat: Improve Captain interactions, activity messages (#11493) 2025-05-16 19:27:57 -07:00
application_record.rb feat: Add push/email notification support for SLA (#9140) 2024-03-29 20:27:21 +11:00
audit_log.rb chore: Refactor Response Bot Data Schema (#8011) 2023-10-01 19:31:38 -07:00
automation_rule.rb feat: sla-2 add automation backend support for SLA (#8775) 2024-02-01 15:42:12 +05:30
channelable.rb fix: skip auditlogs for whatsapp template sync (#8579) 2024-01-09 21:51:48 -08:00
conversation.rb feat(voice): Incoming voice calls [EE] (#12361) 2025-09-08 22:35:23 +05:30
inbox.rb fix: Add account_id to the query to force using a better index (#12420) 2025-09-11 22:27:38 -07:00