- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我们有两个 Web 应用程序在同一个数据库上工作的情况。它们都使用 TransactionScope(在 c# 中)来封装导入例程。
我们从每个事务范围内的两个语句中得到一个死锁。第一个是:
DELETE FROM Period WHERE CompanyId = 72
insert bulk Amount ([AccountId] Int, [PeriodId] Int, [Value] Decimal(18,2)) with (CHECK_CONSTRAINTS)
<deadlock-list>
<deadlock victim="process7373048">
<process-list>
<process id="process7373048" taskpriority="0" logused="53608" waitresource="KEY: 5:72057594040811520 (55caf8cfebcf)" waittime="262" ownerId="21707350" transactionname="user_transaction" lasttranstarted="2011-11-11T14:26:47.660" XDES="0x72af950" lockMode="U" schedulerid="1" kpid="1212" status="suspended" spid="57" sbid="2" ecid="0" priority="0" trancount="2" lastbatchstarted="2011-11-11T14:26:49.273" lastbatchcompleted="2011-11-11T14:26:49.273" clientapp=".Net SqlClient Data Provider" hostname="Fathom-1" hostpid="3396" loginname="fathom_WebUser" isolationlevel="read committed (2)" xactid="21707350" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
<executionStack>
<frame procname="adhoc" line="1" sqlhandle="0x02000000bbf5661cad04d2a71e72d51fe7835afad57a3259">
DELETE FROM Period WHERE CompanyId = 105 AND Type = 7 AND DateRangeId IN (
SELECT Id
FROM DateRange
WHERE Start >= '20110101 00:00:00') </frame>
</executionStack>
<inputbuf>
DELETE FROM Period WHERE CompanyId = 105 AND Type = 7 AND DateRangeId IN (
SELECT Id
FROM DateRange
WHERE Start >= '20110101 00:00:00') </inputbuf>
</process>
<process id="process2c37e508" taskpriority="0" logused="570716" waitresource="KEY: 5:72057594040352768 (a559124170e7)" waittime="1330" ownerId="21707151" transactionname="user_transaction" lasttranstarted="2011-11-11T14:26:46.640" XDES="0x7207950" lockMode="S" schedulerid="1" kpid="3068" status="suspended" spid="58" sbid="2" ecid="0" priority="0" trancount="2" lastbatchstarted="2011-11-11T14:26:48.203" lastbatchcompleted="2011-11-11T14:26:48.203" clientapp=".Net SqlClient Data Provider" hostname="Fathom-1" hostpid="3396" loginname="fathom_WebUser" isolationlevel="read committed (2)" xactid="21707151" currentdb="5" lockTimeout="4294967295" clientoption1="671088672" clientoption2="128056">
<executionStack>
<frame procname="adhoc" line="1" sqlhandle="0x020000001672aa048fceb23bce7f8c54178cbbe497dba1a6">
insert bulk Amount ([AccountId] Int, [PeriodId] Int, [Value] Decimal(18,2)) with (CHECK_CONSTRAINTS) </frame>
</executionStack>
<inputbuf>
insert bulk Amount ([AccountId] Int, [PeriodId] Int, [Value] Decimal(18,2)) with (CHECK_CONSTRAINTS) </inputbuf>
</process>
</process-list>
<resource-list>
<keylock hobtid="72057594040811520" dbid="5" objectname="fathom.dbo.Period" indexname="PK_Period" id="lock2ab24500" mode="X" associatedObjectId="72057594040811520">
<owner-list>
<owner id="process2c37e508" mode="X"/>
</owner-list>
<waiter-list>
<waiter id="process7373048" mode="U" requestType="wait"/>
</waiter-list>
</keylock>
<keylock hobtid="72057594040352768" dbid="5" objectname="fathom.dbo.Account" indexname="PK_Account" id="lock1ce65980" mode="X" associatedObjectId="72057594040352768">
<owner-list>
<owner id="process7373048" mode="X"/>
</owner-list>
<waiter-list>
<waiter id="process2c37e508" mode="S" requestType="wait"/>
</waiter-list>
</keylock>
</resource-list>
</deadlock>
</deadlock-list>
<ShowPlanXML xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan" Version="1.1" Build="10.50.2500.0"><BatchSequence><Batch><Statements><StmtSimple><QueryPlan CachedPlanSize="40" CompileTime="4" CompileCPU="4" CompileMemory="288"><RelOp NodeId="1" PhysicalOp="Assert" LogicalOp="Assert" EstimateRows="8100" EstimateIO="0" EstimateCPU="0.005508" AvgRowSize="9" EstimatedTotalSubtreeCost="4.81146" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList/><Assert StartupExpression="0"><RelOp NodeId="2" PhysicalOp="Merge Join" LogicalOp="Left Semi Join" EstimateRows="8100" EstimateIO="0.025979" EstimateCPU="0.0311493" AvgRowSize="9" EstimatedTotalSubtreeCost="4.80595" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Column="Expr1012"/><ColumnReference Column="Expr1013"/></OutputList><Merge ManyToMany="1"><InnerSideJoinColumns><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></InnerSideJoinColumns><OuterSideJoinColumns><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="PeriodId"/></OuterSideJoinColumns><Residual><ScalarOperator ScalarString="[fathom].[dbo].[Amount].[PeriodId]=[fathom].[dbo].[Period].[Id]"><Compare CompareOp="EQ"><ScalarOperator><Identifier><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="PeriodId"/></Identifier></ScalarOperator><ScalarOperator><Identifier><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></Identifier></ScalarOperator></Compare></ScalarOperator></Residual><RelOp NodeId="3" PhysicalOp="Sort" LogicalOp="Sort" EstimateRows="9000" EstimateIO="0.0112613" EstimateCPU="0.465821" AvgRowSize="12" EstimatedTotalSubtreeCost="4.74537" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="PeriodId"/><ColumnReference Column="Expr1012"/></OutputList><MemoryFractions Input="0.42446" Output="1"/><Sort Distinct="0"><OrderBy><OrderByColumn Ascending="1"><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="PeriodId"/></OrderByColumn></OrderBy><RelOp NodeId="4" PhysicalOp="Merge Join" LogicalOp="Left Semi Join" EstimateRows="9000" EstimateIO="0.027857" EstimateCPU="0.0353131" AvgRowSize="12" EstimatedTotalSubtreeCost="4.26829" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="PeriodId"/><ColumnReference Column="Expr1012"/></OutputList><Merge ManyToMany="1"><InnerSideJoinColumns><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Account]" Column="Id"/></InnerSideJoinColumns><OuterSideJoinColumns><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="AccountId"/></OuterSideJoinColumns><Residual><ScalarOperator ScalarString="[fathom].[dbo].[Amount].[AccountId]=[fathom].[dbo].[Account].[Id]"><Compare CompareOp="EQ"><ScalarOperator><Identifier><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="AccountId"/></Identifier></ScalarOperator><ScalarOperator><Identifier><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Account]" Column="Id"/></Identifier></ScalarOperator></Compare></ScalarOperator></Residual><RelOp NodeId="5" PhysicalOp="Clustered Index Insert" LogicalOp="Insert" EstimateRows="10000" EstimateIO="0.201195" EstimateCPU="0.01" AvgRowSize="15" EstimatedTotalSubtreeCost="4.19121" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="AccountId"/><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="PeriodId"/></OutputList><Update DMLRequestSort="1"><Object Database="[fathom]" Schema="[dbo]" Table="[Amount]" Index="[PK_Amount]" IndexKind="Clustered"/><SetPredicate><ScalarOperator ScalarString="[fathom].[dbo].[Amount].[AccountId] = RaiseIfNullInsert([!BulkInsert].[AccountId]),[fathom].[dbo].[Amount].[PeriodId] = RaiseIfNullInsert([!BulkInsert].[PeriodId]),[fathom].[dbo].[Amount].[Value] = RaiseIfNullInsert([Expr1005])"><ScalarExpressionList><ScalarOperator><MultipleAssign><Assign><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="AccountId"/><ScalarOperator><Intrinsic FunctionName="RaiseIfNullInsert"><ScalarOperator><Identifier><ColumnReference Table="[!BulkInsert]" Column="AccountId"/></Identifier></ScalarOperator></Intrinsic></ScalarOperator></Assign><Assign><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="PeriodId"/><ScalarOperator><Intrinsic FunctionName="RaiseIfNullInsert"><ScalarOperator><Identifier><ColumnReference Table="[!BulkInsert]" Column="PeriodId"/></Identifier></ScalarOperator></Intrinsic></ScalarOperator></Assign><Assign><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="Value"/><ScalarOperator><Intrinsic FunctionName="RaiseIfNullInsert"><ScalarOperator><Identifier><ColumnReference Column="Expr1005"/></Identifier></ScalarOperator></Intrinsic></ScalarOperator></Assign></MultipleAssign></ScalarOperator></ScalarExpressionList></ScalarOperator></SetPredicate><RelOp NodeId="6" PhysicalOp="Sort" LogicalOp="Sort" EstimateRows="10000" EstimateIO="0.0112613" EstimateCPU="0.60342" AvgRowSize="24" EstimatedTotalSubtreeCost="3.98001" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Table="[!BulkInsert]" Column="AccountId"/><ColumnReference Table="[!BulkInsert]" Column="PeriodId"/><ColumnReference Column="Expr1005"/></OutputList><MemoryFractions Input="1" Output="0.57554"/><Sort Distinct="0"><OrderBy><OrderByColumn Ascending="1"><ColumnReference Table="[!BulkInsert]" Column="AccountId"/></OrderByColumn><OrderByColumn Ascending="1"><ColumnReference Table="[!BulkInsert]" Column="PeriodId"/></OrderByColumn></OrderBy><RelOp NodeId="7" PhysicalOp="Compute Scalar" LogicalOp="Compute Scalar" EstimateRows="10000" EstimateIO="0" EstimateCPU="0.001" AvgRowSize="24" EstimatedTotalSubtreeCost="3.36533" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Table="[!BulkInsert]" Column="AccountId"/><ColumnReference Table="[!BulkInsert]" Column="PeriodId"/><ColumnReference Column="Expr1005"/></OutputList><ComputeScalar><DefinedValues><DefinedValue><ColumnReference Column="Expr1005"/><ScalarOperator ScalarString="CONVERT_IMPLICIT(decimal(18,2),[!BulkInsert].[Value],0)"><Convert DataType="decimal" Precision="18" Scale="2" Style="0" Implicit="1"><ScalarOperator><Identifier><ColumnReference Table="[!BulkInsert]" Column="Value"/></Identifier></ScalarOperator></Convert></ScalarOperator></DefinedValue></DefinedValues><RelOp NodeId="8" PhysicalOp="Top" LogicalOp="Top" EstimateRows="10000" EstimateIO="0" EstimateCPU="0.001" AvgRowSize="24" EstimatedTotalSubtreeCost="3.36433" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Table="[!BulkInsert]" Column="AccountId"/><ColumnReference Table="[!BulkInsert]" Column="PeriodId"/><ColumnReference Table="[!BulkInsert]" Column="Value"/></OutputList><Top RowCount="1" IsPercent="0" WithTies="0"><TopExpression><ScalarOperator ScalarString="(0)"><Const ConstValue="(0)"/></ScalarOperator></TopExpression><RelOp NodeId="9" PhysicalOp="Remote Scan" LogicalOp="Remote Scan" EstimateRows="10000" EstimateIO="0" EstimateCPU="3.36333" AvgRowSize="24" EstimatedTotalSubtreeCost="3.36333" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Table="[!BulkInsert]" Column="AccountId"/><ColumnReference Table="[!BulkInsert]" Column="PeriodId"/><ColumnReference Table="[!BulkInsert]" Column="Value"/></OutputList><RemoteScan RemoteObject="STREAM"/></RelOp></Top></RelOp></ComputeScalar></RelOp></Sort></RelOp></Update></RelOp><RelOp NodeId="14" PhysicalOp="Clustered Index Scan" LogicalOp="Clustered Index Scan" EstimateRows="907" EstimateIO="0.0127546" EstimateCPU="0.0011547" AvgRowSize="11" EstimatedTotalSubtreeCost="0.0139093" TableCardinality="907" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Account]" Column="Id"/></OutputList><IndexScan Ordered="1" ScanDirection="FORWARD" ForcedIndex="1" ForceSeek="0" ForceScan="0" NoExpandHint="0"><DefinedValues><DefinedValue><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Account]" Column="Id"/></DefinedValue></DefinedValues><Object Database="[fathom]" Schema="[dbo]" Table="[Account]" Index="[PK_Account]" IndexKind="Clustered"/></IndexScan></RelOp></Merge></RelOp></Sort></RelOp><RelOp NodeId="16" PhysicalOp="Clustered Index Scan" LogicalOp="Clustered Index Scan" EstimateRows="150" EstimateIO="0.003125" EstimateCPU="0.000322" AvgRowSize="11" EstimatedTotalSubtreeCost="0.003447" TableCardinality="150" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></OutputList><IndexScan Ordered="1" ScanDirection="FORWARD" ForcedIndex="1" ForceSeek="0" ForceScan="0" NoExpandHint="0"><DefinedValues><DefinedValue><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></DefinedValue></DefinedValues><Object Database="[fathom]" Schema="[dbo]" Table="[Period]" Index="[PK_Period]" IndexKind="Clustered"/></IndexScan></RelOp></Merge></RelOp><Predicate><ScalarOperator ScalarString="CASE WHEN [Expr1012] IS NULL THEN (0) ELSE CASE WHEN [Expr1013] IS NULL THEN (1) ELSE NULL END END"><IF><Condition><ScalarOperator><Logical Operation="IS NULL"><ScalarOperator><Identifier><ColumnReference Column="Expr1012"/></Identifier></ScalarOperator></Logical></ScalarOperator></Condition><Then><ScalarOperator><Const ConstValue="(0)"/></ScalarOperator></Then><Else><ScalarOperator><IF><Condition><ScalarOperator><Logical Operation="IS NULL"><ScalarOperator><Identifier><ColumnReference Column="Expr1013"/></Identifier></ScalarOperator></Logical></ScalarOperator></Condition><Then><ScalarOperator><Const ConstValue="(1)"/></ScalarOperator></Then><Else><ScalarOperator><Const ConstValue="NULL"/></ScalarOperator></Else></IF></ScalarOperator></Else></IF></ScalarOperator></Predicate></Assert></RelOp></QueryPlan></StmtSimple></Statements></Batch></BatchSequence></ShowPlanXML>
<ShowPlanXML xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan" Version="1.1" Build="10.50.2500.0"><BatchSequence><Batch><Statements><StmtSimple><QueryPlan CachedPlanSize="104" CompileTime="9" CompileCPU="9" CompileMemory="544"><MissingIndexes><MissingIndexGroup Impact="34.2748"><MissingIndex Database="[fathom]" Schema="[dbo]" Table="[Amount]"><ColumnGroup Usage="EQUALITY"><Column Name="[PeriodId]" ColumnId="2"/></ColumnGroup><ColumnGroup Usage="INCLUDE"><Column Name="[AccountId]" ColumnId="1"/></ColumnGroup></MissingIndex></MissingIndexGroup><MissingIndexGroup Impact="46.6451"><MissingIndex Database="[fathom]" Schema="[dbo]" Table="[Result]"><ColumnGroup Usage="EQUALITY"><Column Name="[PeriodId]" ColumnId="2"/></ColumnGroup><ColumnGroup Usage="INCLUDE"><Column Name="[MetricId]" ColumnId="1"/></ColumnGroup></MissingIndex></MissingIndexGroup></MissingIndexes><RelOp NodeId="1" PhysicalOp="Sequence" LogicalOp="Sequence" EstimateRows="119.191" EstimateIO="0" EstimateCPU="0.000233964" AvgRowSize="9" EstimatedTotalSubtreeCost="0.49074" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList/><Sequence><RelOp NodeId="2" PhysicalOp="Table Spool" LogicalOp="Eager Spool" EstimateRows="1" EstimateIO="0" EstimateCPU="2.54684e-005" AvgRowSize="11" EstimatedTotalSubtreeCost="0.00431261" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></OutputList><Spool><RelOp NodeId="3" PhysicalOp="Clustered Index Delete" LogicalOp="Delete" EstimateRows="1" EstimateIO="0.01" EstimateCPU="1e-006" AvgRowSize="11" EstimatedTotalSubtreeCost="0.01685" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></OutputList><Update DMLRequestSort="0"><Object Database="[fathom]" Schema="[dbo]" Table="[Period]" Index="[PK_Period]" IndexKind="Clustered"/><RelOp NodeId="4" PhysicalOp="Top" LogicalOp="Top" EstimateRows="1" EstimateIO="0" EstimateCPU="1e-007" AvgRowSize="11" EstimatedTotalSubtreeCost="0.00684904" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></OutputList><Top RowCount="1" IsPercent="0" WithTies="0"><TopExpression><ScalarOperator ScalarString="(0)"><Const ConstValue="(0)"/></ScalarOperator></TopExpression><RelOp NodeId="6" PhysicalOp="Nested Loops" LogicalOp="Inner Join" EstimateRows="1" EstimateIO="0" EstimateCPU="4.18e-006" AvgRowSize="11" EstimatedTotalSubtreeCost="0.00684894" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></OutputList><NestedLoops Optimized="0"><OuterReferences><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="DateRangeId"/></OuterReferences><RelOp NodeId="7" PhysicalOp="Clustered Index Scan" LogicalOp="Clustered Index Scan" EstimateRows="1" EstimateIO="0.003125" EstimateCPU="0.0003121" AvgRowSize="20" EstimatedTotalSubtreeCost="0.0034371" TableCardinality="141" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="DateRangeId"/></OutputList><IndexScan Ordered="1" ForcedIndex="0" ForceScan="0" NoExpandHint="0"><DefinedValues><DefinedValue><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></DefinedValue><DefinedValue><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="DateRangeId"/></DefinedValue></DefinedValues><Object Database="[fathom]" Schema="[dbo]" Table="[Period]" Index="[PK_Period]" IndexKind="Clustered"/><Predicate><ScalarOperator ScalarString="[fathom].[dbo].[Period].[CompanyId]=(118) AND [fathom].[dbo].[Period].[Type]=(10)"><Logical Operation="AND"><ScalarOperator><Compare CompareOp="EQ"><ScalarOperator><Identifier><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="CompanyId"/></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="(118)"/></ScalarOperator></Compare></ScalarOperator><ScalarOperator><Compare CompareOp="EQ"><ScalarOperator><Identifier><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Type"/></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="(10)"/></ScalarOperator></Compare></ScalarOperator></Logical></ScalarOperator></Predicate></IndexScan></RelOp><RelOp NodeId="8" PhysicalOp="Clustered Index Seek" LogicalOp="Clustered Index Seek" EstimateRows="1" EstimateIO="0.003125" EstimateCPU="0.0001581" AvgRowSize="10" EstimatedTotalSubtreeCost="0.0032831" TableCardinality="2554" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList/><IndexScan Ordered="1" ScanDirection="FORWARD" ForcedIndex="0" ForceSeek="0" ForceScan="0" NoExpandHint="0"><DefinedValues/><Object Database="[fathom]" Schema="[dbo]" Table="[DateRange]" Index="[PK_DateRange]" IndexKind="Clustered"/><SeekPredicates><SeekPredicateNew><SeekKeys><Prefix ScanType="EQ"><RangeColumns><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[DateRange]" Column="Id"/></RangeColumns><RangeExpressions><ScalarOperator ScalarString="[fathom].[dbo].[Period].[DateRangeId]"><Identifier><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="DateRangeId"/></Identifier></ScalarOperator></RangeExpressions></Prefix></SeekKeys></SeekPredicateNew></SeekPredicates><Predicate><ScalarOperator ScalarString="[fathom].[dbo].[DateRange].[Start]>='2011-07-01'"><Compare CompareOp="GE"><ScalarOperator><Identifier><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[DateRange]" Column="Start"/></Identifier></ScalarOperator><ScalarOperator><Const ConstValue="'2011-07-01'"/></ScalarOperator></Compare></ScalarOperator></Predicate></IndexScan></RelOp></NestedLoops></RelOp></Top></RelOp></Update></RelOp></Spool></RelOp><RelOp NodeId="11" PhysicalOp="Clustered Index Delete" LogicalOp="Delete" EstimateRows="107.939" EstimateIO="0.0116206" EstimateCPU="0.000107939" AvgRowSize="9" EstimatedTotalSubtreeCost="0.261311" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList/><Update DMLRequestSort="1"><Object Database="[fathom]" Schema="[dbo]" Table="[Result]" Index="[PK_RatioResult]" IndexKind="Clustered"/><RelOp NodeId="13" PhysicalOp="Sort" LogicalOp="Sort" EstimateRows="107.939" EstimateIO="0.0112613" EstimateCPU="0.0012373" AvgRowSize="19" EstimatedTotalSubtreeCost="0.249583" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Result]" Column="MetricId"/></OutputList><MemoryFractions Input="1" Output="1"/><Sort Distinct="0"><OrderBy><OrderByColumn Ascending="1"><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Result]" Column="MetricId"/></OrderByColumn><OrderByColumn Ascending="1"><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></OrderByColumn></OrderBy><RelOp NodeId="14" PhysicalOp="Hash Match" LogicalOp="Inner Join" EstimateRows="107.939" EstimateIO="0" EstimateCPU="0.0863485" AvgRowSize="19" EstimatedTotalSubtreeCost="0.237084" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Result]" Column="MetricId"/><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Result]" Column="PeriodId"/></OutputList><MemoryFractions Input="0" Output="0"/><Hash><DefinedValues/><HashKeysBuild><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></HashKeysBuild><HashKeysProbe><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Result]" Column="PeriodId"/></HashKeysProbe><RelOp NodeId="15" PhysicalOp="Table Spool" LogicalOp="Eager Spool" EstimateRows="1" EstimateIO="0" EstimateCPU="2.54684e-005" AvgRowSize="11" EstimatedTotalSubtreeCost="0.00431261" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></OutputList><Spool PrimaryNodeId="2"/></RelOp><RelOp NodeId="16" PhysicalOp="Clustered Index Scan" LogicalOp="Clustered Index Scan" EstimateRows="14974" EstimateIO="0.129792" EstimateCPU="0.0166284" AvgRowSize="15" EstimatedTotalSubtreeCost="0.14642" TableCardinality="14974" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Result]" Column="MetricId"/><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Result]" Column="PeriodId"/></OutputList><IndexScan Ordered="1" ForcedIndex="0" ForceScan="0" NoExpandHint="0"><DefinedValues><DefinedValue><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Result]" Column="MetricId"/></DefinedValue><DefinedValue><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Result]" Column="PeriodId"/></DefinedValue></DefinedValues><Object Database="[fathom]" Schema="[dbo]" Table="[Result]" Index="[PK_RatioResult]" IndexKind="Clustered"/></IndexScan></RelOp></Hash></RelOp></Sort></RelOp></Update></RelOp><RelOp NodeId="21" PhysicalOp="Clustered Index Delete" LogicalOp="Delete" EstimateRows="5.83333" EstimateIO="0.01" EstimateCPU="5.83333e-006" AvgRowSize="9" EstimatedTotalSubtreeCost="0.0383844" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList/><Update DMLRequestSort="0"><Object Database="[fathom]" Schema="[dbo]" Table="[PeriodAlert]" Index="[PK_PeriodAlert]" IndexKind="Clustered"/><RelOp NodeId="22" PhysicalOp="Hash Match" LogicalOp="Inner Join" EstimateRows="5.83333" EstimateIO="0" EstimateCPU="0.0184047" AvgRowSize="15" EstimatedTotalSubtreeCost="0.0283786" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[PeriodAlert]" Column="AlertId"/><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[PeriodAlert]" Column="PeriodId"/></OutputList><MemoryFractions Input="0" Output="0"/><Hash><DefinedValues/><HashKeysBuild><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></HashKeysBuild><HashKeysProbe><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[PeriodAlert]" Column="PeriodId"/></HashKeysProbe><RelOp NodeId="23" PhysicalOp="Table Spool" LogicalOp="Eager Spool" EstimateRows="1" EstimateIO="0" EstimateCPU="2.54684e-005" AvgRowSize="11" EstimatedTotalSubtreeCost="0.00431261" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></OutputList><Spool PrimaryNodeId="2"/></RelOp><RelOp NodeId="24" PhysicalOp="Clustered Index Scan" LogicalOp="Clustered Index Scan" EstimateRows="140" EstimateIO="0.00534722" EstimateCPU="0.000311" AvgRowSize="15" EstimatedTotalSubtreeCost="0.00565822" TableCardinality="140" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[PeriodAlert]" Column="AlertId"/><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[PeriodAlert]" Column="PeriodId"/></OutputList><IndexScan Ordered="1" ForcedIndex="0" ForceScan="0" NoExpandHint="0"><DefinedValues><DefinedValue><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[PeriodAlert]" Column="AlertId"/></DefinedValue><DefinedValue><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[PeriodAlert]" Column="PeriodId"/></DefinedValue></DefinedValues><Object Database="[fathom]" Schema="[dbo]" Table="[PeriodAlert]" Index="[PK_PeriodAlert]" IndexKind="Clustered"/></IndexScan></RelOp></Hash></RelOp></Update></RelOp><RelOp NodeId="26" PhysicalOp="Clustered Index Delete" LogicalOp="Delete" EstimateRows="119.191" EstimateIO="0.01" EstimateCPU="0.000119191" AvgRowSize="9" EstimatedTotalSubtreeCost="0.186497" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList/><Update DMLRequestSort="0"><Object Database="[fathom]" Schema="[dbo]" Table="[Amount]" Index="[PK_Amount]" IndexKind="Clustered"/><RelOp NodeId="27" PhysicalOp="Hash Match" LogicalOp="Inner Join" EstimateRows="119.191" EstimateIO="0" EstimateCPU="0.0947385" AvgRowSize="15" EstimatedTotalSubtreeCost="0.176378" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="AccountId"/><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="PeriodId"/></OutputList><MemoryFractions Input="0" Output="0"/><Hash><DefinedValues/><HashKeysBuild><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></HashKeysBuild><HashKeysProbe><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="PeriodId"/></HashKeysProbe><RelOp NodeId="28" PhysicalOp="Table Spool" LogicalOp="Eager Spool" EstimateRows="1" EstimateIO="0" EstimateCPU="2.54684e-005" AvgRowSize="11" EstimatedTotalSubtreeCost="0.00431261" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Period]" Column="Id"/></OutputList><Spool PrimaryNodeId="2"/></RelOp><RelOp NodeId="29" PhysicalOp="Clustered Index Scan" LogicalOp="Clustered Index Scan" EstimateRows="16806" EstimateIO="0.0586806" EstimateCPU="0.0186436" AvgRowSize="15" EstimatedTotalSubtreeCost="0.0773242" TableCardinality="16806" Parallel="0" EstimateRebinds="0" EstimateRewinds="0"><OutputList><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="AccountId"/><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="PeriodId"/></OutputList><IndexScan Ordered="1" ForcedIndex="0" ForceScan="0" NoExpandHint="0"><DefinedValues><DefinedValue><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="AccountId"/></DefinedValue><DefinedValue><ColumnReference Database="[fathom]" Schema="[dbo]" Table="[Amount]" Column="PeriodId"/></DefinedValue></DefinedValues><Object Database="[fathom]" Schema="[dbo]" Table="[Amount]" Index="[PK_Amount]" IndexKind="Clustered"/></IndexScan></RelOp></Hash></RelOp></Update></RelOp></Sequence></RelOp></QueryPlan></StmtSimple></Statements></Batch></BatchSequence></ShowPlanXML>
最佳答案
在我看来,主要原因是下一条语句的执行计划:
DELETE FROM Period WHERE CompanyId = 105 AND Type = 7 AND DateRangeId IN (
SELECT Id
FROM DateRange
WHERE Start >= '20110101 00:00:00')
DELETE
的执行计划至少有两个问题
SCAN
运算符(查看 XML 执行计划的图形 View ,我使用了
SQL Sentry Plan Explorer
(link) 的免费版本):
CREATE /*UNIQUE*/ INDEX IN_Result_PeriodId_MetricId
ON dbo.Result (PeriodId, MetricId);
CREATE /*UNIQUE*/ INDEX IN_Amount_PeriodId_AccountId
ON dbo.Amount(PeriodId, AccountId);
--Optional
CREATE /*UNIQUE*/ INDEX IN_PeriodAlert_PeriodId_AlertId
ON dbo.PeriodAlert(PeriodId, AlertId);
关于sql-server - 如何解决主要插入数据的事务之间的死锁?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8095596/
初学者 android 问题。好的,我已经成功写入文件。例如。 //获取文件名 String filename = getResources().getString(R.string.filename
我已经将相同的图像保存到/data/data/mypackage/img/中,现在我想显示这个全屏,我曾尝试使用 ACTION_VIEW 来显示 android 标准程序,但它不是从/data/dat
我正在使用Xcode 9,Swift 4。 我正在尝试使用以下代码从URL在ImageView中显示图像: func getImageFromUrl(sourceUrl: String) -> UII
我的 Ubuntu 安装 genymotion 有问题。主要是我无法调试我的数据库,因为通过 eclipse 中的 DBMS 和 shell 中的 adb 我无法查看/data/文件夹的内容。没有显示
我正在尝试用 PHP 发布一些 JSON 数据。但是出了点问题。 这是我的 html -- {% for x in sets %}
我观察到两种方法的结果不同。为什么是这样?我知道 lm 上发生了什么,但无法弄清楚 tslm 上发生了什么。 > library(forecast) > set.seed(2) > tts lm(t
我不确定为什么会这样!我有一个由 spring data elasticsearch 和 spring data jpa 使用的类,但是当我尝试运行我的应用程序时出现错误。 Error creatin
在 this vega 图表,如果我下载并转换 flare-dependencies.json使用以下 jq 到 csv命令, jq -r '(map(keys) | add | unique) as
我正在提交一个项目,我必须在其中创建一个带有表的 mysql 数据库。一切都在我这边进行,所以我只想检查如何将我所有的压缩文件发送给使用不同计算机的人。基本上,我如何为另一台计算机创建我的数据库文件,
我有一个应用程序可以将文本文件写入内部存储。我想仔细看看我的电脑。 我运行了 Toast.makeText 来显示路径,它说:/数据/数据/我的包 但是当我转到 Android Studio 的 An
我喜欢使用 Genymotion 模拟器以如此出色的速度加载 Android。它有非常好的速度,但仍然有一些不稳定的性能。 如何从 Eclipse 中的文件资源管理器访问 Genymotion 模拟器
我需要更改 Silverlight 中文本框的格式。数据通过 MVVM 绑定(bind)。 例如,有一个 int 属性,我将 1 添加到 setter 中的值并调用 OnPropertyChanged
我想向 Youtube Data API 提出请求,但我不需要访问任何用户信息。我只想浏览公共(public)视频并根据搜索词显示视频。 我可以在未经授权的情况下这样做吗? 最佳答案 YouTube
我已经设置了一个 Twilio 应用程序,我想向人们发送更新,但我不想回复单个文本。我只是想让他们在有问题时打电话。我一切正常,但我想在发送文本时显示传入文本,以确保我不会错过任何问题。我正在使用 p
我有一个带有表单的网站(目前它是纯 HTML,但我们正在切换到 JQuery)。流程是这样的: 接受用户的输入 --- 5 个整数 通过 REST 调用网络服务 在服务器端运行一些计算...并生成一个
假设我们有一个名为 configuration.js 的文件,当我们查看内部时,我们会看到: 'use strict'; var profile = { "project": "%Projec
这部分是对 Previous Question 的扩展我的: 我现在可以从我的 CI Controller 成功返回 JSON 数据,它返回: {"results":[{"id":"1","Sourc
有什么有效的方法可以删除 ios 中 CBL 的所有文档存储?我对此有疑问,或者,如果有人知道如何从本质上使该应用程序像刚刚安装一样,那也会非常有帮助。我们正在努力确保我们的注销实际上将应用程序设置为
我有一个 Rails 应用程序,它与其他 Rails 应用程序通信以进行数据插入。我使用 jQuery $.post 方法进行数据插入。对于插入,我的其他 Rails 应用程序显示 200 OK。但在
我正在为服务于发布请求的 API 调用运行单元测试。我正在传递请求正文,并且必须将响应作为帐户数据返回。但我只收到断言错误 注意:数据是从 Azure 中获取的 spec.js const accou
我是一名优秀的程序员,十分优秀!