clear markdown compare help best fiddles feedback dbanow.uk
clear markdown donate comments/suggestions/bugs a leap of faith? bible365 diddy dollings
By using db<>fiddle, you agree to license everything you submit by Creative Commons CC0. 2591633 fiddles created (45701 in the last week).

--set up row table CREATE TABLE AnswersRow ( ResponseID INT NOT NULL, QuestionID INT NOT NULL, AnswerValueText VARCHAR(20) NULL, AnswerValueDecimal DECIMAL(15,2) NULL, CONSTRAINT PK_R_Q PRIMARY KEY CLUSTERED (ResponseID,QuestionID) ) INSERT dbo.AnswersRow SELECT TOP 1000000 FLOOR((-1+ROW_NUMBER() OVER(ORDER BY(SELECT 'Joe')))/5+1) AS ResponseID, (-1+ROW_NUMBER() OVER(ORDER BY(SELECT 'Joe')))%5+1 AS QuestionID, NULL AS AnswerValueText, NULL AS AnswerValueDecimal FROM master.dbo.spt_values a CROSS JOIN master.dbo.spt_values b
1000000 rows affected
 hidden batch(es)


--randomize answers UPDATE ar SET AnswerValueText = CASE WHEN QuestionID = 2 THEN (CASE x2.seed WHEN 0 THEN 'Concrete' WHEN 1 THEN 'Skeleton' WHEN 2 THEN 'Eternite Sheets' WHEN 3 THEN 'Iron Sheets' WHEN 4 THEN 'Other' END) WHEN QuestionID = 3 THEN (CASE x3.seed WHEN 0 THEN 'North' WHEN 1 THEN 'South' WHEN 2 THEN 'East' WHEN 3 THEN 'West' WHEN 4 THEN 'Center' END) ELSE AnswerValueText END, ar.AnswerValueDecimal = CASE WHEN QuestionID = 1 THEN (FLOOR(RAND(CONVERT(BINARY(8),NEWID()))*2)) WHEN QuestionID = 4 THEN (FLOOR(RAND(CONVERT(BINARY(8),NEWID()))*60+17)) WHEN QuestionID = 5 THEN (FLOOR(RAND(CONVERT(BINARY(8),NEWID()))*200000)) ELSE AnswerValueDecimal END FROM dbo.AnswersRow ar CROSS APPLY (SELECT FLOOR(RAND(CONVERT(BINARY(8),NEWID()))*5) AS seed) x2 CROSS APPLY (SELECT FLOOR(RAND(CONVERT(BINARY(8),NEWID()))*5) AS seed) x3
Msg 9002 Level 17 State 4 Line 2 The transaction log for database 'fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5' is full due to 'ACTIVE_TRANSACTION'.
 hidden batch(es)


--create columnstore, add indexes SELECT * INTO dbo.AnswersCol FROM dbo.AnswersRow CREATE CLUSTERED COLUMNSTORE INDEX CX_Answers ON dbo.AnswersCol CREATE NONCLUSTERED INDEX IX_Answer_text ON dbo.AnswersRow(AnswerValueText) CREATE NONCLUSTERED INDEX IX_Answer_decimal ON dbo.AnswersRow(AnswerValueDecimal) CREATE NONCLUSTERED INDEX IX_Answer_question ON dbo.AnswersRow(QuestionID) INCLUDE(AnswerValueText,AnswerValueDecimal)
1000000 rows affected
 hidden batch(es)


