explain.depesz.com

PostgreSQL's explain analyze made readable

Result: AkK3

Settings
# exclusive inclusive rows x rows loops node
1. 51.325 11,862.917 ↓ 1.5 6,415 1

HashAggregate (cost=907,364.28..907,407.36 rows=4,308 width=16) (actual time=11,861.176..11,862.917 rows=6,415 loops=1)

  • Group Key: ts.employee_id, hr_weekly_report_activity_type.id
2. 10.643 11,811.592 ↓ 3.5 148,918 1

Append (cost=14.42..906,610.50 rows=43,073 width=19) (actual time=0.162..11,811.592 rows=148,918 loops=1)

3. 47.947 1,741.790 ↓ 3.7 139,385 1

Nested Loop (cost=14.42..209,902.58 rows=37,277 width=20) (actual time=0.162..1,741.790 rows=139,385 loops=1)

4. 996.105 1,392.165 ↓ 2.7 150,839 1

Hash Join (cost=13.99..183,898.97 rows=55,076 width=20) (actual time=0.146..1,392.165 rows=150,839 loops=1)

  • Hash Cond: (aal.product_id = COALESCE(hr_weekly_report_activity_type.second_timesheet_product_id, hr_weekly_report_activity_type.default_product_id))
5. 395.941 395.941 ↑ 1.0 5,334,429 1

Seq Scan on account_analytic_line aal (cost=0.00..162,376.98 rows=5,588,598 width=20) (actual time=0.003..395.941 rows=5,334,429 loops=1)

6. 0.023 0.119 ↑ 1.1 33 1

Hash (cost=13.55..13.55 rows=35 width=12) (actual time=0.119..0.119 rows=33 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 10kB
7. 0.096 0.096 ↑ 1.0 35 1

Seq Scan on hr_weekly_report_activity_type (cost=0.00..13.55 rows=35 width=12) (actual time=0.021..0.096 rows=35 loops=1)

  • Filter: ((line_type)::text = 'absence'::text)
  • Rows Removed by Filter: 91
8. 301.678 301.678 ↑ 1.0 1 150,839

Index Scan using idx_timesheet_line_id on hr_analytic_timesheet ts (cost=0.43..0.46 rows=1 width=8) (actual time=0.002..0.002 rows=1 loops=150,839)

  • Index Cond: (line_id = aal.id)
9. 1.478 5,016.652 ↓ 1.6 4,760 1

Subquery Scan on *SELECT* 2 (cost=347,890.27..348,167.38 rows=2,890 width=12) (actual time=5,012.543..5,016.652 rows=4,760 loops=1)

10. 0.000 5,015.174 ↓ 1.6 4,760 1

Hash Join (cost=347,890.27..348,138.48 rows=2,890 width=12) (actual time=5,012.531..5,015.174 rows=4,760 loops=1)

  • Hash Cond: (ard.absence_request_id = ar.id)
11.          

Initplan (forHash Join)

12. 287.431 5,011.565 ↑ 1.0 1 1

Aggregate (cost=347,791.80..347,791.81 rows=1 width=4) (actual time=5,011.565..5,011.565 rows=1 loops=1)

13. 1,918.588 4,724.134 ↑ 1.0 3,647,565 1

Merge Join (cost=118.49..338,335.41 rows=3,782,558 width=4) (actual time=0.036..4,724.134 rows=3,647,565 loops=1)

  • Merge Cond: (ts_2.line_id = aal_2.id)
14. 573.725 573.725 ↑ 1.0 3,647,565 1

Index Only Scan using idx_timesheet_line_id on hr_analytic_timesheet ts_2 (cost=0.43..70,679.26 rows=3,782,558 width=4) (actual time=0.018..573.725 rows=3,647,565 loops=1)

  • Heap Fetches: 382363
15. 2,231.821 2,231.821 ↑ 1.0 5,334,427 1

Index Scan using account_analytic_line_pkey on account_analytic_line aal_2 (cost=0.43..206,704.89 rows=5,588,598 width=8) (actual time=0.010..2,231.821 rows=5,334,427 loops=1)

16. 5,013.111 5,013.111 ↓ 1.6 4,760 1

Seq Scan on cesbron_absence_request_date ard (cost=0.00..208.48 rows=2,890 width=12) (actual time=5,011.596..5,013.111 rows=4,760 loops=1)

  • Filter: (morning AND (date > $1))
  • Rows Removed by Filter: 4075
17. 0.345 0.865 ↓ 1.0 2,311 1

Hash (cost=69.87..69.87 rows=2,287 width=8) (actual time=0.865..0.865 rows=2,311 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 123kB
18. 0.520 0.520 ↓ 1.0 2,311 1

Seq Scan on cesbron_absence_request ar (cost=0.00..69.87 rows=2,287 width=8) (actual time=0.007..0.520 rows=2,311 loops=1)

19. 2.514 5,042.507 ↓ 1.6 4,773 1

Subquery Scan on *SELECT* 3 (cost=347,890.27..348,167.76 rows=2,906 width=12) (actual time=5,034.416..5,042.507 rows=4,773 loops=1)

20. 0.000 5,039.993 ↓ 1.6 4,773 1

Hash Join (cost=347,890.27..348,138.70 rows=2,906 width=12) (actual time=5,034.400..5,039.993 rows=4,773 loops=1)

  • Hash Cond: (ard_1.absence_request_id = ar_1.id)
21.          

Initplan (forHash Join)

22. 298.353 5,032.410 ↑ 1.0 1 1

Aggregate (cost=347,791.80..347,791.81 rows=1 width=4) (actual time=5,032.410..5,032.410 rows=1 loops=1)

23. 1,917.730 4,734.057 ↑ 1.0 3,647,565 1

Merge Join (cost=118.49..338,335.41 rows=3,782,558 width=4) (actual time=0.045..4,734.057 rows=3,647,565 loops=1)

  • Merge Cond: (ts_1.line_id = aal_1.id)
24. 597.079 597.079 ↑ 1.0 3,647,565 1

Index Only Scan using idx_timesheet_line_id on hr_analytic_timesheet ts_1 (cost=0.43..70,679.26 rows=3,782,558 width=4) (actual time=0.024..597.079 rows=3,647,565 loops=1)

  • Heap Fetches: 382363
25. 2,219.248 2,219.248 ↑ 1.0 5,334,427 1

Index Scan using account_analytic_line_pkey on account_analytic_line aal_1 (cost=0.43..206,704.89 rows=5,588,598 width=8) (actual time=0.011..2,219.248 rows=5,334,427 loops=1)

26. 5,036.096 5,036.096 ↓ 1.6 4,773 1

Seq Scan on cesbron_absence_request_date ard_1 (cost=0.00..208.48 rows=2,906 width=12) (actual time=5,032.527..5,036.096 rows=4,773 loops=1)

  • Filter: (afternoon AND (date > $0))
  • Rows Removed by Filter: 4062
27. 0.702 1.775 ↓ 1.0 2,311 1

Hash (cost=69.87..69.87 rows=2,287 width=8) (actual time=1.775..1.775 rows=2,311 loops=1)

  • Buckets: 4096 Batches: 1 Memory Usage: 123kB
28. 1.073 1.073 ↓ 1.0 2,311 1

Seq Scan on cesbron_absence_request ar_1 (cost=0.00..69.87 rows=2,287 width=8) (actual time=0.017..1.073 rows=2,311 loops=1)