explain.depesz.com

PostgreSQL's explain analyze made readable

Result: emS4

Settings
# exclusive inclusive rows x rows loops node
1. 0.006 718.284 ↑ 1.0 4 1

Append (cost=43,403.38..47,119.39 rows=4 width=32) (actual time=8.108..718.284 rows=4 loops=1)

2.          

CTE us

3. 0.560 0.560 ↑ 1.0 1 1

Index Scan using users_pkey on users u (cost=0.14..3.17 rows=1 width=252) (actual time=0.559..0.560 rows=1 loops=1)

  • Index Cond: (id = 1)
4.          

CTE current

5. 1.149 1.149 ↑ 1.0 1 1

CTE Scan on us us_1 (cost=0.00..0.27 rows=1 width=4) (actual time=1.147..1.149 rows=1 loops=1)

6.          

CTE scb

7. 0.379 0.379 ↓ 0.0 0 1

CTE Scan on us us_2 (cost=0.00..0.53 rows=100 width=36) (actual time=0.379..0.379 rows=0 loops=1)

8.          

CTE p

9. 0.066 0.066 ↑ 1.0 1 1

Seq Scan on perspectives p (cost=0.00..1.20 rows=1 width=54) (actual time=0.065..0.066 rows=1 loops=1)

  • Filter: (id = 5)
  • Rows Removed by Filter: 19
10.          

CTE s1t

11. 0.071 0.114 ↑ 7.1 14 1

Nested Loop (cost=0.00..4.58 rows=100 width=4) (actual time=0.067..0.114 rows=14 loops=1)

  • Join Filter: (p_1.tags @> ARRAY[ut.id])
  • Rows Removed by Join Filter: 46
12. 0.001 0.001 ↑ 1.0 1 1

CTE Scan on p p_1 (cost=0.00..0.02 rows=1 width=32) (actual time=0.000..0.001 rows=1 loops=1)

13. 0.042 0.042 ↑ 1.0 47 1

Seq Scan on task_user_tags ut (cost=0.00..3.47 rows=47 width=108) (actual time=0.021..0.042 rows=47 loops=1)

14.          

CTE s1a

15. 0.004 1.183 ↑ 4.2 12 1

Limit (cost=2.54..6.91 rows=51 width=34) (actual time=0.856..1.183 rows=12 loops=1)

16. 0.015 1.179 ↑ 4.2 12 1

Nested Loop (cost=2.54..6.91 rows=51 width=34) (actual time=0.854..1.179 rows=12 loops=1)

17. 0.004 0.772 ↓ 14.0 14 1

Nested Loop (cost=2.25..4.30 rows=1 width=4) (actual time=0.762..0.772 rows=14 loops=1)

18. 0.004 0.633 ↑ 1.0 1 1

Nested Loop (cost=0.00..0.05 rows=1 width=0) (actual time=0.631..0.633 rows=1 loops=1)

19. 0.563 0.563 ↑ 1.0 1 1

CTE Scan on us us_3 (cost=0.00..0.02 rows=1 width=0) (actual time=0.562..0.563 rows=1 loops=1)

20. 0.066 0.066 ↑ 1.0 1 1

CTE Scan on p p_2 (cost=0.00..0.02 rows=1 width=0) (actual time=0.066..0.066 rows=1 loops=1)

21. 0.014 0.135 ↑ 7.1 14 1

HashAggregate (cost=2.25..3.25 rows=100 width=4) (actual time=0.130..0.135 rows=14 loops=1)

  • Group Key: s1t.tasks_id
22. 0.121 0.121 ↑ 7.1 14 1

CTE Scan on s1t (cost=0.00..2.00 rows=100 width=4) (actual time=0.068..0.121 rows=14 loops=1)

23. 0.392 0.392 ↑ 1.0 1 14

Index Scan using dev_pkey on task t_1 (cost=0.29..2.60 rows=1 width=34) (actual time=0.027..0.028 rows=1 loops=14)

  • Index Cond: (id = s1t.tasks_id)
  • Filter: ((NOT draft) AND (schedule_id IS NULL) AND (user_id = 1))
  • Rows Removed by Filter: 0
