explain.depesz.com

PostgreSQL's explain analyze made readable

Result: 50z3

Settings
# exclusive inclusive rows x rows loops node
1. 0.625 18,266.968 ↑ 1.0 20 1

Limit (cost=40,013.18..40,013.23 rows=20 width=612) (actual time=18,263.267..18,266.968 rows=20 loops=1)

2. 206.210 18,266.343 ↑ 656.9 20 1

Sort (cost=40,013.18..40,046.02 rows=13,138 width=612) (actual time=18,263.239..18,266.343 rows=20 loops=1)

  • Sort Key: t0.created_at DESC
  • Sort Method: top-N heapsort Memory: 66kB
3. 770.339 18,060.133 ↑ 2.1 6,391 1

GroupAggregate (cost=38,612.54..39,663.58 rows=13,138 width=612) (actual time=17,019.319..18,060.133 rows=6,391 loops=1)

  • Group Key: t0.id, o.id
4. 1,073.496 17,289.794 ↑ 1.5 8,878 1

Sort (cost=38,612.54..38,645.39 rows=13,138 width=674) (actual time=17,019.196..17,289.794 rows=8,878 loops=1)

  • Sort Key: t0.id, o.id
  • Sort Method: external sort Disk: 7424kB
5. 849.681 16,216.298 ↑ 1.5 8,878 1

Nested Loop (cost=6,217.40..33,758.81 rows=13,138 width=674) (actual time=2,424.584..16,216.298 rows=8,878 loops=1)

6. 0.633 78.966 ↑ 1.0 1 1

Aggregate (cost=2,127.67..2,127.68 rows=1 width=32) (actual time=78.761..78.966 rows=1 loops=1)

7. 1.485 78.333 ↑ 1.5 21 1

Nested Loop (cost=0.29..2,127.58 rows=32 width=8) (actual time=10.370..78.333 rows=21 loops=1)

8. 75.966 75.966 ↑ 1.2 18 1

Seq Scan on "order" cancel_order (cost=0.00..1,920.35 rows=22 width=8) (actual time=10.287..75.966 rows=18 loops=1)

  • Filter: (canceled_from > 0)
  • Rows Removed by Filter: 58970
9. 0.882 0.882 ↑ 2.0 1 18

Index Scan using order_detail_order_id_idx on order_detail cancel_detail (cost=0.29..9.40 rows=2 width=16) (actual time=0.028..0.049 rows=1 loops=18)

  • Index Cond: (order_id = cancel_order.id)
10. 0.000 15,287.651 ↑ 1.5 8,878 1

Gather (cost=4,089.73..31,499.74 rows=13,138 width=642) (actual time=2,345.775..15,287.651 rows=8,878 loops=1)

  • Workers Planned: 1
  • Workers Launched: 1
11. 1,455.912 15,479.847 ↑ 1.7 4,439 2

Nested Loop (cost=3,089.73..29,185.94 rows=7,728 width=642) (actual time=2,331.658..15,479.847 rows=4,439 loops=2)

12. 2,311.813 14,023.799 ↑ 1.7 4,439 2

Nested Loop (cost=3,089.44..26,758.96 rows=7,728 width=601) (actual time=2,331.544..14,023.799 rows=4,439 loops=2)

13. 1,699.765 11,711.781 ↑ 1.2 4,439 2

Nested Loop (cost=3,089.01..9,746.17 rows=5,359 width=605) (actual time=2,331.443..11,711.781 rows=4,439 loops=2)

14. 1,946.433 10,011.868 ↑ 1.2 4,439 2

Nested Loop (cost=3,088.72..7,735.90 rows=5,359 width=593) (actual time=2,331.351..10,011.868 rows=4,439 loops=2)

15. 2,869.858 8,065.192 ↑ 1.2 3,196 2

Merge Join (cost=3,088.43..6,124.13 rows=3,741 width=722) (actual time=2,331.241..8,065.192 rows=3,196 loops=2)

  • Merge Cond: (o.id = (((t0.metadata ->> 'order_id'::text))::integer))
16. 2,477.909 2,477.909 ↑ 1.2 29,494 2

Parallel Index Scan using order_pkey on "order" o (cost=0.29..2,556.21 rows=34,699 width=28) (actual time=0.154..2,477.909 rows=29,494 loops=2)

17. 988.450 2,717.425 ↓ 1.0 6,383 2

Materialize (cost=3,088.14..3,119.93 rows=6,359 width=694) (actual time=1,237.602..2,717.425 rows=6,383 loops=2)

18. 1,087.183 1,728.975 ↓ 1.0 6,383 2

Sort (cost=3,088.14..3,104.03 rows=6,359 width=694) (actual time=1,237.553..1,728.975 rows=6,383 loops=2)

  • Sort Key: (((t0.metadata ->> 'order_id'::text))::integer)
  • Sort Method: external sort Disk: 4488kB
19. 641.792 641.792 ↓ 1.0 6,391 2

Seq Scan on users_app_notification t0 (cost=0.00..729.92 rows=6,359 width=694) (actual time=0.072..641.792 rows=6,391 loops=2)

  • Filter: ((status = ANY ('{1,2}'::integer[])) AND (users_id = 70) AND (COALESCE((metadata ->> 'is_chat_noti'::text), 'false'::text) <> 'true'::text))
  • Rows Removed by Filter: 5
20. 0.243 0.243 ↑ 2.0 1 6,391

Index Scan using order_detail_order_id_idx on order_detail od (cost=0.29..0.41 rows=2 width=18) (actual time=0.156..0.243 rows=1 loops=6,391)

  • Index Cond: (order_id = o.id)
21. 0.148 0.148 ↑ 1.0 1 8,878

Index Scan using cart_pkey on cart c (cost=0.29..0.38 rows=1 width=20) (actual time=0.148..0.148 rows=1 loops=8,878)

  • Index Cond: (id = od.cart_id)
22. 0.205 0.205 ↑ 1.0 1 8,878

Index Scan using zaiko_orgid_ver_idx on zaiko zk (cost=0.43..3.16 rows=1 width=20) (actual time=0.135..0.205 rows=1 loops=8,878)

  • Index Cond: ((orgid = c.zaiko_id) AND (ver = c.zaiko_ver))
23. 0.136 0.136 ↑ 1.0 1 8,878

Index Scan using catalog_pkey on catalog ctl (cost=0.29..0.31 rows=1 width=53) (actual time=0.136..0.136 rows=1 loops=8,878)

  • Index Cond: (id = zk.catalog_id)
Planning time : 23.486 ms
Execution time : 18,274.963 ms