explain.depesz.com

PostgreSQL's explain analyze made readable

Result: vhyG

Settings
# exclusive inclusive rows x rows loops node
1. 0.078 0.734 ↓ 11.0 11 1

Hash Join (cost=18.62..30.16 rows=1 width=8) (actual time=0.205..0.734 rows=11 loops=1)

  • Hash Cond: ((modules.id = training_records.module_id) AND ((SubPlan 1) = training_records.id))
  • Join Filter: ((modules.never_expires IS TRUE) OR (modules.expiration_months = 0) OR (((training_records.created_at)::date + (((modules.expiration_months)::text || ' months'::text))::interval) > CURRENT_DATE))
  • Rows Removed by Join Filter: 8
2. 0.020 0.020 ↓ 2.0 24 1

Seq Scan on modules (cost=0.00..2.24 rows=12 width=9) (actual time=0.011..0.020 rows=24 loops=1)

  • Filter: (active IS TRUE)
3. 0.009 0.034 ↑ 1.0 38 1

Hash (cost=18.05..18.05 rows=38 width=16) (actual time=0.034..0.034 rows=38 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
4. 0.012 0.025 ↑ 1.0 38 1

Bitmap Heap Scan on training_records (cost=4.57..18.05 rows=38 width=16) (actual time=0.017..0.025 rows=38 loops=1)

  • Recheck Cond: (user_id = 769)
  • Heap Blocks: exact=2
5. 0.013 0.013 ↑ 1.0 38 1

Bitmap Index Scan on training_records_user_id_index (cost=0.00..4.56 rows=38 width=0) (actual time=0.013..0.013 rows=38 loops=1)

  • Index Cond: (user_id = 769)
6.          

SubPlan (for Hash Join)

7. 0.086 0.602 ↑ 1.0 1 43

Aggregate (cost=15.38..15.39 rows=1 width=4) (actual time=0.014..0.014 rows=1 loops=43)

8. 0.043 0.516 ↓ 2.0 2 43

Bitmap Heap Scan on training_records training_records_1 (cost=9.71..15.38 rows=1 width=4) (actual time=0.012..0.012 rows=2 loops=43)

  • Recheck Cond: ((user_id = 769) AND (module_id = modules.id))
  • Filter: (deleted_at IS NULL)
  • Heap Blocks: exact=76
9. 0.043 0.473 ↓ 0.0 0 43

BitmapAnd (cost=9.71..9.71 rows=2 width=0) (actual time=0.011..0.011 rows=0 loops=43)

10. 0.129 0.129 ↑ 1.0 38 43

Bitmap Index Scan on training_records_user_id_index (cost=0.00..4.56 rows=38 width=0) (actual time=0.003..0.003 rows=38 loops=43)

  • Index Cond: (user_id = 769)
11. 0.301 0.301 ↓ 1.1 89 43

Bitmap Index Scan on training_records_module_id_index (cost=0.00..4.89 rows=82 width=0) (actual time=0.007..0.007 rows=89 loops=43)

  • Index Cond: (module_id = modules.id)
Planning time : 0.379 ms
Execution time : 0.800 ms