explain.depesz.com

PostgreSQL's explain analyze made readable

Result: Q62P

Settings
# exclusive inclusive rows x rows loops node
1. 0.008 18.813 ↑ 1.0 1 1

Result (cost=603.04..603.05 rows=1 width=41) (actual time=18.813..18.813 rows=1 loops=1)

2.          

CTE __local_0__

3. 0.009 16.976 ↑ 1.0 1 1

Limit (cost=246.22..421.19 rows=1 width=89) (actual time=16.968..16.976 rows=1 loops=1)

4. 0.051 16.967 ↑ 6,454.0 1 1

Result (cost=246.22..1,129,527.48 rows=6,454 width=89) (actual time=16.967..16.967 rows=1 loops=1)

5. 2.126 16.047 ↑ 6,454.0 1 1

Sort (cost=246.22..262.35 rows=6,454 width=225) (actual time=16.047..16.047 rows=1 loops=1)

  • Sort Key: __local_1__.job_position_type, __local_1__.id
  • Sort Method: top-N heapsort Memory: 26kB
6. 13.921 13.921 ↑ 1.0 6,454 1

Seq Scan on employee __local_1__ (cost=0.00..213.95 rows=6,454 width=225) (actual time=0.024..13.921 rows=6,454 loops=1)

  • Filter: (is_archived IS FALSE)
7.          

SubPlan (forResult)

8. 0.499 0.499 ↑ 1.0 1 1

Function Scan on employee_full_name __local_2__ (cost=0.25..0.26 rows=1 width=32) (actual time=0.499..0.499 rows=1 loops=1)

9. 0.005 0.233 ↑ 1.0 1 1

Result (cost=149.67..149.68 rows=1 width=32) (actual time=0.233..0.233 rows=1 loops=1)

10.          

CTE __local_3__

11. 0.015 0.202 ↑ 2.5 2 1

Sort (cost=149.50..149.51 rows=5 width=48) (actual time=0.202..0.202 rows=2 loops=1)

  • Sort Key: __local_4__.id
  • Sort Method: quicksort Memory: 26kB
12. 0.028 0.187 ↑ 2.5 2 1

Bitmap Heap Scan on form_field_entry __local_4__ (cost=4.32..149.44 rows=5 width=48) (actual time=0.137..0.187 rows=2 loops=1)

  • Recheck Cond: (employee_id = __local_1__.id)
  • Heap Blocks: exact=2
13. 0.015 0.015 ↑ 2.5 2 1

Bitmap Index Scan on form_field_entry_employee_id_index (cost=0.00..4.32 rows=5 width=0) (actual time=0.015..0.015 rows=2 loops=1)

  • Index Cond: (employee_id = __local_1__.id)
14.          

SubPlan (forBitmap Heap Scan)

15. 0.058 0.144 ↑ 1.0 1 2

Seq Scan on form_field __local_5__ (cost=0.00..25.75 rows=1 width=32) (actual time=0.064..0.072 rows=1 loops=2)

  • Filter: (__local_4__.form_field_id = id)
  • Rows Removed by Filter: 178
16.          

SubPlan (forSeq Scan)

17. 0.006 0.030 ↑ 1.0 1 2

Result (cost=14.71..14.72 rows=1 width=32) (actual time=0.015..0.015 rows=1 loops=2)

18.          

CTE __local_6__

19. 0.010 0.016 ↓ 0.0 0 2

Sort (cost=14.48..14.50 rows=7 width=64) (actual time=0.008..0.008 rows=0 loops=2)

  • Sort Key: __local_7__.group_id
  • Sort Method: quicksort Memory: 25kB
20. 0.004 0.006 ↓ 0.0 0 2

Bitmap Heap Scan on form_field_group_read __local_7__ (cost=4.21..14.39 rows=7 width=64) (actual time=0.003..0.003 rows=0 loops=2)

  • Recheck Cond: (form_field_id = __local_5__.id)
21. 0.002 0.002 ↓ 0.0 0 2

Bitmap Index Scan on form_field_group_read_form_field_id_index (cost=0.00..4.21 rows=7 width=0) (actual time=0.001..0.001 rows=0 loops=2)

  • Index Cond: (form_field_id = __local_5__.id)
22.          

CTE __local_8__

23. 0.002 0.020 ↑ 1.0 1 2

Aggregate (cost=0.18..0.19 rows=1 width=32) (actual time=0.010..0.010 rows=1 loops=2)

24. 0.018 0.018 ↓ 0.0 0 2

CTE Scan on __local_6__ (cost=0.00..0.14 rows=7 width=24) (actual time=0.009..0.009 rows=0 loops=2)

25.          

Initplan (forResult)

26. 0.024 0.024 ↑ 1.0 1 2

CTE Scan on __local_8__ (cost=0.00..0.02 rows=1 width=32) (actual time=0.011..0.012 rows=1 loops=2)

27. 0.004 0.056 ↑ 1.0 1 2

Result (cost=5.78..5.79 rows=1 width=32) (actual time=0.028..0.028 rows=1 loops=2)

28.          

CTE __local_9__

29. 0.006 0.046 ↓ 0.0 0 2

Sort (cost=5.63..5.64 rows=4 width=48) (actual time=0.023..0.023 rows=0 loops=2)

  • Sort Key: __local_10__.id
  • Sort Method: quicksort Memory: 25kB
30. 0.040 0.040 ↓ 0.0 0 2

