explain.depesz.com

PostgreSQL's explain analyze made readable

Result: saqW

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 2,776.392 ↑ 500.0 1 1

Limit (cost=218,170.44..218,171.69 rows=500 width=138) (actual time=2,776.391..2,776.392 rows=1 loops=1)

2. 0.008 2,776.390 ↑ 252,342.0 1 1

Sort (cost=218,170.44..218,801.29 rows=252,342 width=138) (actual time=2,776.389..2,776.390 rows=1 loops=1)

  • Sort Key: "*SELECT* 1".created_at
  • Sort Method: quicksort Memory: 25kB
3. 19.753 2,776.382 ↑ 252,342.0 1 1

Hash Join (cost=50,699.84..205,596.51 rows=252,342 width=138) (actual time=629.417..2,776.382 rows=1 loops=1)

  • Hash Cond: ("*SELECT* 1".campaign_id = cam.id)
4. 195.704 2,755.001 ↑ 2.5 132,926 1

Hash Join (cost=48,175.90..200,949.17 rows=326,836 width=117) (actual time=315.209..2,755.001 rows=132,926 loops=1)

  • Hash Cond: ("*SELECT* 1".user_id = u.id)
5. 74.087 2,244.441 ↑ 1.0 773,113 1

Append (cost=0.42..150,738.78 rows=775,202 width=64) (actual time=0.025..2,244.441 rows=773,113 loops=1)

6. 100.069 2,094.436 ↑ 1.0 771,325 1

Subquery Scan on *SELECT* 1 (cost=0.42..141,454.47 rows=772,733 width=64) (actual time=0.025..2,094.436 rows=771,325 loops=1)

  • Filter: (NOT "*SELECT* 1".is_iap_processed)
  • Rows Removed by Filter: 107356
7. 741.495 1,994.367 ↓ 1.0 878,681 1

WindowAgg (cost=0.42..132,668.75 rows=878,572 width=65) (actual time=0.024..1,994.367 rows=878,681 loops=1)

8. 1,252.872 1,252.872 ↓ 1.0 878,681 1

Index Scan using user_reward_user_id_campaign_id_created_at_idx on user_reward (cost=0.42..115,097.31 rows=878,572 width=57) (actual time=0.013..1,252.872 rows=878,681 loops=1)

  • Filter: (status = 'active'::tr.status_enum)
  • Rows Removed by Filter: 555
9. 2.711 75.857 ↑ 1.4 1,773 1

Subquery Scan on *SELECT* 2 (cost=0.41..5,405.92 rows=2,453 width=64) (actual time=0.109..75.857 rows=1,773 loops=1)

  • Filter: (NOT "*SELECT* 2".is_iap_processed)
  • Rows Removed by Filter: 45316
10. 36.742 73.146 ↓ 1.0 47,089 1

WindowAgg (cost=0.41..4,935.17 rows=47,075 width=65) (actual time=0.024..73.146 rows=47,089 loops=1)

11. 36.404 36.404 ↓ 1.0 47,089 1

Index Scan using user_loto_user_id_campaign_id_created_at_idx on user_loto (cost=0.41..3,993.67 rows=47,075 width=57) (actual time=0.016..36.404 rows=47,089 loops=1)

  • Filter: (status = 'active'::tr.status_enum)
  • Rows Removed by Filter: 957
12. 0.003 0.061 ↑ 1.1 15 1

Subquery Scan on *SELECT* 3 (cost=1.72..2.37 rows=16 width=64) (actual time=0.046..0.061 rows=15 loops=1)

  • Filter: (NOT "*SELECT* 3".is_iap_processed)
  • Rows Removed by Filter: 5
13. 0.019 0.058 ↑ 1.0 20 1

WindowAgg (cost=1.72..2.17 rows=20 width=65) (actual time=0.042..0.058 rows=20 loops=1)

14. 0.020 0.039 ↑ 1.0 20 1

Sort (cost=1.72..1.77 rows=20 width=57) (actual time=0.037..0.039 rows=20 loops=1)

  • Sort Key: user_physical_reward.user_id, user_physical_reward.campaign_id, user_physical_reward.created_at
  • Sort Method: quicksort Memory: 27kB
15. 0.019 0.019 ↑ 1.0 20 1

Seq Scan on user_physical_reward (cost=0.00..1.29 rows=20 width=57) (actual time=0.011..0.019 rows=20 loops=1)

  • Filter: (status = 'active'::tr.status_enum)
  • Rows Removed by Filter: 3
16. 49.564 314.856 ↓ 1.0 166,803 1

Hash (cost=46,111.50..46,111.50 rows=165,118 width=85) (actual time=314.856..314.856 rows=166,803 loops=1)

  • Buckets: 262144 Batches: 1 Memory Usage: 22818kB
17. 265.292 265.292 ↓ 1.0 166,803 1

Seq Scan on "user" u (cost=0.00..46,111.50 rows=165,118 width=85) (actual time=0.013..265.292 rows=166,803 loops=1)

  • Filter: ((admost_id IS NOT NULL) AND (btrim(admost_id) <> ''::text))
  • Rows Removed by Filter: 226242
18. 0.177 1.628 ↓ 1.0 760 1

Hash (cost=2,514.54..2,514.54 rows=752 width=65) (actual time=1.628..1.628 rows=760 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 81kB
19. 1.451 1.451 ↓ 1.0 760 1

Index Scan using "PK_campaign" on campaign cam (cost=0.28..2,514.54 rows=752 width=65) (actual time=0.019..1.451 rows=760 loops=1)

  • Filter: ((customer_id <> 'db51c430-205f-4cec-8d5c-dc3b2610a079'::uuid) AND (type <> 'brand_cooperation'::tr.campaign_type_enum))
  • Rows Removed by Filter: 214
Planning time : 0.880 ms
Execution time : 2,776.606 ms