explain.depesz.com

PostgreSQL's explain analyze made readable

Result: lNKS

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 2,532.521 ↓ 0.0 0 1

Limit (cost=218,340.29..218,341.54 rows=500 width=138) (actual time=2,532.521..2,532.521 rows=0 loops=1)

2. 0.003 2,532.520 ↓ 0.0 0 1

Sort (cost=218,340.29..218,976.54 rows=254,503 width=138) (actual time=2,532.520..2,532.520 rows=0 loops=1)

  • Sort Key: "*SELECT* 1".created_at
  • Sort Method: quicksort Memory: 25kB
3. 20.907 2,532.517 ↓ 0.0 0 1

Hash Join (cost=50,755.35..205,658.68 rows=254,503 width=138) (actual time=2,532.517..2,532.517 rows=0 loops=1)

  • Hash Cond: ("*SELECT* 1".campaign_id = cam.id)
4. 188.977 2,509.926 ↑ 2.5 132,924 1

Hash Join (cost=48,231.40..200,993.16 rows=329,635 width=117) (actual time=323.691..2,509.926 rows=132,924 loops=1)

  • Hash Cond: ("*SELECT* 1".user_id = u.id)
5. 80.558 1,997.597 ↓ 1.0 773,111 1

Append (cost=0.42..150,736.12 rows=771,824 width=64) (actual time=0.026..1,997.597 rows=773,111 loops=1)

6. 102.676 1,841.944 ↓ 1.0 771,323 1

Subquery Scan on *SELECT* 1 (cost=0.42..141,468.64 rows=769,374 width=64) (actual time=0.025..1,841.944 rows=771,323 loops=1)

  • Filter: (NOT "*SELECT* 1".is_iap_processed)
  • Rows Removed by Filter: 107354
7. 733.706 1,739.268 ↑ 1.0 878,677 1

WindowAgg (cost=0.42..132,679.48 rows=878,916 width=65) (actual time=0.024..1,739.268 rows=878,677 loops=1)

8. 1,005.562 1,005.562 ↑ 1.0 878,677 1

Index Scan using user_reward_user_id_campaign_id_created_at_idx on user_reward (cost=0.42..115,101.16 rows=878,916 width=57) (actual time=0.013..1,005.562 rows=878,677 loops=1)

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

Subquery Scan on *SELECT* 2 (cost=0.41..5,405.99 rows=2,434 width=64) (actual time=0.109..75.022 rows=1,773 loops=1)

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

WindowAgg (cost=0.41..4,935.20 rows=47,079 width=65) (actual time=0.026..72.158 rows=47,089 loops=1)

11. 35.009 35.009 ↓ 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.62 rows=47,079 width=57) (actual time=0.018..35.009 rows=47,089 loops=1)

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

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

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

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

14. 0.027 0.049 ↑ 1.0 20 1

Sort (cost=1.72..1.77 rows=20 width=57) (actual time=0.048..0.049 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.022 0.022 ↑ 1.0 20 1

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

  • Filter: (status = 'active'::tr.status_enum)
  • Rows Removed by Filter: 3
16. 45.858 323.352 ↑ 1.0 166,803 1

Hash (cost=46,132.68..46,132.68 rows=167,864 width=85) (actual time=323.351..323.352 rows=166,803 loops=1)

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

Seq Scan on "user" u (cost=0.00..46,132.68 rows=167,864 width=85) (actual time=0.010..277.494 rows=166,803 loops=1)

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

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

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

Index Scan using "PK_campaign" on campaign cam (cost=0.28..2,514.55 rows=752 width=65) (actual time=0.019..1.513 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.831 ms
Execution time : 2,532.717 ms