explain.depesz.com

PostgreSQL's explain analyze made readable

Result: q410 : Optimization for: plan #BTlo

Settings

Optimization path:

# exclusive inclusive rows x rows loops node
1. 0.002 1.187 ↓ 20.0 20 1

Limit (cost=63.93..63.94 rows=1 width=518) (actual time=1.185..1.187 rows=20 loops=1)

2. 0.028 1.185 ↓ 20.0 20 1

Sort (cost=63.93..63.94 rows=1 width=518) (actual time=1.185..1.185 rows=20 loops=1)

  • Sort Key: t0.created_at DESC
  • Sort Method: quicksort Memory: 63kB
3. 0.097 1.157 ↓ 38.0 38 1

GroupAggregate (cost=63.84..63.92 rows=1 width=518) (actual time=1.077..1.157 rows=38 loops=1)

  • Group Key: t0.id, o.id
4. 0.047 1.060 ↓ 38.0 38 1

Sort (cost=63.84..63.85 rows=1 width=575) (actual time=1.058..1.060 rows=38 loops=1)

  • Sort Key: t0.id, o.id
  • Sort Method: quicksort Memory: 63kB
5. 0.018 1.013 ↓ 38.0 38 1

Nested Loop (cost=13.68..63.83 rows=1 width=575) (actual time=0.111..1.013 rows=38 loops=1)

6. 0.326 0.919 ↓ 38.0 38 1

Nested Loop (cost=13.39..60.72 rows=1 width=539) (actual time=0.098..0.919 rows=38 loops=1)

  • Join Filter: (o.id = ((t0.metadata ->> 'order_id'::text))::integer)
  • Rows Removed by Join Filter: 1042
7. 0.010 0.161 ↓ 27.0 27 1

Nested Loop (cost=13.39..51.66 rows=1 width=86) (actual time=0.085..0.161 rows=27 loops=1)

8. 0.018 0.097 ↓ 4.5 27 1

Hash Join (cost=13.12..27.49 rows=6 width=90) (actual time=0.073..0.097 rows=27 loops=1)

  • Hash Cond: (od.order_id = o.id)
9. 0.020 0.052 ↑ 1.1 27 1

Hash Join (cost=11.51..25.51 rows=29 width=62) (actual time=0.038..0.052 rows=27 loops=1)

  • Hash Cond: (od.cart_id = c.id)
10. 0.005 0.005 ↑ 10.0 27 1

Seq Scan on order_detail od (cost=0.00..12.70 rows=270 width=18) (actual time=0.003..0.005 rows=27 loops=1)

11. 0.007 0.027 ↑ 1.0 29 1

Hash (cost=11.15..11.15 rows=29 width=52) (actual time=0.027..0.027 rows=29 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
12. 0.005 0.020 ↑ 1.0 29 1

Nested Loop (cost=9.55..11.15 rows=29 width=52) (actual time=0.013..0.020 rows=29 loops=1)

13. 0.002 0.009 ↑ 1.0 1 1

Aggregate (cost=9.55..9.56 rows=1 width=32) (actual time=0.009..0.009 rows=1 loops=1)

14. 0.000 0.007 ↓ 0.0 0 1

Nested Loop (cost=0.15..9.54 rows=2 width=8) (actual time=0.007..0.007 rows=0 loops=1)

15. 0.007 0.007 ↓ 0.0 0 1

Seq Scan on "order" cancel_order (cost=0.00..1.34 rows=1 width=8) (actual time=0.007..0.007 rows=0 loops=1)

  • Filter: (canceled_from > 0)
  • Rows Removed by Filter: 27
16. 0.000 0.000 ↓ 0.0 0

Index Scan using order_detail_order_id_idx on order_detail cancel_detail (cost=0.15..8.18 rows=2 width=16) (never executed)

  • Index Cond: (order_id = cancel_order.id)
17. 0.006 0.006 ↑ 1.0 29 1

Seq Scan on cart c (cost=0.00..1.29 rows=29 width=20) (actual time=0.004..0.006 rows=29 loops=1)

18. 0.009 0.027 ↑ 1.0 27 1

Hash (cost=1.27..1.27 rows=27 width=28) (actual time=0.027..0.027 rows=27 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
19. 0.018 0.018 ↑ 1.0 27 1

Seq Scan on "order" o (cost=0.00..1.27 rows=27 width=28) (actual time=0.011..0.018 rows=27 loops=1)

20. 0.054 0.054 ↑ 1.0 1 27

Index Scan using zaiko_orgid_ver_idx on zaiko zk (cost=0.28..4.02 rows=1 width=20) (actual time=0.002..0.002 rows=1 loops=27)

  • Index Cond: ((orgid = c.zaiko_id) AND (ver = c.zaiko_ver))
21. 0.432 0.432 ↑ 1.3 40 27

Seq Scan on users_app_notification t0 (cost=0.00..8.04 rows=51 width=903) (actual time=0.001..0.016 rows=40 loops=27)

  • Filter: ((status = ANY ('{1,2}'::integer[])) AND (users_id = 29100) AND (COALESCE((metadata ->> 'is_chat_noti'::text), 'false'::text) <> 'true'::text))
  • Rows Removed by Filter: 7
22. 0.076 0.076 ↑ 1.0 1 38

Index Scan using catalog_pkey on catalog ctl (cost=0.29..3.11 rows=1 width=48) (actual time=0.002..0.002 rows=1 loops=38)

  • Index Cond: (id = zk.catalog_id)