24.          

CTE s11

25. 0.029 1.131 ↑ 245.3 21 1

Recursive Union (cost=1.66..8,135.76 rows=5,151 width=53) (actual time=0.176..1.131 rows=21 loops=1)

26. 0.006 0.990 ↑ 4.2 12 1

Nested Loop (cost=1.66..58.74 rows=51 width=53) (actual time=0.173..0.990 rows=12 loops=1)

27. 0.002 0.002 ↑ 1.0 1 1

CTE Scan on p p_3 (cost=0.00..0.02 rows=1 width=0) (actual time=0.002..0.002 rows=1 loops=1)

28. 0.187 0.982 ↑ 4.2 12 1

Hash Join (cost=1.66..58.21 rows=51 width=45) (actual time=0.168..0.982 rows=12 loops=1)

  • Hash Cond: (tf.id = t_2.folder_id)
29. 0.783 0.783 ↑ 1.0 1,228 1

Seq Scan on task_folders tf (cost=0.00..51.50 rows=1,260 width=4) (actual time=0.034..0.783 rows=1,228 loops=1)

  • Filter: (path @> '{303}'::integer[])
  • Rows Removed by Filter: 748
30. 0.008 0.012 ↑ 4.2 12 1

Hash (cost=1.02..1.02 rows=51 width=49) (actual time=0.012..0.012 rows=12 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
31. 0.004 0.004 ↑ 4.2 12 1

CTE Scan on s1a t_2 (cost=0.00..1.02 rows=51 width=49) (actual time=0.001..0.004 rows=12 loops=1)

32. 0.024 0.112 ↑ 255.0 2 4

Nested Loop (cost=0.29..797.40 rows=510 width=53) (actual time=0.012..0.028 rows=2 loops=4)

33. 0.004 0.004 ↑ 102.0 5 4

WorkTable Scan on s11 (cost=0.00..10.20 rows=510 width=49) (actual time=0.001..0.001 rows=5 loops=4)

34. 0.084 0.084 ↓ 0.0 0 21

Index Scan using dev_pkey on task t_3 (cost=0.29..1.53 rows=1 width=26) (actual time=0.004..0.004 rows=0 loops=21)

  • Index Cond: (id = s11.parent_id)
35.          

CTE s1

36. 0.016 1.295 ↑ 16.7 12 1

Unique (cost=420.60..562.25 rows=200 width=45) (actual time=1.199..1.295 rows=12 loops=1)

37. 0.094 1.279 ↑ 245.3 21 1

WindowAgg (cost=420.60..549.37 rows=5,151 width=45) (actual time=1.198..1.279 rows=21 loops=1)

38. 0.034 1.185 ↑ 245.3 21 1

Sort (cost=420.60..433.47 rows=5,151 width=45) (actual time=1.177..1.185 rows=21 loops=1)

  • Sort Key: s11_1.base_id, s11_1.level
  • Sort Method: quicksort Memory: 26kB
39. 1.151 1.151 ↑ 245.3 21 1

CTE Scan on s11 s11_1 (cost=0.00..103.02 rows=5,151 width=45) (actual time=0.179..1.151 rows=21 loops=1)

40.          

CTE s1p

41. 0.060 0.086 ↑ 16.7 12 1

GroupAggregate (cost=420.60..461.73 rows=200 width=36) (actual time=0.045..0.086 rows=12 loops=1)

  • Group Key: s11_2.base_id
42. 0.020 0.026 ↑ 245.3 21 1

Sort (cost=420.60..433.47 rows=5,151 width=12) (actual time=0.023..0.026 rows=21 loops=1)

  • Sort Key: s11_2.base_id
  • Sort Method: quicksort Memory: 25kB
43. 0.006 0.006 ↑ 245.3 21 1

CTE Scan on s11 s11_2 (cost=0.00..103.02 rows=5,151 width=12) (actual time=0.002..0.006 rows=21 loops=1)

44.          

CTE s2

45. 0.753 7.972 ↑ 25.5 2 1

GroupAggregate (cost=622.72..3,210.97 rows=51 width=72) (actual time=7.807..7.972 rows=2 loops=1)

  • Group Key: s1a.folder_id, s1a.user_id
46. 0.067 7.219 ↑ 1,262.2 4 1

Sort (cost=622.72..635.34 rows=5,049 width=34) (actual time=7.214..7.219 rows=4 loops=1)

  • Sort Key: s1a.folder_id, s1a.user_id
  • Sort Method: quicksort Memory: 25kB
47. 0.028 7.152 ↑ 1,262.2 4 1

Hash Join (cost=74.03..312.16 rows=5,049 width=34) (actual time=6.621..7.152 rows=4 loops=1)

  • Hash Cond: (p_4.folder_id = tfi.id)
48. 0.006 5.927 ↑ 1,262.2 4 1

Nested Loop (cost=2.94..171.64 rows=5,049 width=20) (actual time=5.398..5.927 rows=4 loops=1)

49. 0.266 1.833 ↑ 25.5 2 1

Hash Join (cost=2.93..57.39 rows=51 width=50) (actual time=1.317..1.833 rows=2 loops=1)

  • Hash Cond: (tf_1.id = s1a.folder_id)
50. 0.356 0.356 ↓ 1.0 1,976 1

Seq Scan on task_folders tf_1 (cost=0.00..46.60 rows=1,960 width=46) (actual time=0.014..0.356 rows=1,976 loops=1)

51. 0.004 1.211 ↑ 25.5 2 1

Hash (cost=2.29..2.29 rows=51 width=8) (actual time=1.211..1.211 rows=2 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
52. 0.010 1.207 ↑ 25.5 2 1

HashAggregate (cost=1.27..1.78 rows=51 width=8) (actual time=1.207..1.207 rows=2 loops=1)

  • Group Key: s1a.folder_id, s1a.user_id
53. 1.197 1.197 ↑ 4.2 12 1

CTE Scan on s1a (cost=0.00..1.02 rows=51 width=8) (actual time=0.858..1.197 rows=12 loops=1)

54. 4.088 4.088 ↑ 49.5 2 2

Function Scan on unnest p_4 (cost=0.00..1.25 rows=99 width=12) (actual time=2.042..2.044 rows=2 loops=2)

  • Filter: (folder_id <> 0)
  • Rows Removed by Filter: 1
55. 0.536 1.197 ↓ 1.0 1,976 1

Hash (cost=46.60..46.60 rows=1,960 width=18) (actual time=1.197..1.197 rows=1,976 loops=1)

  • Buckets: 2048 Batches: 1 Memory Usage: 116kB
56. 0.661 0.661 ↓ 1.0 1,976 1

Seq Scan on task_folders tfi (cost=0.00..46.60 rows=1,960 width=18) (actual time=0.012..0.661 rows=1,976 loops=1)

57.          

CTE s2s

58. 0.003 0.102 ↑ 17.3 3 1

Append (cost=0.00..4.40 rows=52 width=12) (actual time=0.009..0.102 rows=3 loops=1)

59. 0.007 0.008 ↑ 1.0 1 1

Subquery Scan on *SELECT* 1 (cost=0.00..0.02 rows=1 width=12) (actual time=0.008..0.008 rows=1 loops=1)

60. 0.001 0.001 ↑ 1.0 1 1

Result (cost=0.00..0.01 rows=1 width=8) (actual time=0.001..0.001 rows=1 loops=1)

61. 0.001 0.091 ↑ 25.5 2 1

Subquery Scan on *SELECT* 2 (cost=2.59..4.38 rows=51 width=12) (actual time=0.089..0.091 rows=2 loops=1)

62. 0.019 0.090 ↑ 25.5 2 1

WindowAgg (cost=2.59..3.87 rows=51 width=49) (actual time=0.088..0.090 rows=2 loops=1)

63. 0.067 0.071 ↑ 25.5 2 1

Sort (cost=2.59..2.72 rows=51 width=41) (actual time=0.071..0.071 rows=2 loops=1)

  • Sort Key: ((s2_1.user_id = 1)), s2_1.user_id, s2_1.pathtext
  • Sort Method: quicksort Memory: 25kB
64. 0.004 0.004 ↑ 25.5 2 1

CTE Scan on s2 s2_1 (cost=0.00..1.15 rows=51 width=41) (actual time=0.004..0.004 rows=2 loops=1)

65.          

CTE s3

66. 1.228 210.733 ↓ 1.9 1,244 1

Recursive Union (cost=0.28..1,004.51 rows=641 width=146) (actual time=0.071..210.733 rows=1,244 loops=1)

67. 0.048 0.073 ↑ 1.0 1 1

Nested Loop Left Join (cost=0.28..8.31 rows=1 width=146) (actual time=0.068..0.073 rows=1 loops=1)

68. 0.020 0.020 ↑ 1.0 1 1

Index Scan using dev_folders_pkey on task_folders tf_2 (cost=0.28..3.29 rows=1 width=56) (actual time=0.016..0.020 rows=1 loops=1)

  • Index Cond: (id = 0)
69. 0.005 0.005 ↓ 0.0 0 1

CTE Scan on s1 (cost=0.00..4.50 rows=1 width=0) (actual time=0.005..0.005 rows=0 loops=1)

  • Filter: (id = 1)
  • Rows Removed by Filter: 12
70. 195.074 209.432 ↓ 2.4 155 8

Nested Loop Left Join (cost=0.33..98.34 rows=64 width=146) (actual time=0.304..26.179 rows=155 loops=8)

71. 5.824 11.872 ↓ 2.4 155 8

Hash Join (cost=0.33..60.41 rows=64 width=88) (actual time=0.254..1.484 rows=155 loops=8)

  • Hash Cond: (tf_3.path[(array_length(tf_3.path, 1) - 1)] = s3_1.id)
72. 5.328 5.328 ↑ 1.0 1,243 8

Seq Scan on task_folders tf_3 (cost=0.00..51.50 rows=1,271 width=56) (actual time=0.017..0.666 rows=1,243 loops=8)

  • Filter: (user_id = 1)
  • Rows Removed by Filter: 733
73. 0.288 0.720 ↓ 15.6 156 8

Hash (cost=0.20..0.20 rows=10 width=36) (actual time=0.090..0.090 rows=156 loops=8)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
74. 0.432 0.432 ↓ 15.6 156 8

WorkTable Scan on s3 s3_1 (cost=0.00..0.20 rows=10 width=36) (actual time=0.001..0.054 rows=156 loops=8)

75. 2.486 2.486 ↓ 0.0 0 1,243

CTE Scan on s1 s1_1 (cost=0.00..4.50 rows=1 width=0) (actual time=0.002..0.002 rows=0 loops=1,243)

  • Filter: (id = 1)
  • Rows Removed by Filter: 12
76.          

CTE s3r

77. 0.444 694.148 ↓ 1.9 1,245 1

Append (cost=2.32..29,975.44 rows=642 width=189) (actual time=0.044..694.148 rows=1,245 loops=1)

78. 0.007 0.026 ↑ 1.0 1 1

Result (cost=2.32..2.33 rows=1 width=189) (actual time=0.026..0.026 rows=1 loops=1)

79.          

Initplan (forResult)

80. 0.003 0.013 ↑ 1.0 1 1

Aggregate (cost=1.15..1.16 rows=1 width=8) (actual time=0.013..0.013 rows=1 loops=1)

81. 0.010 0.010 ↓ 0.0 0 1

CTE Scan on s1a s1a_3 (cost=0.00..1.15 rows=1 width=0) (actual time=0.010..0.010 rows=0 loops=1)

  • Filter: (folder_id = '-1'::integer)
  • Rows Removed by Filter: 12
82. 0.001 0.006 ↑ 1.0 1 1

Aggregate (cost=1.15..1.16 rows=1 width=8) (actual time=0.006..0.006 rows=1 loops=1)

83. 0.005 0.005 ↓ 0.0 0 1

CTE Scan on s1a s1a_4 (cost=0.00..1.15 rows=1 width=0) (actual time=0.005..0.005 rows=0 loops=1)

  • Filter: (folder_id = '-1'::integer)
  • Rows Removed by Filter: 12
84. 218.470 693.678 ↓ 1.9 1,244 1

CTE Scan on s3 s3_2 (cost=0.00..29,973.10 rows=641 width=189) (actual time=5.741..693.678 rows=1,244 loops=1)

85.          

SubPlan (forCTE Scan)

86. 6.220 180.380 ↓ 0.0 0 1,244

Bitmap Heap Scan on task_folders tfi_1 (cost=6.07..17.15 rows=3 width=0) (actual time=0.145..0.145 rows=0 loops=1,244)

  • Recheck Cond: (path @> ARRAY[s3_2.id])
  • Filter: (array_length(path, 1) > s3_2.depth)
  • Rows Removed by Filter: 1
  • Heap Blocks: exact=1419
87. 174.160 174.160 ↑ 1.7 6 1,244

Bitmap Index Scan on task_folders_index01 (cost=0.00..6.07 rows=10 width=0) (actual time=0.140..0.140 rows=6 loops=1,244)

  • Index Cond: (path @> ARRAY[s3_2.id])
88. 2.488 48.516 ↑ 1.0 1 1,244

Aggregate (cost=18.48..18.49 rows=1 width=8) (actual time=0.039..0.039 rows=1 loops=1,244)

89. 7.464 46.028 ↓ 0.0 0 1,244

Hash Join (cost=17.25..18.47 rows=1 width=0) (actual time=0.037..0.037 rows=0 loops=1,244)

  • Hash Cond: (s1a_1.folder_id = tfi_2.id)
90. 3.732 3.732 ↑ 4.2 12 1,244

CTE Scan on s1a s1a_1 (cost=0.00..1.02 rows=51 width=4) (actual time=0.001..0.003 rows=12 loops=1,244)

91. 4.976 34.832 ↑ 1.7 6 1,244

Hash (cost=17.13..17.13 rows=10 width=4) (actual time=0.028..0.028 rows=6 loops=1,244)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
92. 7.464 29.856 ↑ 1.7 6 1,244

Bitmap Heap Scan on task_folders tfi_2 (cost=6.08..17.13 rows=10 width=4) (actual time=0.021..0.024 rows=6 loops=1,244)

  • Recheck Cond: (path @> ARRAY[s3_2.id])
  • Filter: (id > 0)
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=2565
93. 22.392 22.392 ↑ 1.7 6 1,244

Bitmap Index Scan on task_folders_index01 (cost=0.00..6.07 rows=10 width=0) (actual time=0.018..0.018 rows=6 loops=1,244)

  • Index Cond: (path @> ARRAY[s3_2.id])
94. 1.244 246.312 ↑ 1.0 1 1,244

Aggregate (cost=18.48..18.49 rows=1 width=8) (actual time=0.198..0.198 rows=1 loops=1,244)

95. 7.464 245.068 ↓ 0.0 0 1,244

Hash Join (cost=17.25..18.47 rows=1 width=0) (actual time=0.197..0.197 rows=0 loops=1,244)

  • Hash Cond: (s1a_2.folder_id = tfi_3.id)
96. 2.488 2.488 ↑ 4.2 12 1,244

CTE Scan on s1a s1a_2 (cost=0.00..1.02 rows=51 width=4) (actual time=0.000..0.002 rows=12 loops=1,244)

97. 3.732 235.116 ↑ 1.7 6 1,244

Hash (cost=17.13..17.13 rows=10 width=4) (actual time=0.189..0.189 rows=6 loops=1,244)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
98. 75.884 231.384 ↑ 1.7 6 1,244

Bitmap Heap Scan on task_folders tfi_3 (cost=6.08..17.13 rows=10 width=4) (actual time=0.183..0.186 rows=6 loops=1,244)

  • Recheck Cond: (path @> ARRAY[s3_2.id])
  • Filter: (id > 0)
  • Rows Removed by Filter: 0
  • Heap Blocks: exact=2565
99. 155.500 155.500 ↑ 1.7 6 1,244

Bitmap Index Scan on task_folders_index01 (cost=0.00..6.07 rows=10 width=0) (actual time=0.125..0.125 rows=6 loops=1,244)

  • Index Cond: (path @> ARRAY[s3_2.id])
100.          

CTE s4

101. 0.014 0.066 ↑ 1.0 1 1

Nested Loop (cost=0.00..4.89 rows=1 width=55) (actual time=0.046..0.066 rows=1 loops=1)

  • Join Filter: (p_5.tags @> ARRAY[ut_1.id])
  • Rows Removed by Join Filter: 4
102. 0.025 0.025 ↑ 1.0 1 1

Seq Scan on perspectives p_5 (cost=0.00..1.24 rows=1 width=25) (actual time=0.024..0.025 rows=1 loops=1)

  • Filter: ((user_id = 1) AND (id = 5))
  • Rows Removed by Filter: 19
103. 0.027 0.027 ↑ 1.0 5 1

Seq Scan on task_user_tags ut_1 (cost=0.00..3.59 rows=5 width=51) (actual time=0.011..0.027 rows=5 loops=1)

  • Filter: (user_id = 1)
  • Rows Removed by Filter: 42
104. 0.128 8.107 ↑ 1.0 1 1

Aggregate (cost=26.77..26.78 rows=1 width=32) (actual time=8.107..8.107 rows=1 loops=1)

105. 7.979 7.979 ↑ 25.5 2 1

CTE Scan on s2 (cost=0.00..1.02 rows=51 width=72) (actual time=7.811..7.979 rows=2 loops=1)

106. 4.515 13.235 ↑ 1.0 1 1

Aggregate (cost=3,609.46..3,609.47 rows=1 width=32) (actual time=13.235..13.235 rows=1 loops=1)

107. 0.007 3.248 ↓ 1.7 12 1

Nested Loop (cost=45.36..724.94 rows=7 width=257) (actual time=2.928..3.248 rows=12 loops=1)

108. 1.153 1.153 ↑ 1.0 1 1

CTE Scan on current (cost=0.00..0.02 rows=1 width=4) (actual time=1.150..1.153 rows=1 loops=1)

109. 0.016 2.088 ↓ 1.7 12 1

Nested Loop (cost=45.36..724.85 rows=7 width=253) (actual time=1.774..2.088 rows=12 loops=1)

110. 0.005 0.005 ↑ 1.0 1 1

CTE Scan on us (cost=0.00..0.02 rows=1 width=0) (actual time=0.003..0.005 rows=1 loops=1)

111. 0.027 2.067 ↓ 1.7 12 1

Hash Left Join (cost=45.36..724.76 rows=7 width=253) (actual time=1.766..2.067 rows=12 loops=1)

  • Hash Cond: (t.id = scb.id)
112. 0.035 1.659 ↓ 1.7 12 1

Nested Loop Left Join (cost=42.11..721.47 rows=7 width=221) (actual time=1.369..1.659 rows=12 loops=1)

113. 0.045 1.624 ↓ 1.7 12 1

Hash Join (cost=1.98..440.01 rows=7 width=199) (actual time=1.361..1.624 rows=12 loops=1)

  • Hash Cond: (t.folder_id = s2s.folder_id)
114. 0.026 1.466 ↑ 16.7 12 1

Nested Loop (cost=0.29..437.50 rows=200 width=191) (actual time=1.221..1.466 rows=12 loops=1)

115. 1.308 1.308 ↑ 16.7 12 1

CTE Scan on s1 s3 (cost=0.00..4.00 rows=200 width=41) (actual time=1.202..1.308 rows=12 loops=1)

116. 0.132 0.132 ↑ 1.0 1 12

Index Scan using dev_pkey on task t (cost=0.29..2.16 rows=1 width=150) (actual time=0.010..0.011 rows=1 loops=12)

  • Index Cond: (id = s3.id)
117. 0.004 0.113 ↑ 17.3 3 1

Hash (cost=1.04..1.04 rows=52 width=12) (actual time=0.113..0.113 rows=3 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 9kB
118. 0.109 0.109 ↑ 17.3 3 1

CTE Scan on s2s (cost=0.00..1.04 rows=52 width=12) (actual time=0.013..0.109 rows=3 loops=1)

119. 0.000 0.000 ↓ 0.0 0 12

Index Scan using dev_pkey on task ts (cost=40.14..40.20 rows=1 width=22) (actual time=0.000..0.000 rows=0 loops=12)

  • Index Cond: (id = CASE WHEN (t.schedule_scheme IS NULL) THEN NULL::integer ELSE COALESCE((SubPlan 28), (SubPlan 29)) END)
120.          

SubPlan (forIndex Scan)

121. 0.000 0.000 ↓ 0.0 0

Limit (cost=19.98..19.98 rows=1 width=8) (never executed)

122. 0.000 0.000 ↓ 0.0 0

Sort (cost=19.98..19.99 rows=4 width=8) (never executed)

  • Sort Key: ts_1.start_date
123. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.29..19.96 rows=4 width=8) (never executed)

  • Join Filter: (ts_1.start_date >= current_2.date)
124. 0.000 0.000 ↓ 0.0 0

CTE Scan on current current_2 (cost=0.00..0.02 rows=1 width=4) (never executed)

125. 0.000 0.000 ↓ 0.0 0

Index Scan using task_index02 on task ts_1 (cost=0.29..19.79 rows=12 width=8) (never executed)

  • Index Cond: (schedule_id = t.id)
  • Filter: (NOT done)
126. 0.000 0.000 ↓ 0.0 0

Limit (cost=19.86..19.86 rows=1 width=8) (never executed)

127. 0.000 0.000 ↓ 0.0 0

Sort (cost=19.86..19.90 rows=14 width=8) (never executed)

  • Sort Key: ts_2.start_date DESC
128. 0.000 0.000 ↓ 0.0 0

Index Scan using task_index02 on task ts_2 (cost=0.29..19.79 rows=14 width=8) (never executed)

  • Index Cond: (schedule_id = t.id)
129. 0.001 0.381 ↓ 0.0 0 1

Hash (cost=2.00..2.00 rows=100 width=36) (actual time=0.381..0.381 rows=0 loops=1)

  • Buckets: 1024 Batches: 1 Memory Usage: 8kB
130. 0.380 0.380 ↓ 0.0 0 1

CTE Scan on scb (cost=0.00..2.00 rows=100 width=36) (actual time=0.380..0.380 rows=0 loops=1)

131.          

SubPlan (forAggregate)

132. 0.024 2.688 ↑ 1.0 1 12

Limit (cost=3.32..3.58 rows=1 width=36) (actual time=0.223..0.224 rows=1 loops=12)

133. 1.008 2.664 ↑ 1.0 1 12

Result (cost=3.32..3.58 rows=1 width=36) (actual time=0.222..0.222 rows=1 loops=12)

134. 0.096 1.656 ↑ 1.0 1 12

Sort (cost=3.32..3.32 rows=1 width=12) (actual time=0.138..0.138 rows=1 loops=12)

  • Sort Key: ds.id DESC
  • Sort Method: quicksort Memory: 25kB
135. 1.560 1.560 ↑ 1.0 1 12

Index Scan using task_statuses_index01 on task_statuses ds (cost=0.29..3.31 rows=1 width=12) (actual time=0.077..0.130 rows=1 loops=12)

  • Index Cond: (task_id = t.id)
  • Filter: (status = 'new'::task_status)
  • Rows Removed by Filter: 7
136. 0.996 1.560 ↑ 1.0 1 12

Aggregate (cost=3.84..3.85 rows=1 width=32) (actual time=0.130..0.130 rows=1 loops=12)

137. 0.564 0.564 ↓ 2.0 2 12

Seq Scan on task_user_tags ut_2 (cost=0.00..3.59 rows=1 width=51) (actual time=0.013..0.047 rows=2 loops=12)

  • Filter: (tasks && ARRAY[t.id])
  • Rows Removed by Filter: 45
138. 0.156 0.216 ↑ 1.0 1 12

Aggregate (cost=26.25..26.26 rows=1 width=32) (actual time=0.018..0.018 rows=1 loops=12)

139. 0.060 0.060 ↓ 0.0 0 12

Function Scan on unnest u_1 (cost=0.00..1.00 rows=100 width=4) (actual time=0.004..0.005 rows=0 loops=12)

140. 0.024 0.144 ↑ 1.0 1 12

Aggregate (cost=3.85..3.86 rows=1 width=8) (actual time=0.012..0.012 rows=1 loops=12)

141. 0.120 0.120 ↓ 0.0 0 12

Index Only Scan using attachments_idx_task_id01 on attachments a (cost=0.28..3.85 rows=2 width=0) (actual time=0.008..0.010 rows=0 loops=12)

  • Index Cond: (task_id = t.id)
  • Heap Fetches: 5
142. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=14.82..14.83 rows=1 width=8) (never executed)

143. 0.000 0.000 ↓ 0.0 0

Index Only Scan using task_index02 on task tc (cost=0.29..14.79 rows=14 width=0) (never executed)

  • Index Cond: (schedule_id = t.id)
  • Heap Fetches: 0
144. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=19.84..19.85 rows=1 width=8) (never executed)