set statistics xml on; DECLARE @dt1 DATETIME2(7) = SYSDATETIME() --average age of particular survey, city center SELECT AVG(AnswerValueDecimal), COUNT(*) FROM dbo.AnswersRow ar1 WHERE 1=1 AND ar1.ResponseID >= 100000 AND ar1.ResponseID < 200000 AND ar1.QuestionID = 4 AND EXISTS (SELECT 1 FROM dbo.AnswersRow ar2 WHERE ar1.ResponseID = ar2.ResponseID AND ar2.QuestionID = 3 AND ar2.AnswerValueText = 'Center' ) SELECT DATEDIFF(millisecond,@dt1,SYSDATETIME()) AS runtime_ms
(No column name) (No column name)
0
Microsoft SQL Server 2005 XML Showplan
<ShowPlanXML xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan" Version="1.481" Build="14.0.3335.7"><BatchSequence><Batch><Statements><StmtSimple StatementText="SELECT AVG(AnswerValueDecimal), COUNT(*)&#xa;FROM dbo.AnswersRow ar1&#xa;WHERE 1=1&#xa;AND ar1.ResponseID &gt;= 100000 AND ar1.ResponseID &lt; 200000&#xa;AND ar1.QuestionID = 4&#xa;AND EXISTS (SELECT 1&#xa;&#x9;&#x9;&#x9;FROM dbo.AnswersRow ar2&#xa;&#x9;&#x9;&#x9;WHERE ar1.ResponseID = ar2.ResponseID&#xa;&#x9;&#x9;&#x9;AND ar2.QuestionID = 3&#xa;&#x9;&#x9;&#x9;AND ar2.AnswerValueText = &apos;Center&apos;&#xa;&#x9;&#x9;&#x9;)" StatementId="1" StatementCompId="3" StatementType="SELECT" RetrievedFromCache="true" StatementSubTreeCost="0.00657346" StatementEstRows="1" SecurityPolicyApplied="false" StatementOptmLevel="FULL" QueryHash="0xC5AD8BAD9CAC0E8D" QueryPlanHash="0x5B8C9C429CABB025" StatementOptmEarlyAbortReason="GoodEnoughPlanFound" CardinalityEstimationModelVersion="140"><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" NonParallelPlanReason="NoParallelPlansInDesktopOrExpressEdition" CachedPlanSize="40" CompileTime="218" CompileCPU="218" CompileMemory="560"><MemoryGrantInfo SerialRequiredMemory="0" SerialDesiredMemory="0"></MemoryGrantInfo><OptimizerHardwareDependentProperties EstimatedAvailableMemoryGrant="838808" EstimatedPagesCached="52425" EstimatedAvailableDegreeOfParallelism="1" MaxCompileMemory="751768"></OptimizerHardwareDependentProperties><OptimizerStatsUsage><StatisticsInfo LastUpdate="2021-01-08T16:43:38.03" ModificationCount="0" SamplingPercent="100" Statistics="[IX_Answer_text]" Table="[AnswersRow]" Schema="[dbo]" Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]"></StatisticsInfo><StatisticsInfo LastUpdate="2021-01-08T16:43:40.87" ModificationCount="0" SamplingPercent="16.0684" Statistics="[PK_R_Q]" Table="[AnswersRow]" Schema="[dbo]" Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]"></StatisticsInfo><StatisticsInfo LastUpdate="2021-01-08T16:43:38.92" ModificationCount="0" SamplingPercent="100" Statistics="[IX_Answer_decimal]" Table="[AnswersRow]" Schema="[dbo]" Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]"></StatisticsInfo><StatisticsInfo LastUpdate="2021-01-08T16:43:40.65" ModificationCount="0" SamplingPercent="100" Statistics="[IX_Answer_question]" Table="[AnswersRow]" Schema="[dbo]" Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]"></StatisticsInfo></OptimizerStatsUsage><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><QueryTimeStats ElapsedTime="0" CpuTime="0"></QueryTimeStats><RelOp NodeId="0" PhysicalOp="Compute Scalar" LogicalOp="Compute Scalar" EstimateRows="1" EstimateIO="0" EstimateCPU="0" AvgRowSize="28" EstimatedTotalSubtreeCost="0.00657346" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row"><OutputList><ColumnReference Column="Expr1003"></ColumnReference><ColumnReference Column="Expr1004"></ColumnReference></OutputList><ComputeScalar><DefinedValues><DefinedValue><ColumnReference Column="Expr1003"></ColumnReference><ScalarOperator ScalarString="CASE WHEN [Expr1011]=(0) THEN NULL ELSE [Expr1012]/CONVERT_IMPLICIT(decimal(19,0),[Expr1011],0) END"><IF><Condition><ScalarOperator><Compare CompareOp="EQ"><ScalarOperator><Identifier><ColumnReference Column="Expr1011"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="(0)"></Const></ScalarOperator></Compare></ScalarOperator></Condition><Then><ScalarOperator><Const ConstValue="NULL"></Const></ScalarOperator></Then><Else><ScalarOperator><Arithmetic Operation="DIV"><ScalarOperator><Identifier><ColumnReference Column="Expr1012"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Convert DataType="decimal" Precision="19" Scale="0" Style="0" Implicit="1"><ScalarOperator><Identifier><ColumnReference Column="Expr1011"></ColumnReference></Identifier></ScalarOperator></Convert></ScalarOperator></Arithmetic></ScalarOperator></Else></IF></ScalarOperator></DefinedValue><DefinedValue><ColumnReference Column="Expr1004"></ColumnReference><ScalarOperator ScalarString="CONVERT_IMPLICIT(int,[Expr1013],0)"><Convert DataType="int" Style="0" Implicit="1"><ScalarOperator><Identifier><ColumnReference Column="Expr1013"></ColumnReference></Identifier></ScalarOperator></Convert></ScalarOperator></DefinedValue></DefinedValues><RelOp NodeId="1" PhysicalOp="Stream Aggregate" LogicalOp="Aggregate" EstimateRows="1" EstimateIO="0" EstimateCPU="1.71992e-006" AvgRowSize="28" EstimatedTotalSubtreeCost="0.00657346" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row"><OutputList><ColumnReference Column="Expr1011"></ColumnReference><ColumnReference Column="Expr1012"></ColumnReference><ColumnReference Column="Expr1013"></ColumnReference></OutputList><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="1" Batches="0" ActualExecutionMode="Row" ActualElapsedms="0" ActualCPUms="0" ActualEndOfScans="1" ActualExecutions="1"></RunTimeCountersPerThread></RunTimeInformation><StreamAggregate><DefinedValues><DefinedValue><ColumnReference Column="Expr1013"></ColumnReference><ScalarOperator ScalarString="Count(*)"><Aggregate AggType="countstar" Distinct="0"></Aggregate></ScalarOperator></DefinedValue><DefinedValue><ColumnReference Column="Expr1011"></ColumnReference><ScalarOperator ScalarString="COUNT_BIG([fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersRow].[AnswerValueDecimal] as [ar1].[AnswerValueDecimal])"><Aggregate Distinct="0" AggType="COUNT_BIG"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar1]" Column="AnswerValueDecimal"></ColumnReference></Identifier></ScalarOperator></Aggregate></ScalarOperator></DefinedValue><DefinedValue><ColumnReference Column="Expr1012"></ColumnReference><ScalarOperator ScalarString="SUM([fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersRow].[AnswerValueDecimal] as [ar1].[AnswerValueDecimal])"><Aggregate Distinct="0" AggType="SUM"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar1]" Column="AnswerValueDecimal"></ColumnReference></Identifier></ScalarOperator></Aggregate></ScalarOperator></DefinedValue></DefinedValues><RelOp NodeId="3" PhysicalOp="Nested Loops" LogicalOp="Inner Join" EstimateRows="4.88093" EstimateIO="0" EstimateCPU="4.18e-006" AvgRowSize="16" EstimatedTotalSubtreeCost="0.00657174" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row"><OutputList><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar1]" Column="AnswerValueDecimal"></ColumnReference></OutputList><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="0" Batches="0" ActualExecutionMode="Row" ActualElapsedms="0" ActualCPUms="0" ActualEndOfScans="1" ActualExecutions="1"></RunTimeCountersPerThread></RunTimeInformation><NestedLoops Optimized="0"><OuterReferences><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar2]" Column="ResponseID"></ColumnReference></OuterReferences><RelOp NodeId="4" PhysicalOp="Index Seek" LogicalOp="Index Seek" EstimateRows="1" EstimatedRowsRead="1" EstimateIO="0.003125" EstimateCPU="0.0001581" AvgRowSize="15" EstimatedTotalSubtreeCost="0.0032831" TableCardinality="1e+006" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row"><OutputList><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar2]" Column="ResponseID"></ColumnReference></OutputList><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="0" Batches="0" ActualExecutionMode="Row" ActualElapsedms="0" ActualCPUms="0" ActualScans="1" ActualLogicalReads="3" ActualPhysicalReads="0" ActualReadAheads="0" ActualLobLogicalReads="0" ActualLobPhysicalReads="0" ActualLobReadAheads="0" ActualEndOfScans="1" ActualExecutions="1"></RunTimeCountersPerThread></RunTimeInformation><IndexScan Ordered="1" ScanDirection="FORWARD" ForcedIndex="0" ForceSeek="0" ForceScan="0" NoExpandHint="0" Storage="RowStore"><DefinedValues><DefinedValue><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar2]" Column="ResponseID"></ColumnReference></DefinedValue></DefinedValues><Object Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Index="[IX_Answer_text]" Alias="[ar2]" IndexKind="NonClustered" Storage="RowStore"></Object><SeekPredicates><SeekPredicateNew><SeekKeys><Prefix ScanType="EQ"><RangeColumns><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar2]" Column="AnswerValueText"></ColumnReference></RangeColumns><RangeExpressions><ScalarOperator ScalarString="&apos;Center&apos;"><Const ConstValue="&apos;Center&apos;"></Const></ScalarOperator></RangeExpressions></Prefix><StartRange ScanType="GE"><RangeColumns><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar2]" Column="ResponseID"></ColumnReference><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar2]" Column="QuestionID"></ColumnReference></RangeColumns><RangeExpressions><ScalarOperator ScalarString="(100000)"><Const ConstValue="(100000)"></Const></ScalarOperator><ScalarOperator ScalarString="(3)"><Const ConstValue="(3)"></Const></ScalarOperator></RangeExpressions></StartRange><EndRange ScanType="LT"><RangeColumns><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar2]" Column="ResponseID"></ColumnReference></RangeColumns><RangeExpressions><ScalarOperator ScalarString="(200000)"><Const ConstValue="(200000)"></Const></ScalarOperator></RangeExpressions></EndRange></SeekKeys></SeekPredicateNew></SeekPredicates><Predicate><ScalarOperator ScalarString="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersRow].[QuestionID] as [ar2].[QuestionID]=(3)"><Compare CompareOp="EQ"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar2]" Column="QuestionID"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="(3)"></Const></ScalarOperator></Compare></ScalarOperator></Predicate></IndexScan></RelOp><RelOp NodeId="5" PhysicalOp="Index Seek" LogicalOp="Index Seek" EstimateRows="1" EstimatedRowsRead="1" EstimateIO="0.003125" EstimateCPU="0.0001581" AvgRowSize="20" EstimatedTotalSubtreeCost="0.0032831" TableCardinality="1e+006" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row"><OutputList><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar1]" Column="AnswerValueDecimal"></ColumnReference></OutputList><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="0" Batches="0" ActualExecutionMode="Row" ActualElapsedms="0" ActualCPUms="0" ActualScans="0" ActualLogicalReads="0" ActualPhysicalReads="0" ActualReadAheads="0" ActualLobLogicalReads="0" ActualLobPhysicalReads="0" ActualLobReadAheads="0" ActualEndOfScans="0" ActualExecutions="0"></RunTimeCountersPerThread></RunTimeInformation><IndexScan Ordered="1" ScanDirection="FORWARD" ForcedIndex="0" ForceSeek="0" ForceScan="0" NoExpandHint="0" Storage="RowStore"><DefinedValues><DefinedValue><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar1]" Column="AnswerValueDecimal"></ColumnReference></DefinedValue></DefinedValues><Object Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Index="[IX_Answer_question]" Alias="[ar1]" IndexKind="NonClustered" Storage="RowStore"></Object><SeekPredicates><SeekPredicateNew><SeekKeys><Prefix ScanType="EQ"><RangeColumns><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar1]" Column="QuestionID"></ColumnReference><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar1]" Column="ResponseID"></ColumnReference></RangeColumns><RangeExpressions><ScalarOperator ScalarString="(4)"><Const ConstValue="(4)"></Const></ScalarOperator><ScalarOperator ScalarString="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersRow].[ResponseID] as [ar2].[ResponseID]"><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar2]" Column="ResponseID"></ColumnReference></Identifier></ScalarOperator></RangeExpressions></Prefix></SeekKeys></SeekPredicateNew></SeekPredicates><Predicate><ScalarOperator ScalarString="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersRow].[ResponseID] as [ar1].[ResponseID]&gt;=(100000) AND [fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersRow].[ResponseID] as [ar1].[ResponseID]&lt;(200000)"><Logical Operation="AND"><ScalarOperator><Compare CompareOp="GE"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar1]" Column="ResponseID"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="(100000)"></Const></ScalarOperator></Compare></ScalarOperator><ScalarOperator><Compare CompareOp="LT"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersRow]" Alias="[ar1]" Column="ResponseID"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="(200000)"></Const></ScalarOperator></Compare></ScalarOperator></Logical></ScalarOperator></Predicate></IndexScan></RelOp></NestedLoops></RelOp></StreamAggregate></RelOp></ComputeScalar></RelOp></QueryPlan></StmtSimple></Statements></Batch></BatchSequence></ShowPlanXML>
runtime_ms
15
 hidden batch(es)


