clear markdown compare help donate or buy diddy dollings comments/suggestions/bugs a leap of faith? bible365
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. 809206 fiddles created (9649 in the last week).

-------------------------------------------------------------------------------- -- ② Integers table -------------------------------------------------------------------------------- with p0(i) as (select 1 union all select 1 union all select 1 union all select 1) , p1(i) as (select 1 from p0 as a, p0 as b, p0 as c, p0 as d, p0 as e)--1K rows , p2(i) as (select 1 from p1 as a, p1 as b)--1M rows select row_number() over(order by i) as val into integers from p2
1048576 rows affected
 hidden batch(es)


CREATE TABLE dbo.TestIndexSample ( Code char(4) NOT NULL, Name nvarchar(200) NOT NULL, ModifiedDate datetime NOT NULL CONSTRAINT [DF_TestIndexSample_ModifiedDate] DEFAULT GETDATE(), CONSTRAINT [PK_TestIndexSample_Code] PRIMARY KEY CLUSTERED(Code) ); CREATE NONCLUSTERED INDEX IX_TestIndexSample_Name ON dbo.TestIndexSample(Name); INSERT INTO dbo.TestIndexSample(Code, Name) SELECT CAST(val as CHAR(4)), 'NAME' + CAST(val as VARCHAR(10)) FROM integers WHERE val <= 600 ORDER BY val;
600 rows affected
 hidden batch(es)


set statistics xml on; SELECT Code,Name,ModifiedDate FROM dbo.TestIndexSample WHERE Name = 'NAME10';
Code Name ModifiedDate
10 NAME10 2020-02-21 10:32:36.930
Microsoft SQL Server 2005 XML Showplan
<ShowPlanXML xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan" Version="1.481" Build="14.0.3192.2"><BatchSequence><Batch><Statements><StmtSimple StatementText="SELECT [Code],[Name],[ModifiedDate] FROM [dbo].[TestIndexSample] WHERE [Name]=@1" StatementId="1" StatementCompId="2" StatementType="SELECT" RetrievedFromCache="false" StatementSubTreeCost="0.00616422" StatementEstRows="1" SecurityPolicyApplied="false" StatementOptmLevel="FULL" QueryHash="0xC2B3D21B4EA1B6EA" QueryPlanHash="0x7663ED2B9BF96428" 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="24" CompileTime="0" CompileCPU="0" CompileMemory="208"><MemoryGrantInfo SerialRequiredMemory="0" SerialDesiredMemory="0"></MemoryGrantInfo><OptimizerHardwareDependentProperties EstimatedAvailableMemoryGrant="838808" EstimatedPagesCached="52425" EstimatedAvailableDegreeOfParallelism="1" MaxCompileMemory="1290504"></OptimizerHardwareDependentProperties><OptimizerStatsUsage><StatisticsInfo LastUpdate="2020-02-21T10:32:37.00" ModificationCount="0" SamplingPercent="100" Statistics="[IX_TestIndexSample_Name]" Table="[TestIndexSample]" Schema="[dbo]" Database="[fiddle_1d52fd5462f7468eb71a63cb3751bb75]"></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="Clustered Index Scan" LogicalOp="Clustered Index Scan" EstimateRows="1" EstimatedRowsRead="600" EstimateIO="0.00534722" EstimateCPU="0.000817" AvgRowSize="36" EstimatedTotalSubtreeCost="0.00616422" TableCardinality="600" Parallel="0" EstimateRebinds="0" EstimateRewinds="0" EstimatedExecutionMode="Row"><OutputList><ColumnReference Database="[fiddle_1d52fd5462f7468eb71a63cb3751bb75]" Schema="[dbo]" Table="[TestIndexSample]" Column="Code"></ColumnReference><ColumnReference Database="[fiddle_1d52fd5462f7468eb71a63cb3751bb75]" Schema="[dbo]" Table="[TestIndexSample]" Column="Name"></ColumnReference><ColumnReference Database="[fiddle_1d52fd5462f7468eb71a63cb3751bb75]" Schema="[dbo]" Table="[TestIndexSample]" Column="ModifiedDate"></ColumnReference></OutputList><RunTimeInformation><RunTimeCountersPerThread Thread="0" ActualRows="1" Batches="0" ActualExecutionMode="Row" ActualElapsedms="0" ActualCPUms="0" ActualScans="1" ActualLogicalReads="6" ActualPhysicalReads="0" ActualReadAheads="0" ActualLobLogicalReads="0" ActualLobPhysicalReads="0" ActualLobReadAheads="0" ActualRowsRead="600" ActualEndOfScans="1" ActualExecutions="1"></RunTimeCountersPerThread></RunTimeInformation><IndexScan Ordered="0" ForcedIndex="0" ForceScan="0" NoExpandHint="0" Storage="RowStore"><DefinedValues><DefinedValue><ColumnReference Database="[fiddle_1d52fd5462f7468eb71a63cb3751bb75]" Schema="[dbo]" Table="[TestIndexSample]" Column="Code"></ColumnReference></DefinedValue><DefinedValue><ColumnReference Database="[fiddle_1d52fd5462f7468eb71a63cb3751bb75]" Schema="[dbo]" Table="[TestIndexSample]" Column="Name"></ColumnReference></DefinedValue><DefinedValue><ColumnReference Database="[fiddle_1d52fd5462f7468eb71a63cb3751bb75]" Schema="[dbo]" Table="[TestIndexSample]" Column="ModifiedDate"></ColumnReference></DefinedValue></DefinedValues><Object Database="[fiddle_1d52fd5462f7468eb71a63cb3751bb75]" Schema="[dbo]" Table="[TestIndexSample]" Index="[PK_TestIndexSample_Code]" IndexKind="Clustered" Storage="RowStore"></Object><Predicate><ScalarOperator ScalarString="[fiddle_1d52fd5462f7468eb71a63cb3751bb75].[dbo].[TestIndexSample].[Name]=N&apos;NAME10&apos;"><Compare CompareOp="EQ"><ScalarOperator><Identifier><ColumnReference Database="[fiddle_1d52fd5462f7468eb71a63cb3751bb75]" Schema="[dbo]" Table="[TestIndexSample]" Column="Name"></ColumnReference></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="N&apos;NAME10&apos;"></Const></ScalarOperator></Compare></ScalarOperator></Predicate></IndexScan></RelOp><ParameterList><ColumnReference Column="@1" ParameterDataType="varchar(8000)" ParameterCompiledValue="&apos;NAME10&apos;" ParameterRuntimeValue="&apos;NAME10&apos;"></ColumnReference></ParameterList></QueryPlan></StmtSimple></Statements></Batch></BatchSequence></ShowPlanXML>
 hidden batch(es)