Migrate mentions in Issues

Number of rows affected

  • All issues with with mentions ~1796152d
  • Open issues with mentions ~506626
-- all issues that possibly have a mention in description or title: ~1796152
explain select * from issues where (description like '%@%' OR title like '%@%')
 Seq Scan on public.issues  (cost=0.00..7968605.04 rows=1401267 width=4) (actual time=35.232..672139.124 rows=1796152 loops=1)
   Filter: ((issues.description ~~ '%@%'::text) OR ((issues.title)::text ~~ '%@%'::text))
   Rows Removed by Filter: 20650033
   Buffers: shared hit=1453859 read=2533248 dirtied=28321 written=22499
   I/O Timings: read=611404.724 write=706.509

-- Open issues that possibly have a mention in description or title: ~506626
explain select * from issues where state_id = 1 and (description like '%@%' OR title like '%@%')
 Index Scan using idx_issues_on_state_id on public.issues  (cost=0.44..3874341.82 rows=435135 width=4) (actual time=3.729..1219825.809 rows=506626 loops=1)
   Index Cond: (issues.state_id = 1)
   Filter: ((issues.description ~~ '%@%'::text) OR ((issues.title)::text ~~ '%@%'::text))
   Rows Removed by Filter: 6436851
   Buffers: shared hit=793170 read=2369408 dirtied=9492 written=844
   I/O Timings: read=1183525.805 write=21.795
Edited by Alexandru Croitor