explain.depesz.com

PostgreSQL's explain analyze made readable

Result: LZJM

Settings
# exclusive inclusive rows x rows loops node
1. 0.002 2,825.350 ↓ 0.0 0 1

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

2. 0.006 2,825.348 ↓ 0.0 0 1

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

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

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

  • Hash Cond: ("*SELECT* 1".campaign_id = cam.id)
4. 206.298 2,804.262 ↑ 2.5 132,925 1

Hash Join (cost=48,175.90..200,949.17 rows=326,836 width=117) (actual time=326.319..2,804.262 rows=132,925 loops=1)

  • Hash Cond: ("*SELECT* 1".user_id = u.id)
5. 72.100 2,272.066 ↑ 1.0 773,112 1

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

6. 105.225 2,122.092 ↑ 1.0 771,324 1

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

  • Filter: (NOT "*SELECT* 1".is_iap_processed)
  • Rows Removed by Filter: 107357
7. 738.330 2,016.867 ↓ 1.0 878,681 1

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

8. 1,278.537 1,278.537 ↓ 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,278.537 rows=878,681 loops=1)

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

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

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

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

11. 38.227 38.227 ↓ 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.040..38.227 rows=47,089 loops=1)

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

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

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

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

14. 0.047 0.083 ↑ 1.0 20 1

Sort (cost=1.72..1.77 rows=20 width=57) (actual time=0.081..0.083 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.036 0.036 ↑ 1.0 20 1

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

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

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

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

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

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

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

  • Buckets: 1024 Batches: 1 Memory Usage: 81kB
19. 1.535 1.535 ↓ 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.017..1.535 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.755 ms
Execution time : 2,825.606 ms