explain.depesz.com

PostgreSQL's explain analyze made readable

Result: MJ2X

Settings
# exclusive inclusive rows x rows loops node
1. 8.373 122.712 ↓ 1.6 661 1

Unique (cost=13,869.61..13,885.58 rows=426 width=322) (actual time=111.844..122.712 rows=661 loops=1)

2. 71.889 114.339 ↓ 19.7 8,401 1

Sort (cost=13,869.61..13,870.67 rows=426 width=322) (actual time=111.842..114.339 rows=8,401 loops=1)

  • Sort Key: t.date, t.uid, t.point_from_ids, t.point_to_ids, t.organization_id, t.created_at, t.updated_at, t.init_point_id, t.chain_hash, (COALESCE(em.meta, '{}'::jsonb)), t.is_imported, em.parent_chain_hash, t.autorepeat_hash, t.is_fbs
  • Sort Method: external sort Disk: 4056kB
3. 2.922 42.450 ↓ 19.7 8,401 1

Gather (cost=1,005.57..13,851.00 rows=426 width=322) (actual time=11.250..42.450 rows=8,401 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
4. 1.173 39.528 ↓ 16.7 4,200 2 / 2

Nested Loop (cost=5.57..12,808.40 rows=251 width=322) (actual time=7.490..39.528 rows=4,200 loops=2)

5. 0.280 23.919 ↓ 16.0 401 2 / 2

Nested Loop (cost=5.28..11,022.61 rows=25 width=311) (actual time=7.472..23.919 rows=401 loops=2)

6. 0.417 22.436 ↓ 200.5 401 2 / 2

Nested Loop Left Join (cost=4.99..10,879.75 rows=2 width=311) (actual time=7.424..22.436 rows=401 loops=2)

7. 0.197 17.392 ↓ 165.0 330 2 / 2

Nested Loop (cost=0.56..10,855.22 rows=2 width=311) (actual time=7.372..17.392 rows=330 loops=2)

8. 0.457 16.534 ↓ 165.0 330 2 / 2

Nested Loop Left Join (cost=0.41..10,846.83 rows=2 width=311) (actual time=7.317..16.534 rows=330 loops=2)

  • Filter: (NOT COALESCE(((em.meta ->> 'ComplexRoute'::text))::boolean, false))
  • Rows Removed by Filter: 82
9. 10.714 10.714 ↓ 103.0 412 2 / 2

Parallel Seq Scan on events_v2 t (cost=0.00..10,813.03 rows=4 width=257) (actual time=7.227..10.714 rows=412 loops=2)

  • Filter: ((((date + '03:00:00'::interval))::date >= '2020-05-08'::date) AND (((date + '03:00:00'::interval))::date <= '2020-05-10'::date) AND ((init_point_id = ANY (point_from_ids)) OR ((init_point_id = ANY (point_to_ids)) AND is_fbs)) AND CASE WHEN (init_point_id = ANY (NULL::bigint[])) THEN (NOT is_imported) ELSE (init_point_id = ANY ('{71904713,37534835,2,37534831,24,37534834,74404559,33935733,33949582,6041,33234808,4746,25565607,8,3339,9790308,31289738,31289742,31048375,71904711,23381011,32879483,89099974,33935736,23381010,46242067,3340,89099979,11,46242069,6821844,12,29570928,77918440,46257354,31559323,15,28,37534832,31048376,46242073,9,31545800,68727006,31559335,16932572,33935737,89099975,44009459,45074276,22,45134433,46242075,45074285,46242072,16932574,32879487,20721486,46242071,31249393,44009457,37534836,31289734,50677383,74804035,33949581,15564683,33935735,31276267,31048378,20721485,3454,11841881,32879486,46242063,46242066,46242070,10,3338,5209,8269152,5683,43964497,45089314,25,35633224,12124137,20,31559341,71904712,50708850,3,37534833,31559332,71904710,43994469,13,31276280,43994470,45074279,3088539,89099978,23393397,14,31276270,31276271,33935739,68727005,7,31289745,74804036,3341,31048377,45029225,31545799,10289611,74404560,89099969,31222544,33949580,18,71904709,26,23,31289732,31303216,31249392,33935738,50661657,72464520,33935734,50677385,31289739,3455,31289741,4597,89099977,72464519,89099973,31289737,120062930,43949531,71904708,9837,32893134,31289740,25565605,31559339,9790310,31249395,45089315,6,19944229,68403069,16,25565606,25565604,3337,9851,4,37520704,62379851,27,19,1,77918439,31262830,17,62771745,16932573,21,54901057,5,77918441,31276281,5255,77566940}'::bigint[])) END)
  • Rows Removed by Filter: 26844
10. 5.362 5.362 ↑ 1.0 1 825 / 2

Index Scan using event_meta_event_uid_key on event_meta em (cost=0.41..8.43 rows=1 width=87) (actual time=0.013..0.013 rows=1 loops=825)

  • Index Cond: ((event_uid)::text = (t.uid)::text)
11. 0.661 0.661 ↑ 1.0 1 661 / 2

Index Only Scan using idx_organization_id_and_deleted on organization org (cost=0.14..4.16 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=661)

  • Index Cond: ((id = t.organization_id) AND (is_deleted = false))
  • Filter: (NOT is_deleted)
  • Heap Fetches: 140
12. 0.661 4.627 ↑ 2.0 1 661 / 2

Bitmap Heap Scan on event_orders eo (cost=4.43..12.25 rows=2 width=33) (actual time=0.014..0.014 rows=1 loops=661)

  • Recheck Cond: ((event_uid)::text = (t.uid)::text)
  • Heap Blocks: exact=143
13. 3.966 3.966 ↑ 2.0 1 661 / 2

Bitmap Index Scan on idx_event_orders_event_uid (cost=0.00..4.43 rows=2 width=0) (actual time=0.012..0.012 rows=1 loops=661)

  • Index Cond: ((event_uid)::text = (t.uid)::text)
14. 1.203 1.203 ↑ 10.0 1 802 / 2

Index Scan using idx_views_valid_point_id on valid_point p (cost=0.29..71.33 rows=10 width=8) (actual time=0.002..0.003 rows=1 loops=802)

  • Index Cond: (id = ANY (t.point_from_ids))
  • Filter: (NOT is_deleted)
15. 14.436 14.436 ↑ 1.0 10 802 / 2

Index Scan using idx_views_valid_point_id on valid_point pt (cost=0.29..71.33 rows=10 width=8) (actual time=0.003..0.036 rows=10 loops=802)

  • Index Cond: (id = ANY (t.point_to_ids))
  • Filter: (NOT is_deleted)
Planning time : 3.149 ms
Execution time : 124.383 ms