This repository has been archived by the owner on Sep 12, 2018. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Notification: Make getting receivers faster
The field access produced a query as follows: select int_.notification_event_id c0, t0.id c1 from n4user t0 left outer join notification_event_n4user int_ on int_.n4user_id = t0.id where (int_.notification_event_id) in (?); and it is very slow because "where (int_.notification_event_id) in (?)" does not use an index. See the plan: PLAN SELECT INT_.NOTIFICATION_EVENT_ID AS C0, T0.ID AS C1 FROM PUBLIC.N4USER T0 /* PUBLIC.N4USER.tableScan */ LEFT OUTER JOIN PUBLIC.NOTIFICATION_EVENT_N4USER INT_ /* PUBLIC.FK_NOTIFICATION_EVENT_N4USER__02_INDEX_3: * N4USER_ID = T0.ID */ ON INT_.N4USER_ID = T0.ID WHERE INT_.NOTIFICATION_EVENT_ID = 249412 The new query is 150 times faster because it uses an index for every 'where' clause. See the plan for new query: PLAN SELECT N4USER.ID FROM PUBLIC.N4USER /* PUBLIC.FK_USER_ID_INDEX_6: ID IN(SELECT N4USER_ID FROM PUBLIC.NOTIFICATION_EVENT_N4USER /++ PUBLIC.PRIMARY_KEY_3: NOTIFICATION_EVENT_ID = 221467 ++/ WHERE NOTIFICATION_EVENT_ID = 221467) */ WHERE ID IN( SELECT N4USER_ID FROM PUBLIC.NOTIFICATION_EVENT_N4USER /* PUBLIC.PRIMARY_KEY_3: NOTIFICATION_EVENT_ID = 221467 */ WHERE NOTIFICATION_EVENT_ID = 221467)
- Loading branch information