#3164 closed Enhancement (fixed)
Denormalize the query that checks for unread messages
| Reported by: | brettp | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | Elgg 1.7.8 |
| Component: | Messages | Version: | 1.7 |
| Severity: | minor | Keywords: | |
| Cc: | brett@… | Difficulty: | easy |
Description
Because it looks like this and makes servers (and sysadmins) weep:
SELECT DISTINCT e.*
FROM elggentities e
JOIN elggmetadata n_table ON e.guid = n_table.entity_guid
JOIN elggmetadata n_table1 ON e.guid = n_table1.entity_guid
JOIN elggmetastrings msn1 ON n_table1.name_id = msn1.id
JOIN elggmetastrings msv1 ON n_table1.value_id = msv1.id
JOIN elggmetadata n_table2 ON e.guid = n_table2.entity_guid
JOIN elggmetastrings msn2 ON n_table2.name_id = msn2.id
JOIN elggmetastrings msv2 ON n_table2.value_id = msv2.id
JOIN elggmetadata n_table3 ON e.guid = n_table3.entity_guid
JOIN elggmetastrings msn3 ON n_table3.name_id = msn3.id
JOIN elggmetastrings msv3 ON n_table3.value_id = msv3.id
WHERE (((msn1.string = 'toId'
AND BINARY msv1.string = 11814
AND ((1 = 1)
AND n_table1.enabled='yes'))
AND (msn2.string = 'readYet'
AND BINARY msv2.string = 0
AND ((1 = 1)
AND n_table2.enabled='yes'))
AND (msn3.string = 'msg'
AND BINARY msv3.string = 1
AND ((1 = 1)
AND n_table3.enabled='yes'))))
AND (e.owner_guid IN (11814))
AND (e.site_guid IN (1))
AND ((1 = 1)
AND e.enabled='yes')
ORDER BY e.time_created DESC LIMIT 0,
10
Merge up to trunk.
Change History (4)
comment:1 Changed 2 years ago by brettp
- Component changed from Core to Messages
comment:2 Changed 2 years ago by brettp
- Resolution set to fixed
- Status changed from new to closed
comment:3 Changed 2 years ago by brettp
(In [svn:8764]) Refs #3164. Merged messages denormalization to 1.7 branch.
comment:4 Changed 2 years ago by cash
- Milestone changed from Elgg 1.7.9 to Elgg 1.7.8
Note: See
TracTickets for help on using
tickets.

(In [svn:8763]) Fixes #3164. Denormalized unread message counting query because it was making things so slow I couldn't test.