explain.depesz.com

PostgreSQL's explain analyze made readable

Result: bamT

Settings
# exclusive inclusive rows x rows loops node
1. 0.008 14.012 ↑ 137.0 1 1

Nested Loop (cost=3,914.12..3,918.59 rows=137 width=8) (actual time=14.011..14.012 rows=1 loops=1)

  • Planning time: 0.692 ms
  • Execution time: 14.111 ms
2.          

CTE tc

3. 0.043 0.973 ↑ 137.0 1 1

GroupAggregate (cost=11.37..1,378.76 rows=137 width=12) (actual time=0.973..0.973 rows=1 loops=1)

  • Group Key: tasks.contractor_id
4. 0.841 0.930 ↓ 2.2 348 1

Bitmap Heap Scan on tasks (cost=11.37..1,376.58 rows=161 width=4) (actual time=0.154..0.930 rows=348 loops=1)

  • Recheck Cond: (contractor_id = 6701)
  • Filter: ((state)::text = 'completed'::text)
  • Rows Removed by Filter: 33
  • Heap Blocks: exact=467
5. 0.089 0.089 ↓ 1.2 495 1

Bitmap Index Scan on index_tasks_on_contractor_id (cost=0.00..11.33 rows=405 width=0) (actual time=0.089..0.089 rows=495 loops=1)

  • Index Cond: (contractor_id = 6701)
6.          

CTE stc

7. 0.053 13.025 ↑ 1.0 1 1

Aggregate (cost=2,535.35..2,535.36 rows=1 width=8) (actual time=13.025..13.025 rows=1 loops=1)

8. 2.160 12.972 ↑ 1.5 646 1

Hash Semi Join (cost=1,380.70..2,532.95 rows=962 width=0) (actual time=3.784..12.972 rows=646 loops=1)

  • Hash Cond: (sub_tasks.task_id = tasks_1.id)
9. 7.084 7.084 ↑ 1.0 20,357 1

Seq Scan on sub_tasks (cost=0.00..1,087.78 rows=20,486 width=4) (actual time=0.012..7.084 rows=20,357 loops=1)

  • Filter: ((state)::text = 'completed'::text)
  • Rows Removed by Filter: 3525
10. 0.123 3.728 ↑ 1.1 381 1

Hash (cost=1,375.63..1,375.63 rows=405 width=4) (actual time=3.728..3.728 rows=381 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 22kB
11. 3.485 3.605 ↑ 1.1 381 1

Bitmap Heap Scan on tasks tasks_1 (cost=11.43..1,375.63 rows=405 width=4) (actual time=0.193..3.605 rows=381 loops=1)

  • Recheck Cond: (contractor_id = 6701)
  • Heap Blocks: exact=467
12. 0.120 0.120 ↓ 1.2 495 1

Bitmap Index Scan on index_tasks_on_contractor_id (cost=0.00..11.33 rows=405 width=0) (actual time=0.120..0.120 rows=495 loops=1)

  • Index Cond: (contractor_id = 6701)
13. 13.029 13.029 ↑ 1.0 1 1

CTE Scan on stc (cost=0.00..0.02 rows=1 width=8) (actual time=13.029..13.029 rows=1 loops=1)

14. 0.975 0.975 ↑ 137.0 1 1

CTE Scan on tc (cost=0.00..2.74 rows=137 width=8) (actual time=0.975..0.975 rows=1 loops=1)