explain.depesz.com

PostgreSQL's explain analyze made readable

Result: E76X

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

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

2. 0.014 2,600.536 ↑ 252,342.0 1 1

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

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

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

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

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

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

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

6. 104.336 1,906.053 ↑ 1.0 771,324 1

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

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

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

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

  • Filter: (status = 'active'::tr.status_enum)
  • Rows Removed by Filter: 555
9. 2.683 73.552 ↑ 1.4 1,774 1

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

  • Filter: (NOT "*SELECT* 2".is_iap_processed)
  • Rows Removed by Filter: 45316
10. 36.694 70.869 ↓ 1.0 47,090 1

WindowAgg (cost=0.41..4,935.17 rows=47,075 width=65) (actual time=0.054..70.869 rows=47,090 loops=1)

11. 34.175 34.175 ↓ 1.0 47,090 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.039..34.175 rows=47,090 loops=1)

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

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

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

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

14. 0.043 0.076 ↑ 1.0 20 1

Sort (cost=1.72..1.77 rows=20 width=57) (actual time=0.074..0.076 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.033 0.033 ↑ 1.0 20 1

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

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

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

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

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

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

Hash (cost=2,514.54..2,514.54 rows=752 width=65) (actual time=1.688..1.688 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.54 rows=752 width=65) (actual time=0.023..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.680 ms
Execution time : 2,600.760 ms