explain.depesz.com

PostgreSQL's explain analyze made readable

Result: CjVX

Settings
# exclusive inclusive rows x rows loops node
1. 0.004 60.915 ↑ 1.0 20 1

Limit (cost=9,980.83..9,980.88 rows=20 width=546) (actual time=60.912..60.915 rows=20 loops=1)

2. 0.291 60.911 ↑ 2.4 20 1

Sort (cost=9,980.83..9,980.95 rows=47 width=546) (actual time=60.910..60.911 rows=20 loops=1)

  • Sort Key: t0.created_at DESC
  • Sort Method: top-N heapsort Memory: 66kB
3. 1.706 60.620 ↓ 9.3 436 1

GroupAggregate (cost=9,975.82..9,979.58 rows=47 width=546) (actual time=58.904..60.620 rows=436 loops=1)

  • Group Key: t0.id, o.id
4. 0.967 58.914 ↓ 12.1 569 1

Sort (cost=9,975.82..9,975.94 rows=47 width=607) (actual time=58.854..58.914 rows=569 loops=1)

  • Sort Key: t0.id, o.id
  • Sort Method: quicksort Memory: 602kB
5. 0.201 57.947 ↓ 12.1 569 1

Nested Loop (cost=7,978.26..9,974.52 rows=47 width=607) (actual time=49.525..57.947 rows=569 loops=1)

6. 0.012 8.951 ↑ 1.0 1 1

Aggregate (cost=2,316.82..2,316.83 rows=1 width=32) (actual time=8.951..8.951 rows=1 loops=1)

7. 0.008 8.939 ↓ 1.5 6 1

Nested Loop (cost=442.70..2,316.81 rows=4 width=8) (actual time=4.137..8.939 rows=6 loops=1)

8. 7.193 8.891 ↑ 1.0 5 1

Bitmap Heap Scan on "order" cancel_order (cost=442.41..2,268.78 rows=5 width=8) (actual time=4.110..8.891 rows=5 loops=1)

  • Recheck Cond: (ninushi_id = ANY ((current_setting('shipper.id'::text))::integer[]))
  • Filter: (canceled_from > 0)
  • Rows Removed by Filter: 25078
  • Heap Blocks: exact=938
9. 1.698 1.698 ↓ 1.0 25,108 1

Bitmap Index Scan on order_ninushi_id_idx (cost=0.00..442.41 rows=24,996 width=0) (actual time=1.698..1.698 rows=25,108 loops=1)

  • Index Cond: (ninushi_id = ANY ((current_setting('shipper.id'::text))::integer[]))
10. 0.040 0.040 ↑ 1.0 1 5

Index Scan using order_detail_order_id_idx on order_detail cancel_detail (cost=0.29..9.60 rows=1 width=16) (actual time=0.007..0.008 rows=1 loops=5)

  • Index Cond: (order_id = cancel_order.id)
  • Filter: (ninushi_id = ANY ((current_setting('shipper.id'::text))::integer[]))
11. 0.357 48.795 ↓ 12.1 569 1

Nested Loop (cost=5,661.44..7,657.20 rows=47 width=575) (actual time=40.569..48.795 rows=569 loops=1)

12. 0.424 46.731 ↓ 1.6 569 1

Nested Loop (cost=5,661.15..7,536.98 rows=349 width=535) (actual time=40.520..46.731 rows=569 loops=1)

13. 0.373 44.031 ↓ 1.5 569 1

Nested Loop (cost=5,660.72..6,129.83 rows=382 width=539) (actual time=40.483..44.031 rows=569 loops=1)

14. 0.842 42.520 ↓ 1.5 569 1

Hash Join (cost=5,660.43..5,964.60 rows=382 width=527) (actual time=40.441..42.520 rows=569 loops=1)

  • Hash Cond: (((t0.metadata ->> 'order_id'::text))::integer = od.order_id)
15. 0.695 21.644 ↓ 1.1 436 1

