Skip to content

Milestones finder - filter by id OR title

What does this MR do and why?

This MR changes MilestonesFinder as suggested in #391332 (closed) - now it treats milestone titles and milestone ids as an OR relationship, instead of an AND

New SQL queries

Milestone.with_ids_or_title

Raw SQL
SELECT "milestones".* FROM "milestones" WHERE ("milestones"."id" = 1 OR "milestones"."title" = 'Title')
Query plan (executed locally)
EXPLAIN ANALYZE SELECT "milestones".* FROM "milestones" WHERE ("milestones"."id" = 1 OR "milestones"."title" = 'Title');
                                                               QUERY PLAN
----------------------------------------------------------------------------------------------------------------------------------------
 Bitmap Heap Scan on milestones  (cost=2.30..4.33 rows=2 width=211) (actual time=0.037..0.038 rows=1 loops=1)
   Recheck Cond: ((id = 1) OR ((title)::text = 'Title'::text))
   Heap Blocks: exact=1
   ->  BitmapOr  (cost=2.30..2.30 rows=2 width=0) (actual time=0.028..0.028 rows=0 loops=1)
         ->  Bitmap Index Scan on milestones_pkey  (cost=0.00..1.15 rows=1 width=0) (actual time=0.017..0.017 rows=1 loops=1)
               Index Cond: (id = 1)
         ->  Bitmap Index Scan on index_milestones_on_title  (cost=0.00..1.15 rows=1 width=0) (actual time=0.010..0.010 rows=0 loops=1)
               Index Cond: ((title)::text = 'Title'::text)
 Planning Time: 0.293 ms
 Execution Time: 0.094 ms
(10 rows)
Edited by Zakir Dzhamaliddinov

Merge request reports