explain.depesz.com

PostgreSQL's explain analyze made readable

Result: P07o

Settings
# exclusive inclusive rows x rows loops node
1. 0.088 1,398.215 ↑ 2.3 329 1

Finalize GroupAggregate (cost=52,458.04..52,471.32 rows=759 width=16) (actual time=1,391.923..1,398.215 rows=329 loops=1)

  • Group Key: member_plans.original_plan
2. 0.096 1,398.127 ↑ 2.3 329 1

Sort (cost=52,458.04..52,459.94 rows=759 width=16) (actual time=1,391.919..1,398.127 rows=329 loops=1)

  • Sort Key: member_plans.original_plan
  • Sort Method: quicksort Memory: 40kB
3. 6.734 1,398.031 ↑ 2.3 329 1

Gather (cost=52,338.24..52,421.73 rows=759 width=16) (actual time=1,391.737..1,398.031 rows=329 loops=1)

  • Workers Planned: 1
  • Workers Launched: 0
4. 4.700 1,391.297 ↑ 2.3 329 1

Partial HashAggregate (cost=51,338.24..51,345.83 rows=759 width=16) (actual time=1,391.225..1,391.297 rows=329 loops=1)

  • Group Key: member_plans.original_plan
5. 16.558 1,386.597 ↓ 1.6 16,244 1

Hash Join (cost=49.16..51,287.10 rows=10,228 width=16) (actual time=0.289..1,386.597 rows=16,244 loops=1)

  • Hash Cond: (plans.default_access_type = access_types.id)
6. 6.540 1,369.860 ↓ 1.6 16,244 1

Hash Join (cost=31.23..51,242.12 rows=10,228 width=24) (actual time=0.090..1,369.860 rows=16,244 loops=1)

  • Hash Cond: (member_plans.home_gym = gyms.id)
7. 40.163 1,363.255 ↑ 1.8 40,639 1

Merge Join (cost=0.71..51,012.48 rows=72,961 width=32) (actual time=0.020..1,363.255 rows=40,639 loops=1)

  • Merge Cond: (member_plans.original_plan = plans.id)
8. 1,312.245 1,312.245 ↑ 1.8 40,640 1

Parallel Index Scan using member_plans_original_plan on member_plans (cost=0.43..103,010.69 rows=72,961 width=24) (actual time=0.010..1,312.245 rows=40,640 loops=1)

  • Filter: ((renewal_of IS NULL) AND (membership_start <= CURRENT_DATE) AND ((membership_end >= CURRENT_DATE) OR autorenew_forever))
  • Rows Removed by Filter: 773,096
9. 10.847 10.847 ↓ 1.0 2,076 1

Index Scan using plans_pkey on plans (cost=0.28..81.86 rows=2,063 width=16) (actual time=0.007..10.847 rows=2,076 loops=1)

10. 0.003 0.065 ↑ 1.0 15 1

Hash (cost=30.34..30.34 rows=15 width=8) (actual time=0.065..0.065 rows=15 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 9kB
11. 0.062 0.062 ↑ 1.0 15 1

Seq Scan on gyms (cost=0.00..30.34 rows=15 width=8) (actual time=0.019..0.062 rows=15 loops=1)

  • Filter: (company_id = 2)
  • Rows Removed by Filter: 92
12. 0.083 0.179 ↓ 1.1 565 1

Hash (cost=11.30..11.30 rows=530 width=8) (actual time=0.179..0.179 rows=565 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 31kB
13. 0.096 0.096 ↓ 1.1 565 1

Seq Scan on access_types (cost=0.00..11.30 rows=530 width=8) (actual time=0.006..0.096 rows=565 loops=1)

Planning time : 0.852 ms
Execution time : 1,398.351 ms