explain.depesz.com

PostgreSQL's explain analyze made readable

Result: KBmC

Settings
# exclusive inclusive rows x rows loops node
1. 0.205 18,105.470 ↑ 1.0 2,000 1

Limit (cost=10,294.96..10,299.96 rows=2,000 width=168) (actual time=18,105.022..18,105.470 rows=2,000 loops=1)

2. 557.233 18,105.265 ↑ 1.6 2,000 1

Sort (cost=10,294.96..10,303.18 rows=3,287 width=168) (actual time=18,105.020..18,105.265 rows=2,000 loops=1)

  • Sort Key: entry_log.entry_time DESC
  • Sort Method: top-N heapsort Memory: 757kB
3. 3,351.190 17,548.032 ↓ 316.9 1,041,656 1

Nested Loop Left Join (cost=12.70..10,102.96 rows=3,287 width=168) (actual time=1,597.584..17,548.032 rows=1,041,656 loops=1)

4. 399.791 11,071.874 ↓ 316.9 1,041,656 1

Nested Loop (cost=12.28..8,570.16 rows=3,287 width=109) (actual time=1,597.524..11,071.874 rows=1,041,656 loops=1)

5. 457.613 7,547.115 ↓ 316.9 1,041,656 1

Hash Join (cost=11.86..7,120.87 rows=3,287 width=91) (actual time=1,597.507..7,547.115 rows=1,041,656 loops=1)

  • Hash Cond: (member_plans.access_type = access_types.id)
6. 883.860 7,089.424 ↓ 105.3 1,529,163 1

Nested Loop (cost=0.85..7,071.46 rows=14,517 width=99) (actual time=0.064..7,089.424 rows=1,529,163 loops=1)

7. 384.954 1,609.504 ↓ 130.4 1,532,020 1

Nested Loop (cost=0.43..1,247.73 rows=11,747 width=63) (actual time=0.053..1,609.504 rows=1,532,020 loops=1)

8. 1.838 8.470 ↓ 144.0 144 1

Nested Loop (cost=0.00..40.88 rows=1 width=40) (actual time=0.034..8.470 rows=144 loops=1)

  • Join Filter: (gym_sections.id = gym_access_points.gym_section_id)
  • Rows Removed by Join Filter: 18,720
9. 1.728 3.226 ↓ 131.0 131 1

Nested Loop (cost=0.00..34.94 rows=1 width=30) (actual time=0.023..3.226 rows=131 loops=1)

  • Join Filter: (gym_sections.gym_id = gyms.id)
  • Rows Removed by Join Filter: 13,755
10. 0.120 0.120 ↓ 106.0 106 1

Seq Scan on gyms (cost=0.00..30.32 rows=1 width=22) (actual time=0.012..0.120 rows=106 loops=1)

  • Filter: (id = id)
11. 1.378 1.378 ↓ 1.1 131 106

Seq Scan on gym_sections (cost=0.00..3.16 rows=116 width=16) (actual time=0.002..0.013 rows=131 loops=106)

12. 3.406 3.406 ↓ 1.1 144 131

Seq Scan on gym_access_points (cost=0.00..4.31 rows=131 width=26) (actual time=0.002..0.026 rows=144 loops=131)

13. 1,216.080 1,216.080 ↑ 2.7 10,639 144

Index Scan using entry_log_gym_access_point on entry_log (cost=0.43..916.50 rows=29,035 width=39) (actual time=0.007..8.445 rows=10,639 loops=144)

  • Index Cond: (gym_access_point = gym_access_points.id)
14. 4,596.060 4,596.060 ↑ 1.0 1 1,532,020

Index Scan using member_plans_pkey on member_plans (cost=0.43..0.50 rows=1 width=52) (actual time=0.003..0.003 rows=1 loops=1,532,020)

  • Index Cond: (id = entry_log.member_plan_id)
15. 0.021 0.078 ↓ 1.2 140 1

Hash (cost=9.51..9.51 rows=120 width=8) (actual time=0.078..0.078 rows=140 loops=1)

  • Buckets: 1,024 Batches: 1 Memory Usage: 14kB
16. 0.057 0.057 ↓ 1.2 140 1

Index Scan using access_type_company_id_name on access_types (cost=0.28..9.51 rows=120 width=8) (actual time=0.014..0.057 rows=140 loops=1)

  • Index Cond: (company_id = 2)
17. 3,124.968 3,124.968 ↑ 1.0 1 1,041,656

Index Scan using members_pkey on members (cost=0.42..0.44 rows=1 width=26) (actual time=0.003..0.003 rows=1 loops=1,041,656)

  • Index Cond: (id = member_plans.member_id)
18. 3,124.968 3,124.968 ↑ 1.0 1 1,041,656

Index Scan using access_tags_pkey on access_tags (cost=0.42..0.44 rows=1 width=17) (actual time=0.003..0.003 rows=1 loops=1,041,656)

  • Index Cond: (id = entry_log.access_tag_id)
Planning time : 6.096 ms
Execution time : 18,106.154 ms