145. 0.000 0.000 ↓ 0.0 0

Index Scan using task_index02 on task tc_1 (cost=0.29..19.83 rows=5 width=0) (never executed)

  • Index Cond: (schedule_id = t.id)
  • Filter: (start_date <= ts.start_date)
146. 0.000 0.000 ↓ 0.0 0

Aggregate (cost=19.97..19.98 rows=1 width=8) (never executed)

147. 0.000 0.000 ↓ 0.0 0

Nested Loop (cost=0.29..19.96 rows=4 width=0) (never executed)

  • Join Filter: (tc_2.start_date < current_1.date)
148. 0.000 0.000 ↓ 0.0 0

CTE Scan on current current_1 (cost=0.00..0.02 rows=1 width=4) (never executed)

149. 0.000 0.000 ↓ 0.0 0

Index Scan using task_index02 on task tc_2 (cost=0.29..19.79 rows=12 width=4) (never executed)

  • Index Cond: (schedule_id = t.id)
  • Filter: (NOT done)
150. 0.540 0.864 ↑ 1.0 1 12

Aggregate (cost=317.76..317.77 rows=1 width=32) (actual time=0.071..0.072 rows=1 loops=12)

151. 0.033 0.324 ↑ 100.0 1 12

Nested Loop (cost=0.29..267.51 rows=100 width=46) (actual time=0.023..0.027 rows=1 loops=12)