Hash Join (cost=2,524.99..2,770.20 rows=401 width=695) (actual time=20.294..21.644 rows=436 loops=1)

  • Hash Cond: (((t0.metadata ->> 'order_id'::text))::integer = o.id)
16. 0.715 0.715 ↑ 1.8 451 1

Seq Scan on users_app_notification t0 (cost=0.00..234.88 rows=795 width=667) (actual time=0.012..0.715 rows=451 loops=1)

  • Filter: ((status = ANY ('{1,2}'::integer[])) AND (users_id = 1) AND (COALESCE((metadata ->> 'is_chat_noti'::text), 'false'::text) <> 'true'::text))
  • Rows Removed by Filter: 734
17. 7.704 20.234 ↓ 1.0 25,083 1

Hash (cost=2,212.54..2,212.54 rows=24,996 width=28) (actual time=20.234..20.234 rows=25,083 loops=1)

  • Buckets: 32768 Batches: 1 Memory Usage: 1824kB
18. 11.054 12.530 ↓ 1.0 25,083 1

Bitmap Heap Scan on "order" o (cost=448.66..2,212.54 rows=24,996 width=28) (actual time=1.615..12.530 rows=25,083 loops=1)

  • Recheck Cond: (ninushi_id = ANY ((current_setting('shipper.id'::text))::integer[]))
  • Heap Blocks: exact=938
19. 1.476 1.476 ↓ 1.0 25,108 1

Bitmap Index Scan on order_ninushi_id_idx (cost=0.00..442.41 rows=24,996 width=0) (actual time=1.476..1.476 rows=25,108 loops=1)

  • Index Cond: (ninushi_id = ANY ((current_setting('shipper.id'::text))::integer[]))
20. 8.617 20.034 ↓ 1.0 38,944 1

Hash (cost=2,651.49..2,651.49 rows=38,716 width=18) (actual time=20.034..20.034 rows=38,944 loops=1)

  • Buckets: 65536 Batches: 1 Memory Usage: 2642kB
21. 9.134 11.417 ↓ 1.0 38,944 1

Bitmap Heap Scan on order_detail od (cost=651.01..2,651.49 rows=38,716 width=18) (actual time=2.400..11.417 rows=38,944 loops=1)

  • Recheck Cond: (ninushi_id = ANY ((current_setting('shipper.id'::text))::integer[]))
  • Heap Blocks: exact=758
22. 2.283 2.283 ↓ 1.0 38,986 1

Bitmap Index Scan on order_detail_ninushi_id_idx (cost=0.00..641.33 rows=38,716 width=0) (actual time=2.283..2.283 rows=38,986 loops=1)

  • Index Cond: (ninushi_id = ANY ((current_setting('shipper.id'::text))::integer[]))
23. 1.138 1.138 ↑ 1.0 1 569

Index Scan using cart_pkey on cart c (cost=0.29..0.43 rows=1 width=20) (actual time=0.002..0.002 rows=1 loops=569)

  • Index Cond: (id = od.cart_id)
24. 2.276 2.276 ↑ 1.0 1 569

Index Scan using zaiko_orgid_ver_idx on zaiko zk (cost=0.43..3.67 rows=1 width=20) (actual time=0.004..0.004 rows=1 loops=569)

  • Index Cond: ((orgid = c.zaiko_id) AND (ver = c.zaiko_ver))
  • Filter: (ninushi_id = ANY ((current_setting('shipper.id'::text))::integer[]))
25. 1.707 1.707 ↑ 1.0 1 569

Index Scan using catalog_pkey on catalog ctl (cost=0.29..0.34 rows=1 width=52) (actual time=0.003..0.003 rows=1 loops=569)

  • Index Cond: (id = zk.catalog_id)
  • Filter: (ninushi_id = ANY ((current_setting('shipper.id'::text))::integer[]))
Planning time : 3.731 ms
Execution time : 62.073 ms