explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bJEy

Settings
# exclusive inclusive rows x rows loops node
1. 0.001 2,569.164 ↑ 500.0 1 1

Limit (cost=218,218.98..218,220.23 rows=500 width=138) (actual time=2,569.164..2,569.164 rows=1 loops=1)

2. 0.015 2,569.163 ↑ 253,874.0 1 1

Sort (cost=218,218.98..218,853.66 rows=253,874 width=138) (actual time=2,569.163..2,569.163 rows=1 loops=1)

  • Sort Key: "*SELECT* 1".created_at
  • Sort Method: quicksort Memory: 25kB
3. 20.000 2,569.148 ↑ 253,874.0 1 1

Hash Join (cost=50,766.69..205,568.71 rows=253,874 width=138) (actual time=2,543.923..2,569.148 rows=1 loops=1)

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

Hash Join (cost=48,242.74..200,908.48 rows=328,821 width=117) (actual time=329.078..2,547.495 rows=132,926 loops=1)

  • Hash Cond: ("*SELECT* 1".user_id = u.id)
5. 74.514 2,021.802 ↓ 1.0 773,113 1

Append (cost=0.42..150,643.07 rows=770,695 width=64) (actual time=0.023..2,021.802 rows=773,113 loops=1)

6. 98.950 1,874.091 ↓ 1.0 771,324 1

Subquery Scan on *SELECT* 1 (cost=0.42..141,380.29 rows=768,283 width=64) (actual time=0.022..1,874.091 rows=771,324 loops=1)

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

WindowAgg (cost=0.42..132,610.94 rows=876,935 width=65) (actual time=0.021..1,775.141 rows=878,681 loops=1)

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

Index Scan using user_reward_user_id_campaign_id_created_at_idx on user_reward (cost=0.42..115,072.24 rows=876,935 width=57) (actual time=0.012..1,037.281 rows=878,681 loops=1)

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

Subquery Scan on *SELECT* 2 (cost=0.41..5,406.93 rows=2,396 width=64) (actual time=0.144..73.089 rows=1,774 loops=1)

  • Filter: (NOT "*SELECT* 2".is_iap_processed)
  • Rows Removed by Filter: 45316
10. 36.416 70.204 ↑ 1.0 47,090 1

WindowAgg (cost=0.41..4,935.85 rows=47,108 width=65) (actual time=0.054..70.204 rows=47,090 loops=1)

11. 33.788 33.788 ↑ 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.69 rows=47,108 width=57) (actual time=0.040..33.788 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.031 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.038 0.072 ↑ 1.0 20 1

Sort (cost=1.72..1.77 rows=20 width=57) (actual time=0.070..0.072 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.034 0.034 ↑ 1.0 20 1

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

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

Hash (cost=46,142.60..46,142.60 rows=167,977 width=85) (actual time=328.700..328.701 rows=166,803 loops=1)

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

Seq Scan on "user" u (cost=0.00..46,142.60 rows=167,977 width=85) (actual time=0.012..276.935 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.653 ↓ 1.0 760 1

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

  • Buckets: 1024 Batches: 1 Memory Usage: 81kB
19. 1.479 1.479 ↓ 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.015..1.479 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 : 1.593 ms
Execution time : 2,569.415 ms