152. 0.012 0.228 ↑ 100.0 1 12

Nested Loop (cost=0.01..6.51 rows=100 width=12) (actual time=0.018..0.019 rows=1 loops=12)

153. 0.144 0.144 ↑ 1.0 1 12

CTE Scan on s1p (cost=0.00..4.50 rows=1 width=32) (actual time=0.007..0.012 rows=1 loops=12)

  • Filter: (id = s3.id)
  • Rows Removed by Filter: 11
154. 0.072 0.072 ↑ 100.0 1 12

Function Scan on unnest p_6 (cost=0.01..1.01 rows=100 width=12) (actual time=0.006..0.006 rows=1 loops=12)

155. 0.063 0.063 ↑ 1.0 1 9

Index Scan using dev_pkey on task tp (cost=0.29..2.60 rows=1 width=38) (actual time=0.006..0.007 rows=1 loops=9)

  • Index Cond: (id = p_6.id)
156. 0.467 696.746 ↑ 1.0 1 1

Aggregate (cost=106.19..106.20 rows=1 width=32) (actual time=696.746..696.746 rows=1 loops=1)

157. 696.279 696.279 ↑ 89.2 4 1

CTE Scan on s3r (cost=0.00..16.05 rows=357 width=181) (actual time=5.804..696.279 rows=4 loops=1)

  • Filter: ((q1 > 0) OR (q2 > 0))
  • Rows Removed by Filter: 1241
158. 0.121 0.190 ↑ 1.0 1 1

Aggregate (cost=0.27..0.28 rows=1 width=32) (actual time=0.190..0.190 rows=1 loops=1)

159. 0.069 0.069 ↑ 1.0 1 1

CTE Scan on s4 (cost=0.00..0.02 rows=1 width=104) (actual time=0.048..0.069 rows=1 loops=1)