Seq Scan on form_field_option __local_10__ (cost=0.00..5.59 rows=4 width=48) (actual time=0.020..0.020 rows=0 loops=2)

  • Filter: (form_field_id = __local_5__.id)
  • Rows Removed by Filter: 206
31.          

CTE __local_11__

32. 0.000 0.048 ↑ 1.0 1 2

Aggregate (cost=0.10..0.11 rows=1 width=32) (actual time=0.024..0.024 rows=1 loops=2)

33. 0.048 0.048 ↓ 0.0 0 2

CTE Scan on __local_9__ (cost=0.00..0.08 rows=4 width=24) (actual time=0.024..0.024 rows=0 loops=2)

34.          

Initplan (forResult)

35. 0.052 0.052 ↑ 1.0 1 2

CTE Scan on __local_11__ (cost=0.00..0.02 rows=1 width=32) (actual time=0.025..0.026 rows=1 loops=2)

36.          

CTE __local_12__

37. 0.013 0.225 ↑ 1.0 1 1

Aggregate (cost=0.13..0.14 rows=1 width=32) (actual time=0.225..0.225 rows=1 loops=1)

38. 0.212 0.212 ↑ 2.5 2 1

CTE Scan on __local_3__ (cost=0.00..0.10 rows=5 width=24) (actual time=0.210..0.212 rows=2 loops=1)

39.          

Initplan (forResult)

40. 0.228 0.228 ↑ 1.0 1 1

CTE Scan on __local_12__ (cost=0.00..0.02 rows=1 width=32) (actual time=0.228..0.228 rows=1 loops=1)

41. 0.041 0.137 ↑ 1.0 1 1

Index Scan using user_pkey on "user" __local_14__ (cost=0.28..25.00 rows=1 width=32) (actual time=0.137..0.137 rows=1 loops=1)

  • Index Cond: (__local_1__.user_id = id)
42.          

SubPlan (forIndex Scan)

43. 0.008 0.008 ↑ 1.0 1 1

Function Scan on __local_13__ (cost=0.01..0.02 rows=1 width=32) (actual time=0.008..0.008 rows=1 loops=1)

44. 0.003 0.088 ↑ 1.0 1 1

Result (cost=16.66..16.68 rows=1 width=32) (actual time=0.088..0.088 rows=1 loops=1)

45.          

CTE __local_15__

46. 0.030 0.073 ↑ 1.0 1 1

Index Only Scan using user_department_pkey on user_department __local_17__ (cost=0.28..16.61 rows=1 width=64) (actual time=0.073..0.073 rows=1 loops=1)

  • Index Cond: (user_id = __local_14__.id)
  • Heap Fetches: 1
47.          

SubPlan (forIndex Only Scan)

48. 0.043 0.043 ↑ 1.0 1 1

Index Scan using department_pkey on department __local_16__ (cost=0.28..8.30 rows=1 width=32) (actual time=0.043..0.043 rows=1 loops=1)

  • Index Cond: (__local_17__.department_id = id)
49.          

CTE __local_18__

50. 0.005 0.083 ↑ 1.0 1 1

Aggregate (cost=0.03..0.04 rows=1 width=32) (actual time=0.083..0.083 rows=1 loops=1)

51. 0.078 0.078 ↑ 1.0 1 1

CTE Scan on __local_15__ (cost=0.00..0.02 rows=1 width=24) (actual time=0.078..0.078 rows=1 loops=1)

52.          

Initplan (forResult)

53. 0.085 0.085 ↑ 1.0 1 1

CTE Scan on __local_18__ (cost=0.00..0.02 rows=1 width=32) (actual time=0.085..0.085 rows=1 loops=1)

54.          

CTE __local_19__

55. 0.010 16.993 ↑ 1.0 1 1

Aggregate (cost=0.03..0.04 rows=1 width=32) (actual time=16.993..16.993 rows=1 loops=1)

56. 16.983 16.983 ↑ 1.0 1 1

CTE Scan on __local_0__ (cost=0.00..0.02 rows=1 width=24) (actual time=16.974..16.983 rows=1 loops=1)

57.          

Initplan (forResult)

58. 16.997 16.997 ↑ 1.0 1 1

CTE Scan on __local_19__ (cost=0.00..0.02 rows=1 width=32) (actual time=16.996..16.997 rows=1 loops=1)

59. 0.024 0.026 ↑ 3,227.0 1 1

Seq Scan on employee __local_1___1 (cost=0.03..246.24 rows=3,227 width=0) (actual time=0.026..0.026 rows=1 loops=1)

  • Filter: ((is_archived IS FALSE) AND (NOT (hashed SubPlan 25)))
60.          

SubPlan (forSeq Scan)

61. 0.002 0.002 ↑ 1.0 1 1

CTE Scan on __local_0__ __local_0___1 (cost=0.00..0.03 rows=1 width=32) (actual time=0.002..0.002 rows=1 loops=1)

62. 0.610 1.782 ↑ 1.0 1 1

Aggregate (cost=181.68..181.69 rows=1 width=8) (actual time=1.782..1.782 rows=1 loops=1)

63. 1.172 1.172 ↑ 1.0 6,454 1

Seq Scan on employee __local_1___2 (cost=0.00..165.54 rows=6,454 width=0) (actual time=0.003..1.172 rows=6,454 loops=1)

  • Filter: (is_archived IS FALSE)