set statistics xml on; DECLARE @dt2 DATETIME2(7) = SYSDATETIME() SELECT AVG(AnswerValueDecimal), COUNT(*) FROM dbo.AnswersCol ar1 WHERE 1=1 AND ar1.ResponseID >= 100000 AND ar1.ResponseID < 200000 AND ar1.QuestionID = 4 AND EXISTS (SELECT 1 FROM dbo.AnswersCol ar2 WHERE ar1.ResponseID = ar2.ResponseID AND ar2.QuestionID = 3 AND ar2.AnswerValueText = 'Center' ) SELECT DATEDIFF(millisecond,@dt2,SYSDATETIME()) AS runtime_ms
(No column name) (No column name)
0
Microsoft SQL Server 2005 XML Showplan
<ShowPlanXML xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan" Version="1.481" Build="14.0.3335.7"><BatchSequence><Batch><Statements><StmtSimple StatementText="SELECT AVG(AnswerValueDecimal), COUNT(*)&#xa;FROM dbo.AnswersCol ar1&#xa;WHERE 1=1&#xa;AND ar1.ResponseID &gt;= 100000 AND ar1.ResponseID &lt; 200000&#xa;AND ar1.QuestionID = 4&#xa;AND EXISTS (SELECT 1&#xa;&#x9;&#x9;&#x9;FROM dbo.AnswersCol ar2&#xa;&#x9;&#x9;&#x9;WHERE ar1.ResponseID = ar2.ResponseID&#xa;&#x9;&#x9;&#x9;AND ar2.QuestionID = 3&#xa;&#x9;&#x9;&#x9;AND ar2.AnswerValueText = &apos;Center&apos;&#xa;&#x9;&#x9;&#x9;)" StatementId="1" StatementCompId="3" StatementType="SELECT" RetrievedFromCache="true" StatementSubTreeCost="0.534582" StatementEstRows="1" SecurityPolicyApplied="false" StatementOptmLevel="FULL" QueryHash="0xDC47F76463D08255" QueryPlanHash="0xA6663DADD77654C1" StatementOptmEarlyAbortReason="GoodEnoughPlanFound" CardinalityEstimationModelVersion="140"><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="1056" NonParallelPlanReason="NoParallelPlansInDesktopOrExpressEdition" CachedPlanSize="64" CompileTime="812" CompileCPU="812" CompileMemory="680"><MemoryGrantInfo SerialRequiredMemory="1024" SerialDesiredMemory="1056" RequiredMemory="1024" DesiredMemory="1056" RequestedMemory="1056" GrantWaitTime="0" GrantedMemory="1056" MaxUsedMemory="160" MaxQueryMemory="340360"></MemoryGrantInfo><OptimizerHardwareDependentProperties EstimatedAvailableMemoryGrant="838808" EstimatedPagesCached="52425" EstimatedAvailableDegreeOfParallelism="1" MaxCompileMemory="751768"></OptimizerHardwareDependentProperties><OptimizerStatsUsage><StatisticsInfo LastUpdate="2021-01-08T16:43:41.45" ModificationCount="0" SamplingPercent="100" Statistics="[_WA_Sys_00000001_36B12243]" Table="[AnswersCol]" Schema="[dbo]" Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]"></StatisticsInfo><StatisticsInfo LastUpdate="2021-01-08T16:43:41.13" ModificationCount="0" SamplingPercent="100" Statistics="[_WA_Sys_00000002_36B12243]" Table="[AnswersCol]" Schema="[dbo]" Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]"></StatisticsInfo><StatisticsInfo LastUpdate="2021-01-08T16:43:41.70" ModificationCount="0" SamplingPercent="100" Statistics="[_WA_Sys_00000003_36B12243]" Table="[AnswersCol]" Schema="[dbo]" Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]"></StatisticsInfo></OptimizerStatsUsage><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><QueryTimeStats ElapsedTime="15" CpuTime="15"></QueryTimeStats><RelOp NodeId="0" PhysicalOp="Compute Scalar" LogicalOp="Compute Scalar" EstimateRows="1" EstimateIO="0" EstimateCPU="0" AvgRowSize="28" EstimatedTotalSubtreeCost="0.534582" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row"><OutputList><ColumnReference Column="Expr1005"></ColumnReference><ColumnReference Column="Expr1006"></ColumnReference></OutputList><ComputeScalar><DefinedValues><DefinedValue><ColumnReference Column="Expr1005"></ColumnReference><ScalarOperator ScalarString="CASE WHEN [Expr1017]=(0) THEN NULL ELSE [Expr1018]/CONVERT_IMPLICIT(decimal(19,0),[Expr1017],0) END"><IF><Condition><ScalarOperator><Compare CompareOp="EQ"><ScalarOperator><Identifier><ColumnReference Column="Expr1017"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="(0)"></Const></ScalarOperator></Compare></ScalarOperator></Condition><Then><ScalarOperator><Const ConstValue="NULL"></Const></ScalarOperator></Then><Else><ScalarOperator><Arithmetic Operation="DIV"><ScalarOperator><Identifier><ColumnReference Column="Expr1018"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Convert DataType="decimal" Precision="19" Scale="0" Style="0" Implicit="1"><ScalarOperator><Identifier><ColumnReference Column="Expr1017"></ColumnReference></Identifier></ScalarOperator></Convert></ScalarOperator></Arithmetic></ScalarOperator></Else></IF></ScalarOperator></DefinedValue><DefinedValue><ColumnReference Column="Expr1006"></ColumnReference><ScalarOperator ScalarString="CONVERT_IMPLICIT(int,[Expr1019],0)"><Convert DataType="int" Style="0" Implicit="1"><ScalarOperator><Identifier><ColumnReference Column="Expr1019"></ColumnReference></Identifier></ScalarOperator></Convert></ScalarOperator></DefinedValue></DefinedValues><RelOp NodeId="1" PhysicalOp="Stream Aggregate" LogicalOp="Aggregate" EstimateRows="1" EstimateIO="0" EstimateCPU="1.34841e-006" AvgRowSize="28" EstimatedTotalSubtreeCost="0.534582" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row"><OutputList><ColumnReference Column="Expr1017"></ColumnReference><ColumnReference Column="Expr1018"></ColumnReference><ColumnReference Column="Expr1019"></ColumnReference></OutputList><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="1" Batches="0" ActualExecutionMode="Row" ActualElapsedms="15" ActualCPUms="15" ActualEndOfScans="1" ActualExecutions="1"></RunTimeCountersPerThread></RunTimeInformation><StreamAggregate><DefinedValues><DefinedValue><ColumnReference Column="Expr1019"></ColumnReference><ScalarOperator ScalarString="Count(*)"><Aggregate AggType="countstar" Distinct="0"></Aggregate></ScalarOperator></DefinedValue><DefinedValue><ColumnReference Column="Expr1017"></ColumnReference><ScalarOperator ScalarString="COUNT_BIG([fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersCol].[AnswerValueDecimal] as [ar1].[AnswerValueDecimal])"><Aggregate Distinct="0" AggType="COUNT_BIG"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar1]" Column="AnswerValueDecimal"></ColumnReference></Identifier></ScalarOperator></Aggregate></ScalarOperator></DefinedValue><DefinedValue><ColumnReference Column="Expr1018"></ColumnReference><ScalarOperator ScalarString="SUM([fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersCol].[AnswerValueDecimal] as [ar1].[AnswerValueDecimal])"><Aggregate Distinct="0" AggType="SUM"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar1]" Column="AnswerValueDecimal"></ColumnReference></Identifier></ScalarOperator></Aggregate></ScalarOperator></DefinedValue></DefinedValues><RelOp NodeId="2" PhysicalOp="Hash Match" LogicalOp="Right Semi Join" EstimateRows="1.41402" EstimateIO="0" EstimateCPU="0.00177673" AvgRowSize="16" EstimatedTotalSubtreeCost="0.534581" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Batch"><OutputList><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar1]" Column="AnswerValueDecimal"></ColumnReference></OutputList><MemoryFractions Input="1" Output="1"></MemoryFractions><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="0" Batches="0" ActualExecutionMode="Batch" ActualElapsedms="15" ActualCPUms="15" ActualScans="0" ActualLogicalReads="0" ActualPhysicalReads="0" ActualReadAheads="0" ActualLobLogicalReads="0" ActualLobPhysicalReads="0" ActualLobReadAheads="0" ActualEndOfScans="0" ActualExecutions="1"></RunTimeCountersPerThread></RunTimeInformation><Hash BitmapCreator="1"><DefinedValues><DefinedValue><ColumnReference Column="Opt_Bitmap1013"></ColumnReference></DefinedValue></DefinedValues><HashKeysBuild><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar2]" Column="ResponseID"></ColumnReference></HashKeysBuild><HashKeysProbe><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar1]" Column="ResponseID"></ColumnReference></HashKeysProbe><RelOp NodeId="3" PhysicalOp="Filter" LogicalOp="Filter" EstimateRows="1" EstimateIO="0" EstimateCPU="0.148" AvgRowSize="11" EstimatedTotalSubtreeCost="0.3404" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Batch"><OutputList><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar2]" Column="ResponseID"></ColumnReference></OutputList><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="0" Batches="112" ActualExecutionMode="Batch" ActualElapsedms="0" ActualCPUms="0" ActualScans="0" ActualLogicalReads="0" ActualPhysicalReads="0" ActualReadAheads="0" ActualLobLogicalReads="0" ActualLobPhysicalReads="0" ActualLobReadAheads="0" ActualEndOfScans="0" ActualExecutions="1"></RunTimeCountersPerThread></RunTimeInformation><Filter StartupExpression="0"><RelOp NodeId="4" PhysicalOp="Clustered Index Scan" LogicalOp="Clustered Index Scan" EstimateRows="1" EstimatedRowsRead="1e+006" EstimateIO="0.0823843" EstimateCPU="0.110016" AvgRowSize="29" EstimatedTotalSubtreeCost="0.1924" TableCardinality="1e+006" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Batch"><OutputList><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar2]" Column="ResponseID"></ColumnReference><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar2]" Column="AnswerValueText"></ColumnReference></OutputList><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="100000" Batches="112" ActualExecutionMode="Batch" ActualElapsedms="0" ActualCPUms="0" ActualScans="1" ActualLogicalReads="0" ActualPhysicalReads="0" ActualReadAheads="0" ActualLobLogicalReads="0" ActualLobPhysicalReads="0" ActualLobReadAheads="0" SegmentReads="1" SegmentSkips="0" ActualEndOfScans="0" ActualExecutions="1"></RunTimeCountersPerThread></RunTimeInformation><IndexScan Ordered="0" ForcedIndex="0" ForceSeek="0" ForceScan="0" NoExpandHint="0" Storage="ColumnStore"><DefinedValues><DefinedValue><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar2]" Column="ResponseID"></ColumnReference></DefinedValue><DefinedValue><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar2]" Column="AnswerValueText"></ColumnReference></DefinedValue></DefinedValues><Object Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Index="[CX_Answers]" Alias="[ar2]" IndexKind="Clustered" Storage="ColumnStore"></Object><Predicate><ScalarOperator ScalarString="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersCol].[ResponseID] as [ar2].[ResponseID]&gt;=(100000) AND [fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersCol].[ResponseID] as [ar2].[ResponseID]&lt;(200000) AND [fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersCol].[QuestionID] as [ar2].[QuestionID]=(3)"><Logical Operation="AND"><ScalarOperator><Compare CompareOp="GE"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar2]" Column="ResponseID"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="(100000)"></Const></ScalarOperator></Compare></ScalarOperator><ScalarOperator><Compare CompareOp="LT"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar2]" Column="ResponseID"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="(200000)"></Const></ScalarOperator></Compare></ScalarOperator><ScalarOperator><Compare CompareOp="EQ"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar2]" Column="QuestionID"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="(3)"></Const></ScalarOperator></Compare></ScalarOperator></Logical></ScalarOperator></Predicate></IndexScan></RelOp><Predicate><ScalarOperator ScalarString="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersCol].[AnswerValueText] as [ar2].[AnswerValueText]=&apos;Center&apos;"><Compare CompareOp="EQ"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar2]" Column="AnswerValueText"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="&apos;Center&apos;"></Const></ScalarOperator></Compare></ScalarOperator></Predicate></Filter></RelOp><RelOp NodeId="6" PhysicalOp="Clustered Index Scan" LogicalOp="Clustered Index Scan" EstimateRows="1.41421" EstimatedRowsRead="10" EstimateIO="0.0823843" EstimateCPU="0.110016" AvgRowSize="24" EstimatedTotalSubtreeCost="0.1924" TableCardinality="1e+006" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Batch"><OutputList><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar1]" Column="ResponseID"></ColumnReference><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar1]" Column="AnswerValueDecimal"></ColumnReference></OutputList><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="0" Batches="0" ActualExecutionMode="Row" ActualElapsedms="0" ActualCPUms="0" ActualScans="0" ActualLogicalReads="0" ActualPhysicalReads="0" ActualReadAheads="0" ActualLobLogicalReads="0" ActualLobPhysicalReads="0" ActualLobReadAheads="0" ActualEndOfScans="0" ActualExecutions="0"></RunTimeCountersPerThread></RunTimeInformation><IndexScan Ordered="0" ForcedIndex="0" ForceSeek="0" ForceScan="0" NoExpandHint="0" Storage="ColumnStore"><DefinedValues><DefinedValue><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar1]" Column="ResponseID"></ColumnReference></DefinedValue><DefinedValue><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar1]" Column="AnswerValueDecimal"></ColumnReference></DefinedValue></DefinedValues><Object Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Index="[CX_Answers]" Alias="[ar1]" IndexKind="Clustered" Storage="ColumnStore"></Object><Predicate><ScalarOperator ScalarString="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersCol].[ResponseID] as [ar1].[ResponseID]&gt;=(100000) AND [fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersCol].[ResponseID] as [ar1].[ResponseID]&lt;(200000) AND [fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersCol].[QuestionID] as [ar1].[QuestionID]=(4) AND PROBE([Opt_Bitmap1013],[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5].[dbo].[AnswersCol].[ResponseID] as [ar1].[ResponseID])"><Logical Operation="AND"><ScalarOperator><Logical Operation="AND"><ScalarOperator><Compare CompareOp="GE"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar1]" Column="ResponseID"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="(100000)"></Const></ScalarOperator></Compare></ScalarOperator><ScalarOperator><Compare CompareOp="LT"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar1]" Column="ResponseID"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="(200000)"></Const></ScalarOperator></Compare></ScalarOperator><ScalarOperator><Compare CompareOp="EQ"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar1]" Column="QuestionID"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="(4)"></Const></ScalarOperator></Compare></ScalarOperator></Logical></ScalarOperator><ScalarOperator><Intrinsic FunctionName="PROBE"><ScalarOperator><Identifier><ColumnReference Column="Opt_Bitmap1013"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Identifier><ColumnReference Database="[fiddle_b2ec0ffe90d04d61b7c52b69d5437bb5]" Schema="[dbo]" Table="[AnswersCol]" Alias="[ar1]" Column="ResponseID"></ColumnReference></Identifier></ScalarOperator></Intrinsic></ScalarOperator></Logical></ScalarOperator></Predicate></IndexScan></RelOp></Hash></RelOp></StreamAggregate></RelOp></ComputeScalar></RelOp></QueryPlan></StmtSimple></Statements></Batch></BatchSequence></ShowPlanXML>
runtime_ms
16
 hidden batch(es)