explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Z4WX

Settings
# exclusive inclusive rows x rows loops node
1. 2.543 32.014 ↓ 176.2 705 1

Unique (cost=12,477.00..12,477.15 rows=4 width=319) (actual time=29.401..32.014 rows=705 loops=1)

2. 3.738 29.471 ↓ 218.5 874 1

Sort (cost=12,477.00..12,477.01 rows=4 width=319) (actual time=29.398..29.471 rows=874 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: quicksort Memory: 382kB
3. 4.564 25.733 ↓ 218.5 874 1

Gather (cost=1,004.99..12,476.96 rows=4 width=319) (actual time=13.334..25.733 rows=874 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
4. 0.393 21.169 ↓ 218.5 437 2 / 2

Nested Loop Left Join (cost=4.99..11,476.56 rows=2 width=319) (actual time=9.375..21.169 rows=437 loops=2)

5. 0.089 17.956 ↓ 176.0 352 2 / 2

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

6. 0.320 17.162 ↓ 176.0 352 2 / 2

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

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

Parallel Seq Scan on events_v2 t (cost=0.00..11,402.41 rows=5 width=254) (actual time=9.255..13.800 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
8. 3.042 3.042 ↑ 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.007..0.007 rows=1 loops=869)

  • Index Cond: ((event_uid)::text = (t.uid)::text)
9. 0.705 0.705 ↑ 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.002..0.002 rows=1 loops=705)

  • Index Cond: ((id = t.organization_id) AND (is_deleted = false))
  • Filter: (NOT is_deleted)
  • Heap Fetches: 324
10. 0.705 2.820 ↑ 2.0 1 705 / 2

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

  • Recheck Cond: ((event_uid)::text = (t.uid)::text)
  • Heap Blocks: exact=333
11. 2.115 2.115 ↑ 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.006..0.006 rows=1 loops=705)

  • Index Cond: ((event_uid)::text = (t.uid)::text)
Planning time : 1.239 ms
Execution time : 32.330 ms