explain.depesz.com

PostgreSQL's explain analyze made readable

Result: gZmw

Settings

Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 0.002 212.172 ↓ 0.0 0 1

GroupAggregate (cost=128,705.39..128,784.99 rows=3,980 width=12) (actual time=212.172..212.172 rows=0 loops=1)

  • Group Key: carts.id
  • Buffers: shared hit=45283, temp read=2370 written=2370
2. 0.026 212.170 ↓ 0.0 0 1

Sort (cost=128,705.39..128,715.34 rows=3,980 width=20) (actual time=212.170..212.170 rows=0 loops=1)

  • Sort Key: carts.id
  • Sort Method: quicksort Memory: 25kB
  • Buffers: shared hit=45283, temp read=2370 written=2370
3. 0.001 212.144 ↓ 0.0 0 1

Nested Loop Left Join (cost=14,922.64..128,467.41 rows=3,980 width=20) (actual time=212.144..212.144 rows=0 loops=1)

  • Buffers: shared hit=45280, temp read=2370 written=2370
4. 23.944 212.143 ↓ 0.0 0 1

Hash Join (cost=14,922.21..122,737.82 rows=3,980 width=16) (actual time=212.142..212.143 rows=0 loops=1)

  • Hash Cond: (cart_locations.cart_id = carts.id)
  • Join Filter: (((carts.user_id = '49c4cb3523c268d2b26c50c095fb057b25c07274e493d66f7e2cd0151fd92232'::text) OR (alternatives: SubPlan 1 or hashed SubPlan 2)) AND ((alternatives: SubPlan 3 or hashed SubPla
  • Rows Removed by Join Filter: 4376
  • Buffers: shared hit=45280, temp read=2370 written=2370
5. 4.168 81.533 ↑ 3.6 4,481 1

Nested Loop (cost=0.56..104,619.07 rows=16,037 width=38) (actual time=0.101..81.533 rows=4,481 loops=1)

  • Buffers: shared hit=38851
6. 1.234 1.234 ↓ 1.0 8,459 1

Seq Scan on favorites (cost=0.00..300.16 rows=8,456 width=96) (actual time=0.014..1.234 rows=8,459 loops=1)

  • Filter: (NOT soft_delete)
  • Rows Removed by Filter: 60
  • Buffers: shared hit=215
7. 76.131 76.131 ↑ 2.0 1 8,459

Index Scan using cart_locations_location_id on cart_locations (cost=0.56..12.32 rows=2 width=73) (actual time=0.009..0.009 rows=1 loops=8,459)

  • Index Cond: (location_id = favorites.location_id)
  • Filter: (NOT soft_delete)
  • Rows Removed by Filter: 0
  • Buffers: shared hit=38636
8. 61.994 106.652 ↓ 1.0 247,760 1

Hash (cost=8,922.16..8,922.16 rows=247,719 width=68) (actual time=106.652..106.652 rows=247,760 loops=1)

  • Buckets: 65536 Batches: 8 Memory Usage: 3564kB
  • Buffers: shared hit=6427, temp written=2333
9. 44.658 44.658 ↓ 1.0 247,760 1

Seq Scan on carts (cost=0.00..8,922.16 rows=247,719 width=68) (actual time=0.007..44.658 rows=247,760 loops=1)

  • Filter: (NOT soft_delete)
  • Rows Removed by Filter: 1730
  • Buffers: shared hit=6427
10.          

SubPlan (forHash Join)

11. 0.000 0.000 ↓ 0.0 0

Seq Scan on cart_shared_with_users (cost=0.00..3.29 rows=1 width=0) (never executed)

  • Filter: ((NOT soft_delete) AND (cart_id = cart_locations.cart_id) AND (user_id = '49c4cb3523c268d2b26c50c095fb057b25c07274e493d66f7e2cd0151fd92232'::text) AND (user_source = 'republic'::user_source_id))
12. 0.014 0.014 ↓ 0.0 0 1

Seq Scan on cart_shared_with_users cart_shared_with_users_1 (cost=0.00..3.11 rows=1 width=4) (actual time=0.014..0.014 rows=0 loops=1)

  • Filter: ((NOT soft_delete) AND (user_id = '49c4cb3523c268d2b26c50c095fb057b25c07274e493d66f7e2cd0151fd92232'::text) AND (user_source = 'republic'::user_source_id))
  • Rows Removed by Filter: 76
  • Buffers: shared hit=2
13. 0.000 0.000 ↓ 0.0 0

Seq Scan on cart_shared_with_users cart_shared_with_users_2 (cost=0.00..3.29 rows=1 width=0) (never executed)

  • Filter: ((NOT soft_delete) AND (cart_id = cart_locations.cart_id) AND (favorites.user_id = user_id) AND (user_source = 'republic'::user_source_id))
14. 0.000 0.000 ↓ 0.0 0

Seq Scan on cart_shared_with_users cart_shared_with_users_3 (cost=0.00..2.92 rows=66 width=27) (never executed)

  • Filter: ((NOT soft_delete) AND (user_source = 'republic'::user_source_id))
15. 0.000 0.000 ↓ 0.0 0

Index Scan using user_per_cart_location_notifications_idx on user_per_cart_location_notifications (cost=0.43..1.43 rows=1 width=12) (never executed)

  • Index Cond: (cart_locations.id = cart_location_id)
Planning time : 4.332 ms
Execution time : 212.559 ms