# Result: 5KhA

Settings

### Optimization(s) for this plan:

# exclusive inclusive rows x rows loops node
1. 4.347 3,911.834 ↓ 20.0 20 1

(cost=10,982.02..45,979.50 rows=1 width=54) (actual time=3,705.462..3,911.834 rows=20 loops=1)

2. 0.526 3,907.487 ↓ 20.0 20 1

(cost=10,982.02..45,979.50 rows=1 width=54) (actual time=3,705.462..3,907.487 rows=20 loops=1)

• Join Filter: ((employee.id = title.employee_id) AND ((SubPlan 1) = title.from_date))
• Rows Removed by Join Filter: 468
3. 0.000 3,710.937 ↓ 654.0 654 1

(cost=10,981.60..45,966.14 rows=1 width=51) (actual time=3,704.260..3,710.937 rows=654 loops=1)

• Hash Cond: ((salary.employee_id = employee.id) AND (salary.from_date = (SubPlan 3)))
4. 0.000 5.867 ↑ 3.4 2,464 1

Gather (cost=1,000.00..34,770.14 rows=8,424 width=20) (actual time=0.621..5.867 rows=2,464 loops=1)

• Workers Planned: 2
• Workers Launched: 2
5. 70.492 70.492 ↑ 2.4 1,436 3 / 3

Parallel Seq Scan on salary (cost=0.00..32,927.74 rows=3,510 width=20) (actual time=0.302..70.492 rows=1,436 loops=3)

• Filter: (amount >= 120,000)
• Rows Removed by Filter: 480,838
6. 3,642.095 3,701.075 ↑ 1.0 300,024 1

(cost=5,481.24..5,481.24 rows=300,024 width=35) (actual time=3,701.075..3,701.075 rows=300,024 loops=1)

• Buckets: 524,288 Batches: 1 Memory Usage: 24,275kB
7. 58.980 58.980 ↑ 1.0 300,024 1

Seq Scan on employee (cost=0.00..5,481.24 rows=300,024 width=35) (actual time=0.009..58.980 rows=300,024 loops=1)

8.

SubPlan (for Hash Join)

9. 0.000 3,307.458 ↑ 1.0 1 300,678

(cost=2.77..2.78 rows=1 width=4) (actual time=0.011..0.011 rows=1 loops=300,678)

10.

Initplan (for Result)

11. 300.678 3,307.458 ↑ 1.0 1 300,678

(cost=0.43..2.77 rows=1 width=4) (actual time=0.010..0.011 rows=1 loops=300,678)

12. 3,006.780 3,006.780 ↑ 11.0 1 300,678

Index Only Scan Backward using idx_16991_primary on salary salary_1 (cost=0.43..26.15 rows=11 width=4) (actual time=0.010..0.010 rows=1 loops=300,678)

• Index Cond: ((employee_id = employee.id) AND (from_date IS NOT NULL))
• Heap Fetches: 300,678
13. 193.584 193.584 ↑ 1.0 1 654

Index Only Scan using idx_16994_primary on title (cost=0.42..3.12 rows=1 width=23) (actual time=0.296..0.296 rows=1 loops=654)

• Index Cond: ((employee_id = salary.employee_id) AND (title = 'Staff'::text))
• Heap Fetches: 488
14.

SubPlan (for Nested Loop)

15. 0.976 2.440 ↑ 1.0 1 488

Aggregate (cost=10.21..10.22 rows=1 width=4) (actual time=0.005..0.005 rows=1 loops=488)

16. 1.464 1.464 ↑ 1.0 2 488

Index Only Scan using idx_16994_primary on title title_1 (cost=0.42..10.21 rows=2 width=4) (actual time=0.003..0.003 rows=2 loops=488)

• Index Cond: (employee_id = employee.id)
• Heap Fetches: 956
Planning time Execution time : 18.360 ms : 3,915.326 ms