explain.depesz.com

PostgreSQL's explain analyze made readable

Result: NsZP

Settings
# exclusive inclusive rows x rows loops node
1. 5,774.650 31,564.477 ↓ 1.6 705 1

Unique (cost=13,470.29..13,487.17 rows=450 width=319) (actual time=25,249.413..31,564.477 rows=705 loops=1)

2. 24,959.474 25,789.827 ↓ 268.7 120,936 1

Sort (cost=13,470.29..13,471.42 rows=450 width=319) (actual time=25,249.411..25,789.827 rows=120,936 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 merge Disk: 29776kB
3. 373.267 830.353 ↓ 268.7 120,936 1

Gather (cost=1,005.57..13,450.46 rows=450 width=319) (actual time=15.005..830.353 rows=120,936 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
4. 120.774 457.086 ↓ 228.2 60,468 2 / 2

Nested Loop (cost=5.57..12,405.46 rows=265 width=319) (actual time=10.428..457.086 rows=60,468 loops=2)

5. 18.854 222.975 ↓ 2,179.5 56,668 2 / 2

Nested Loop (cost=5.28..11,542.91 rows=26 width=307) (actual time=10.385..222.975 rows=56,668 loops=2)

6. 1.590 31.943 ↓ 218.5 437 2 / 2

Nested Loop Left Join (cost=4.99..11,476.56 rows=2 width=307) (actual time=10.360..31.943 rows=437 loops=2)

7. 0.665 25.418 ↓ 176.0 352 2 / 2

Nested Loop (cost=0.56..11,452.04 rows=2 width=307) (actual time=10.332..25.418 rows=352 loops=2)

8. 1.607 23.343 ↓ 176.0 352 2 / 2

Nested Loop Left Join (cost=0.41..11,444.66 rows=2 width=307) (actual time=10.291..23.343 rows=352 loops=2)

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

Parallel Seq Scan on events_v2 t (cost=0.00..11,402.41 rows=5 width=254) (actual time=10.229..15.653 rows=434 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: 28343
10. 6.083 6.083 ↑ 1.0 1 869 / 2

Index Scan using event_meta_event_uid_key on event_meta em (cost=0.41..8.43 rows=1 width=86) (actual time=0.014..0.014 rows=1 loops=869)

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

Index Only Scan using idx_organization_id_and_deleted on organization org (cost=0.14..3.66 rows=1 width=8) (actual time=0.004..0.004 rows=1 loops=705)

  • Index Cond: ((id = t.organization_id) AND (is_deleted = false))
  • Filter: (NOT is_deleted)
  • Heap Fetches: 91
12. 1.410 4.935 ↑ 2.0 1 705 / 2

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

  • Recheck Cond: ((event_uid)::text = (t.uid)::text)
  • Heap Blocks: exact=94
13. 3.525 3.525 ↑ 2.0 1 705 / 2

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

  • Index Cond: ((event_uid)::text = (t.uid)::text)
14. 172.178 172.178 ↓ 13.0 130 874 / 2

Index Only Scan using idx_views_valid_point_is_deleted on valid_point p (cost=0.29..33.08 rows=10 width=8) (actual time=0.003..0.394 rows=130 loops=874)

  • Index Cond: ((id = ANY (t.point_from_ids)) AND (is_deleted = false))
  • Filter: (NOT is_deleted)
  • Heap Fetches: 0
15. 113.337 113.337 ↑ 10.0 1 113,337 / 2

Index Only Scan using idx_views_valid_point_is_deleted on valid_point pt (cost=0.29..33.08 rows=10 width=8) (actual time=0.001..0.002 rows=1 loops=113,337)

  • Index Cond: ((id = ANY (t.point_to_ids)) AND (is_deleted = false))
  • Filter: (NOT is_deleted)
  • Heap Fetches: 0
Planning time : 1.991 ms
Execution time : 31,570.641 ms