add batch remove batch split batch comment selection show hidden batches hide batch highlight batch
db<>fiddle
donate feedback about
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0.
BusinessEntityID DepartmentID
263 1
78 6
242 9
125 13
278 11
239 15
184 14
87 3
174 9
284 7
211 15
115 5
241 8
7 8
222 14
232 8
280 13
287 15
51 12
1 16
197 14
266 12
33 5
113 5
289 4
61 16
6 2
75 9
27 14
181 4
172 16
159 10
260 9
96 8
88 2
145 12
164 12
49 6
46 10
274 14
119 3
52 15
111 4
106 16
149 8
180 13
55 14
191 16
73 14
81 6
210 12
224 12
137 5
227 2
161 6
177 15
250 2
203 5
126 14
138 1
10 12
219 5
56 11
114 2
221 7
94 15
25 4
133 2
12 4
128 16
225 9
29 14
101 4
60 14
206 3
84 5
89 10
120 13
9 4
262 7
205 5
71 6
167 12
217 10
182 11
43 13
286 13
249 12
131 1
54 16
65 4
97 10
257 16
188 3
132 6
68 2
116 8
207 8
26 5
18 5
199 11
144 15
201 2
218 11
209 5
130 6
279 3
248 5
30 9
195 9
258 4
86 8
238 2
47 16
80 14
183 3
122 5
5 4
212 9
152 3
271 8
261 12
13 12
105 14
173 5
265 12
59 2
156 9
231 8
142 13
282 1
237 1
162 8
92 8
100 16
246 10
283 1
102 3
104 5
268 8
169 6
91 10
135 8
23 2
285 8
35 2
230 7
234 12
134 2
32 1
245 15
14 9
256 2
189 9
40 8
20 14
208 13
252 14
93 13
151 5
233 9
107 3
247 11
109 13
34 13
70 2
193 2
140 9
226 3
117 3
178 1
66 15
28 6
124 14
228 3
176 6
74 11
220 15
24 11
48 14
15 6
185 7
21 1
235 16
216 5
69 13
118 6
90 2
45 5
288 5
236 3
264 3
44 6
8 14
62 11
198 4
272 15
63 16
267 15
154 15
251 4
11 14
158 3
168 2
50 8
175 10
276 1
171 8
58 12
72 2
170 2
281 14
129 13
186 14
22 6
153 16
200 9
143 4
85 15
150 10
259 10
277 5
269 12
41 7
166 2
42 8
83 12
192 14
163 5
76 12
290 7
36 6
254 2
155 11
64 10
196 3
213 8
141 8
244 3
121 4
67 4
39 11
214 12
98 1
19 11
123 6
190 10
16 3
99 11
165 11
57 16
38 5
194 5
275 3
223 5
243 3
160 8
108 6
204 13
273 1
253 2
79 13
77 6
202 6
139 3
127 10
179 8
17 12
187 12
148 3
31 3
270 4
53 5
240 11
37 8
136 14
147 12
103 14
4 10
110 1
2 1
229 2
3 13
255 11
146 14
82 14
157 9
95 8
215 7
112 3
Microsoft SQL Server 2005 XML Showplan
<ShowPlanXML xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan" Version="1.539" Build="15.0.4223.1"><BatchSequence><Batch><Statements><StmtSimple StatementText="SELECT &#xa; E.BusinessEntityID,&#xa; R.DepartmentID&#xa;FROM HumanResources.Employee AS E&#xa;CROSS APPLY&#xa;(&#xa; SELECT TOP (1)&#xa; D.DepartmentID&#xa; FROM HumanResources.Department AS D&#xa; ORDER BY &#xa; NEWID(),&#xa; CHECKSUM(E.BusinessEntityID, D.DepartmentID)&#xa;) AS R" StatementId="1" StatementCompId="2" StatementType="SELECT" RetrievedFromCache="true" StatementSubTreeCost="3.3601" StatementEstRows="290" SecurityPolicyApplied="false" StatementOptmLevel="FULL" QueryHash="0x29AD05DEBF5BF1E7" QueryPlanHash="0x23C8219B52913D91" CardinalityEstimationModelVersion="150"><StatementSetOptions QUOTED_IDENTIFIER="true" ARITHABORT="true" CONCAT_NULL_YIELDS_NULL="true" ANSI_NULLS="true" ANSI_PADDING="true" ANSI_WARNINGS="true" NUMERIC_ROUNDABORT="false"></StatementSetOptions><QueryPlan DegreeOfParallelism="0" MemoryGrant="1024" NonParallelPlanReason="NoParallelPlansInDesktopOrExpressEdition" CachedPlanSize="24" CompileTime="15" CompileCPU="15" CompileMemory="224"><Warnings><MemoryGrantWarning GrantWarningKind="Excessive Grant" RequestedMemory="1024" GrantedMemory="1024" MaxUsedMemory="16"></MemoryGrantWarning></Warnings><MemoryGrantInfo SerialRequiredMemory="16" SerialDesiredMemory="24" RequiredMemory="16" DesiredMemory="24" RequestedMemory="1024" GrantWaitTime="0" MaxQueryMemory="783272" GrantedMemory="1024" MaxUsedMemory="16"></MemoryGrantInfo><OptimizerHardwareDependentProperties EstimatedAvailableMemoryGrant="1258238" EstimatedPagesCached="78639" EstimatedAvailableDegreeOfParallelism="1" MaxCompileMemory="1303424"></OptimizerHardwareDependentProperties><TraceFlags IsCompileTime="1"><TraceFlag Value="460" Scope="Global"></TraceFlag><TraceFlag Value="8017" Scope="Global"></TraceFlag></TraceFlags><TraceFlags IsCompileTime="0"><TraceFlag Value="460" Scope="Global"></TraceFlag><TraceFlag Value="8017" Scope="Global"></TraceFlag></TraceFlags><WaitStats><Wait WaitType="PAGEIOLATCH_SH" WaitTimeMs="15" WaitCount="2"></Wait></WaitStats><QueryTimeStats ElapsedTime="15" CpuTime="0"></QueryTimeStats><RelOp NodeId="0" PhysicalOp="Nested Loops" LogicalOp="Inner Join" EstimateRows="290" EstimateIO="0" EstimateCPU="0.0012122" AvgRowSize="13" EstimatedTotalSubtreeCost="3.3601" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row"><OutputList><ColumnReference Database="[fiddle_f2bb08139b494b06a4119c3e3dc5d2ad]" Schema="[HumanResources]" Table="[Employee]" Alias="[E]" Column="BusinessEntityID"></ColumnReference><ColumnReference Database="[fiddle_f2bb08139b494b06a4119c3e3dc5d2ad]" Schema="[HumanResources]" Table="[Department]" Alias="[D]" Column="DepartmentID"></ColumnReference></OutputList><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="290" Batches="0" ActualExecutionMode="Row" ActualElapsedms="15" ActualCPUms="0" ActualEndOfScans="1" ActualExecutions="1"></RunTimeCountersPerThread></RunTimeInformation><NestedLoops Optimized="0"><OuterReferences><ColumnReference Database="[fiddle_f2bb08139b494b06a4119c3e3dc5d2ad]" Schema="[HumanResources]" Table="[Employee]" Alias="[E]" Column="BusinessEntityID"></ColumnReference></OuterReferences><RelOp NodeId="1" PhysicalOp="Index Scan" LogicalOp="Index Scan" EstimateRows="290" EstimatedRowsRead="290" EstimateIO="0.003125" EstimateCPU="0.000476" AvgRowSize="11" EstimatedTotalSubtreeCost="0.003601" TableCardinality="290" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row"><OutputList><ColumnReference Database="[fiddle_f2bb08139b494b06a4119c3e3dc5d2ad]" Schema="[HumanResources]" Table="[Employee]" Alias="[E]" Column="BusinessEntityID"></ColumnReference></OutputList><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="290" Batches="0" ActualExecutionMode="Row" ActualElapsedms="0" ActualCPUms="0" ActualScans="1" ActualLogicalReads="2" ActualPhysicalReads="1" ActualReadAheads="0" ActualLobLogicalReads="0" ActualLobPhysicalReads="0" ActualLobReadAheads="0" ActualRowsRead="290" ActualEndOfScans="1" ActualExecutions="1"></RunTimeCountersPerThread></RunTimeInformation><IndexScan Ordered="0" ForcedIndex="0" ForceSeek="0" ForceScan="0" NoExpandHint="0" Storage="RowStore"><DefinedValues><DefinedValue><ColumnReference Database="[fiddle_f2bb08139b494b06a4119c3e3dc5d2ad]" Schema="[HumanResources]" Table="[Employee]" Alias="[E]" Column="BusinessEntityID"></ColumnReference></DefinedValue></DefinedValues><Object Database="[fiddle_f2bb08139b494b06a4119c3e3dc5d2ad]" Schema="[HumanResources]" Table="[Employee]" Index="[AK_Employee_rowguid]" Alias="[E]" IndexKind="NonClustered" Storage="RowStore"></Object></IndexScan></RelOp><RelOp NodeId="2" PhysicalOp="Sort" LogicalOp="TopN Sort" EstimateRows="1" EstimateRowsWithoutRowGoal="16" EstimateIO="0.0112613" EstimateCPU="0.000199869" AvgRowSize="29" EstimatedTotalSubtreeCost="3.35526" Parallel="0" EstimateRebinds="289" EstimateRewinds="0" EstimatedExecutionMode="Row"><OutputList><ColumnReference Database="[fiddle_f2bb08139b494b06a4119c3e3dc5d2ad]" Schema="[HumanResources]" Table="[Department]" Alias="[D]" Column="DepartmentID"></ColumnReference><ColumnReference Column="Expr1002"></ColumnReference><ColumnReference Column="Expr1003"></ColumnReference></OutputList><MemoryFractions Input="1" Output="1"></MemoryFractions><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="290" Batches="0" ActualExecutionMode="Row" ActualElapsedms="15" ActualCPUms="0" ActualScans="0" ActualLogicalReads="0" ActualPhysicalReads="0" ActualReadAheads="0" ActualLobLogicalReads="0" ActualLobPhysicalReads="0" ActualLobReadAheads="0" ActualRebinds="290" ActualRewinds="0" ActualEndOfScans="0" ActualExecutions="290" InputMemoryGrant="1024" OutputMemoryGrant="1024" UsedMemoryGrant="16"></RunTimeCountersPerThread></RunTimeInformation><TopSort Distinct="0" Rows="1"><OrderBy><OrderByColumn Ascending="1"><ColumnReference Column="Expr1002"></ColumnReference></OrderByColumn><OrderByColumn Ascending="1"><ColumnReference Column="Expr1003"></ColumnReference></OrderByColumn></OrderBy><RelOp NodeId="3" PhysicalOp="Compute Scalar" LogicalOp="Compute Scalar" EstimateRows="16" EstimateRowsWithoutRowGoal="16" EstimateIO="0" EstimateCPU="1.6e-06" AvgRowSize="29" EstimatedTotalSubtreeCost="0.0315365" Parallel="0" EstimateRebinds="289" EstimateRewinds="0" EstimatedExecutionMode="Row"><OutputList><ColumnReference Database="[fiddle_f2bb08139b494b06a4119c3e3dc5d2ad]" Schema="[HumanResources]" Table="[Department]" Alias="[D]" Column="DepartmentID"></ColumnReference><ColumnReference Column="Expr1002"></ColumnReference><ColumnReference Column="Expr1003"></ColumnReference></OutputList><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="4640" Batches="0" ActualExecutionMode="Row" ActualElapsedms="15" ActualCPUms="0" ActualEndOfScans="290" ActualExecutions="290"></RunTimeCountersPerThread></RunTimeInformation><ComputeScalar><DefinedValues><DefinedValue><ColumnReference Column="Expr1002"></ColumnReference><ScalarOperator ScalarString="newid()"><Intrinsic FunctionName="newid"></Intrinsic></ScalarOperator></DefinedValue><DefinedValue><ColumnReference Column="Expr1003"></ColumnReference><ScalarOperator ScalarString="checksum([fiddle_f2bb08139b494b06a4119c3e3dc5d2ad].[HumanResources].[Employee].[BusinessEntityID] as [E].[BusinessEntityID],[fiddle_f2bb08139b494b06a4119c3e3dc5d2ad].[HumanResources].[Department].[DepartmentID] as [D].[DepartmentID])"><Intrinsic FunctionName="checksum"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_f2bb08139b494b06a4119c3e3dc5d2ad]" Schema="[HumanResources]" Table="[Employee]" Alias="[E]" Column="BusinessEntityID"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Identifier><ColumnReference Database="[fiddle_f2bb08139b494b06a4119c3e3dc5d2ad]" Schema="[HumanResources]" Table="[Department]" Alias="[D]" Column="DepartmentID"></ColumnReference></Identifier></ScalarOperator></Intrinsic></ScalarOperator></DefinedValue></DefinedValues><RelOp NodeId="4" PhysicalOp="Clustered Index Scan" LogicalOp="Clustered Index Scan" EstimateRows="16" EstimatedRowsRead="16" EstimateIO="0.0032035" EstimateCPU="9.61e-05" AvgRowSize="9" EstimatedTotalSubtreeCost="0.0310725" TableCardinality="16" Parallel="0" EstimateRebinds="0" EstimateRewinds="289" EstimatedExecutionMode="Row"><OutputList><ColumnReference Database="[fiddle_f2bb08139b494b06a4119c3e3dc5d2ad]" Schema="[HumanResources]" Table="[Department]" Alias="[D]" Column="DepartmentID"></ColumnReference></OutputList><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="4640" Batches="0" ActualExecutionMode="Row" ActualElapsedms="15" ActualCPUms="0" ActualScans="290" ActualLogicalReads="580" ActualPhysicalReads="1" ActualReadAheads="0" ActualLobLogicalReads="0" ActualLobPhysicalReads="0" ActualLobReadAheads="0" ActualRowsRead="4640" ActualEndOfScans="290" ActualExecutions="290"></RunTimeCountersPerThread></RunTimeInformation><IndexScan Ordered="0" ForcedIndex="0" ForceScan="0" NoExpandHint="0" Storage="RowStore"><DefinedValues><DefinedValue><ColumnReference Database="[fiddle_f2bb08139b494b06a4119c3e3dc5d2ad]" Schema="[HumanResources]" Table="[Department]" Alias="[D]" Column="DepartmentID"></ColumnReference></DefinedValue></DefinedValues><Object Database="[fiddle_f2bb08139b494b06a4119c3e3dc5d2ad]" Schema="[HumanResources]" Table="[Department]" Index="[PK_Department_DepartmentID]" Alias="[D]" IndexKind="Clustered" Storage="RowStore"></Object></IndexScan></RelOp></ComputeScalar></RelOp></TopSort></RelOp></NestedLoops></RelOp></QueryPlan></StmtSimple></Statements></Batch></BatchSequence></ShowPlanXML>