Migrate mention for MergeRequest notes
explain select * from notes, merge_requests where merge_requests.id = notes.noteable_id AND noteable_type = 'MergeRequest' and note like '%\@%'
Merge Join (cost=34.51..48430159.16 rows=9663665 width=3168)
Merge Cond: (notes.noteable_id = merge_requests.id)
-> Index Scan using index_notes_on_noteable_id_and_noteable_type on notes (cost=0.57..42041324.54 rows=10084526 width=2455)
Index Cond: ((noteable_type)::text = 'MergeRequest'::text)
Filter: (note ~~ '%\@%'::text)
explain select * from notes, merge_requests where merge_requests.id = notes.noteable_id AND state_id =1 AND noteable_type = 'MergeRequest' and note like '%\@%'
Nested Loop (cost=1.00..30561364.85 rows=474550 width=3168)
-> Index Scan using idx_merge_requests_on_target_project_id_and_iid_opened on merge_requests (cost=0.43..1916559.80 rows=1658485 width=713)
-> Index Scan using index_notes_on_noteable_id_and_noteable_type on notes (cost=0.57..17.25 rows=2 width=2455)
Index Cond: ((noteable_id = merge_requests.id) AND ...