Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Performance Issues on Insert with table contained in Full Text Search Expand / Collapse
Author
Message
Posted Wednesday, February 27, 2013 9:02 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, August 13, 2014 7:06 PM
Points: 1,068, Visits: 416
I have the following table


This tables gets around 650,000 Inserts per day and some of these inserts are taking over 1 second. There is a full text index On ChangeSet, EntityTypeText, SubEntityTypeText, And UserName.

The execution plan that follows is crazy.

So one question I have is that it looks like the application that is doing the inserts in using nvarchar while the table datatypes are varchar. This would cause implicit conversions correct? And could be part of the issue of why the insert takes so long? Also is the plan that crazy just because its part of a full text index?

This insert is causing blocking and long waits( write log waits and exclusive locks). Please let me know if you need more information.

THANKS


CREATE TABLE [dbo].[AuditLog](
[AuditLogID] [bigint] IDENTITY(1,1) NOT NULL,
[Application] [varchar](50) NOT NULL,
[AuditActionTypeID] [int] NOT NULL,
[AuditTypeID] [int] NOT NULL,
[ChangeSet] [xml] NULL,
[EntityTypeId] [int] NOT NULL,
[EntityTypeText] [varchar](100) NULL,
[SubEntityTypeId] [int] NULL,
[SubEntityTypeText] [varchar](100) NULL,
[CustomerId] [int] NOT NULL,
[PracticeId] [int] NULL,
[UserId] [int] NOT NULL,
[UserName] [varchar](50) NOT NULL,
[CreatedDate] [datetime] NOT NULL,
CONSTRAINT [PK_AuditLog] PRIMARY KEY CLUSTERED
(
[AuditLogID] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY]

GO


/****** Object: Index [IX_AuditLog_CustomerID_PracticeID_CreatedDate] Script Date: 02/27/2013 07:45:59 ******/
CREATE NONCLUSTERED INDEX [IX_AuditLog_CustomerID_PracticeID_CreatedDate] ON [dbo].[AuditLog]
(
[CustomerId] ASC,
[PracticeId] ASC,
[CreatedDate] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO



CREATE NONCLUSTERED INDEX [IX_AuditLog_EntityTypeID_CustomerID_PracticeID_AuditTypeID] ON [dbo].[AuditLog]
(
[EntityTypeId] ASC,
[CustomerId] ASC,
[PracticeId] ASC,
[AuditTypeID] ASC,
[CreatedDate] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
GO


CREATE NONCLUSTERED INDEX [IX_AuditLog_SubEntityTypeID_CustomerID_PracticeID_AuditTypeID] ON [dbo].[AuditLog]
(
[SubEntityTypeId] ASC,
[CustomerId] ASC,
[PracticeId] ASC,
[AuditTypeID] ASC,
[CreatedDate] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [PRIMARY]
GO

ALTER TABLE [dbo].[AuditLog] WITH CHECK ADD CONSTRAINT [FK_AuditLog_AuditActionType] FOREIGN KEY([AuditActionTypeID])
REFERENCES [dbo].[AuditActionType] ([AuditActionTypeID])
GO

ALTER TABLE [dbo].[AuditLog] CHECK CONSTRAINT [FK_AuditLog_AuditActionType]
GO

ALTER TABLE [dbo].[AuditLog] WITH CHECK ADD CONSTRAINT [FK_AuditLog_AuditType] FOREIGN KEY([AuditTypeID])
REFERENCES [dbo].[AuditType] ([AuditTypeID])
GO

ALTER TABLE [dbo].[AuditLog] CHECK CONSTRAINT [FK_AuditLog_AuditType]
GO


INSERT STATEMENT
(@Application nvarchar(4000),@AuditActionTypeID int,@AuditTypeID int,@ChangeSet nvarchar(4000), 
@CreatedDate datetime,@CustomerId int,@EntityTypeId int,
@EntityTypeText nvarchar(4000),@PracticeId int,@SubEntityTypeId int,@SubEntityTypeText
nvarchar(4000),@UserId int,@UserName nvarchar(4000))
INSERT
INTO dbo.AuditLog
(
Application ,
AuditActionTypeID ,
AuditTypeID ,
ChangeSet ,
EntityTypeId ,
EntityTypeText ,
SubEntityTypeId ,
SubEntityTypeText ,
CustomerId ,
PracticeId ,
UserId ,
UserName ,
CreatedDate
)
VALUES
(
@Application , -- Application - varchar(50)

@AuditActionTypeID , -- AuditActionTypeID - int

@AuditTypeID , -- AuditTypeID - int

@Changeset , -- ChangeSet - xml

@EntityTypeID , -- EntityTypeId - int

@EntityTypeText , -- EntityTypeText - varchar(100)

@SubEntityTypeID , -- SubEntityTypeId - int

@SubEntityTypeText , -- SubEntityTypeText - varchar(100)

@CustomerID , -- CustomerId - int

@PracticeID, -- PracticeId - int

@UserID, -- UserId - int

@UserName, -- UserName - varchar(50)

@CreatedDate -- CreatedDate - datetime

)

EXECUTION PLAN

<ShowPlanXML xmlns="http://schemas.microsoft.com/sqlserver/2004/07/showplan" Version="1.0" Build="9.00.5292.00">
<BatchSequence>
<Batch>
<Statements>
<StmtSimple StatementText="(@Application nvarchar(4000),@AuditActionTypeID int,@AuditTypeID int,@ChangeSet nvarchar(4000),@CreatedDate datetime,@CustomerId int,@EntityTypeId int,@EntityTypeText nvarchar(4000),@PracticeId int,@SubEntityTypeId int,@SubEntityTypeText nvarchar(4000),@UserId int,@UserName nvarchar(4000))INSERT INTO dbo.AuditLog ( Application , AuditActionTypeID , AuditTypeID , ChangeSet , EntityTypeId , EntityTypeText , SubEntityTypeId , SubEntityTypeText , CustomerId , PracticeId , UserId , UserName , CreatedDate ) VALUES ( @Application , -- Application - varchar(50) @AuditActionTypeID , -- AuditActionTypeID - int @AuditTypeID , -- AuditTypeID - int @Changeset , -- ChangeSet - xml @EntityTypeID , -- EntityTypeId - int @EntityTypeText , -- EntityTypeText - varchar(100) @SubEntityTypeID , -- SubEntityTypeId - int @SubEntityTypeText , -- SubEntityTypeText - varchar(100) @CustomerID , -- CustomerId - int @PracticeID, -- PracticeId - int @UserID, -- UserId - int @UserName, -- UserName - varchar(50) @CreatedDate -- CreatedDate - datetime ) " StatementId="1" StatementCompId="1" StatementType="INSERT" StatementSubTreeCost="0.0931649" StatementEstRows="1" StatementOptmLevel="FULL" StatementOptmEarlyAbortReason="GoodEnoughPlanFound">
<QueryPlan CachedPlanSize="135" CompileTime="5" CompileCPU="5" CompileMemory="872">
<RelOp NodeId="1" PhysicalOp="Assert" LogicalOp="Assert" EstimateRows="1" EstimateIO="0" EstimateCPU="1.8e-007" AvgRowSize="9" EstimatedTotalSubtreeCost="0.0931649" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList />
<Assert StartupExpression="0">
<RelOp NodeId="2" PhysicalOp="Nested Loops" LogicalOp="Left Semi Join" EstimateRows="1" EstimateIO="0" EstimateCPU="4.18e-006" AvgRowSize="9" EstimatedTotalSubtreeCost="0.0931647" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList>
<ColumnReference Column="Expr1040" />
<ColumnReference Column="Expr1041" />
</OutputList>
<NestedLoops Optimized="0">
<DefinedValues>
<DefinedValue>
<ColumnReference Column="Expr1041" />
</DefinedValue>
</DefinedValues>
<OuterReferences>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditTypeID" />
</OuterReferences>
<ProbeColumn>
<ColumnReference Column="Expr1041" />
</ProbeColumn>
<RelOp NodeId="3" PhysicalOp="Nested Loops" LogicalOp="Left Semi Join" EstimateRows="1" EstimateIO="0" EstimateCPU="4.18e-006" AvgRowSize="12" EstimatedTotalSubtreeCost="0.0898774" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditTypeID" />
<ColumnReference Column="Expr1040" />
</OutputList>
<NestedLoops Optimized="0">
<DefinedValues>
<DefinedValue>
<ColumnReference Column="Expr1040" />
</DefinedValue>
</DefinedValues>
<OuterReferences>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditActionTypeID" />
</OuterReferences>
<ProbeColumn>
<ColumnReference Column="Expr1040" />
</ProbeColumn>
<RelOp NodeId="4" PhysicalOp="Nested Loops" LogicalOp="Inner Join" EstimateRows="1" EstimateIO="0" EstimateCPU="4.18e-006" AvgRowSize="15" EstimatedTotalSubtreeCost="0.0865901" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditActionTypeID" />
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditTypeID" />
</OutputList>
<NestedLoops Optimized="0">
<OuterReferences>
<ColumnReference Column="Expr1042" />
<ColumnReference Column="Expr1030" />
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="docid" />
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</OuterReferences>
<RelOp NodeId="5" PhysicalOp="Nested Loops" LogicalOp="Inner Join" EstimateRows="1" EstimateIO="0" EstimateCPU="4.18e-006" AvgRowSize="482" EstimatedTotalSubtreeCost="0.0465804" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditActionTypeID" />
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditTypeID" />
<ColumnReference Column="Expr1042" />
<ColumnReference Column="Expr1030" />
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="docid" />
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</OutputList>
<NestedLoops Optimized="0">
<PassThru>
<ScalarOperator ScalarString="[IsBaseRow1032] IS NULL">
<Compare CompareOp="IS">
<ScalarOperator>
<Identifier>
<ColumnReference Column="IsBaseRow1032" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="NULL" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</PassThru>
<OuterReferences>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="docid" />
</OuterReferences>
<RelOp NodeId="6" PhysicalOp="Nested Loops" LogicalOp="Left Outer Join" EstimateRows="1" EstimateIO="0" EstimateCPU="4.18e-006" AvgRowSize="482" EstimatedTotalSubtreeCost="0.0432928" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditActionTypeID" />
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditTypeID" />
<ColumnReference Column="Expr1042" />
<ColumnReference Column="Expr1030" />
<ColumnReference Column="IsBaseRow1032" />
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="docid" />
</OutputList>
<NestedLoops Optimized="0">
<OuterReferences>
<ColumnReference Column="Expr1042" />
</OuterReferences>
<RelOp NodeId="7" PhysicalOp="Compute Scalar" LogicalOp="Compute Scalar" EstimateRows="1" EstimateIO="0" EstimateCPU="1e-007" AvgRowSize="477" EstimatedTotalSubtreeCost="0.0400056" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditActionTypeID" />
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditTypeID" />
<ColumnReference Column="Expr1042" />
<ColumnReference Column="Expr1030" />
</OutputList>
<ComputeScalar>
<DefinedValues>
<DefinedValue>
<ColumnReference Column="Expr1042" />
<ScalarOperator ScalarString="[Expr1042]">
<Identifier>
<ColumnReference Column="Expr1042" />
</Identifier>
</ScalarOperator>
</DefinedValue>
<DefinedValue>
<ColumnReference Column="Expr1030" />
<ScalarOperator ScalarString="gettimestamp((9))">
<Intrinsic FunctionName="gettimestamp">
<ScalarOperator>
<Const ConstValue="(9)" />
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</DefinedValue>
</DefinedValues>
<RelOp NodeId="8" PhysicalOp="Compute Scalar" LogicalOp="Compute Scalar" EstimateRows="1" EstimateIO="0" EstimateCPU="1e-007" AvgRowSize="469" EstimatedTotalSubtreeCost="0.0400055" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditActionTypeID" />
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditTypeID" />
<ColumnReference Column="Expr1042" />
</OutputList>
<ComputeScalar>
<DefinedValues>
<DefinedValue>
<ColumnReference Column="Expr1042" />
<ScalarOperator ScalarString="CONVERT_IMPLICIT(varbinary(900),[KareoAudit].[dbo].[AuditLog].[AuditLogID],0)">
<Convert DataType="varbinary" Length="900" Style="0" Implicit="1">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditLogID" />
</Identifier>
</ScalarOperator>
</Convert>
</ScalarOperator>
</DefinedValue>
</DefinedValues>
<RelOp NodeId="9" PhysicalOp="Clustered Index Insert" LogicalOp="Insert" EstimateRows="1" EstimateIO="0.04" EstimateCPU="4e-006" AvgRowSize="23" EstimatedTotalSubtreeCost="0.0400054" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditLogID" />
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditActionTypeID" />
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditTypeID" />
</OutputList>
<Update>
<Object Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Index="[PK_AuditLog]" />
<Object Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Index="[IX_AuditLog_EntityTypeID_CustomerID_PracticeID_AuditTypeID]" />
<Object Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Index="[IX_AuditLog_CustomerID_PracticeID_CreatedDate]" />
<Object Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Index="[IX_AuditLog_SubEntityTypeID_CustomerID_PracticeID_AuditTypeID]" />
<SetPredicate>
<ScalarOperator ScalarString="[KareoAudit].[dbo].[AuditLog].[Application] = RaiseIfNull([Expr1004]),[KareoAudit].[dbo].[AuditLog].[AuditActionTypeID] = RaiseIfNull([@AuditActionTypeID]),[KareoAudit].[dbo].[AuditLog].[AuditTypeID] = RaiseIfNull([@AuditTypeID]),[KareoAudit].[dbo].[AuditLog].[ChangeSet] = [Expr1005],[KareoAudit].[dbo].[AuditLog].[EntityTypeId] = RaiseIfNull([@EntityTypeId]),[KareoAudit].[dbo].[AuditLog].[EntityTypeText] = [Expr1006],[KareoAudit].[dbo].[AuditLog].[SubEntityTypeId] = [@SubEntityTypeId],[KareoAudit].[dbo].[AuditLog].[SubEntityTypeText] = [Expr1007],[KareoAudit].[dbo].[AuditLog].[CustomerId] = RaiseIfNull([@CustomerId]),[KareoAudit].[dbo].[AuditLog].[PracticeId] = [@PracticeId],[KareoAudit].[dbo].[AuditLog].[UserId] = RaiseIfNull([@UserId]),[KareoAudit].[dbo].[AuditLog].[UserName] = RaiseIfNull([Expr1008]),[KareoAudit].[dbo].[AuditLog].[CreatedDate] = RaiseIfNull([@CreatedDate]),[KareoAudit].[dbo].[AuditLog].[AuditLogID] = [Expr1003]">
<ScalarExpressionList>
<ScalarOperator>
<MultipleAssign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="Application" />
<ScalarOperator>
<Intrinsic FunctionName="RaiseIfNull">
<ScalarOperator>
<Identifier>
<ColumnReference Column="Expr1004" />
</Identifier>
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditActionTypeID" />
<ScalarOperator>
<Intrinsic FunctionName="RaiseIfNull">
<ScalarOperator>
<Identifier>
<ColumnReference Column="@AuditActionTypeID" />
</Identifier>
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditTypeID" />
<ScalarOperator>
<Intrinsic FunctionName="RaiseIfNull">
<ScalarOperator>
<Identifier>
<ColumnReference Column="@AuditTypeID" />
</Identifier>
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="ChangeSet" />
<ScalarOperator>
<Identifier>
<ColumnReference Column="Expr1005" />
</Identifier>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="EntityTypeId" />
<ScalarOperator>
<Intrinsic FunctionName="RaiseIfNull">
<ScalarOperator>
<Identifier>
<ColumnReference Column="@EntityTypeId" />
</Identifier>
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="EntityTypeText" />
<ScalarOperator>
<Identifier>
<ColumnReference Column="Expr1006" />
</Identifier>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="SubEntityTypeId" />
<ScalarOperator>
<Identifier>
<ColumnReference Column="@SubEntityTypeId" />
</Identifier>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="SubEntityTypeText" />
<ScalarOperator>
<Identifier>
<ColumnReference Column="Expr1007" />
</Identifier>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="CustomerId" />
<ScalarOperator>
<Intrinsic FunctionName="RaiseIfNull">
<ScalarOperator>
<Identifier>
<ColumnReference Column="@CustomerId" />
</Identifier>
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="PracticeId" />
<ScalarOperator>
<Identifier>
<ColumnReference Column="@PracticeId" />
</Identifier>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="UserId" />
<ScalarOperator>
<Intrinsic FunctionName="RaiseIfNull">
<ScalarOperator>
<Identifier>
<ColumnReference Column="@UserId" />
</Identifier>
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="UserName" />
<ScalarOperator>
<Intrinsic FunctionName="RaiseIfNull">
<ScalarOperator>
<Identifier>
<ColumnReference Column="Expr1008" />
</Identifier>
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="CreatedDate" />
<ScalarOperator>
<Intrinsic FunctionName="RaiseIfNull">
<ScalarOperator>
<Identifier>
<ColumnReference Column="@CreatedDate" />
</Identifier>
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditLogID" />
<ScalarOperator>
<Identifier>
<ColumnReference Column="Expr1003" />
</Identifier>
</ScalarOperator>
</Assign>
</MultipleAssign>
</ScalarOperator>
</ScalarExpressionList>
</ScalarOperator>
</SetPredicate>
<RelOp NodeId="10" PhysicalOp="Compute Scalar" LogicalOp="Compute Scalar" EstimateRows="1" EstimateIO="0" EstimateCPU="1e-007" AvgRowSize="1233" EstimatedTotalSubtreeCost="1.357e-006" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList>
<ColumnReference Column="Expr1003" />
<ColumnReference Column="Expr1004" />
<ColumnReference Column="Expr1005" />
<ColumnReference Column="Expr1006" />
<ColumnReference Column="Expr1007" />
<ColumnReference Column="Expr1008" />
</OutputList>
<ComputeScalar>
<DefinedValues>
<DefinedValue>
<ColumnReference Column="Expr1004" />
<ScalarOperator ScalarString="CONVERT_IMPLICIT(varchar(50),[@Application],0)">
<Convert DataType="varchar" Length="50" Style="0" Implicit="1">
<ScalarOperator>
<Identifier>
<ColumnReference Column="@Application" />
</Identifier>
</ScalarOperator>
</Convert>
</ScalarOperator>
</DefinedValue>
<DefinedValue>
<ColumnReference Column="Expr1005" />
<ScalarOperator ScalarString="CONVERT_IMPLICIT(xml,[@ChangeSet],0)">
<Convert DataType="xml" Style="0" Implicit="1">
<ScalarOperator>
<Identifier>
<ColumnReference Column="@ChangeSet" />
</Identifier>
</ScalarOperator>
</Convert>
</ScalarOperator>
</DefinedValue>
<DefinedValue>
<ColumnReference Column="Expr1006" />
<ScalarOperator ScalarString="CONVERT_IMPLICIT(varchar(100),[@EntityTypeText],0)">
<Convert DataType="varchar" Length="100" Style="0" Implicit="1">
<ScalarOperator>
<Identifier>
<ColumnReference Column="@EntityTypeText" />
</Identifier>
</ScalarOperator>
</Convert>
</ScalarOperator>
</DefinedValue>
<DefinedValue>
<ColumnReference Column="Expr1007" />
<ScalarOperator ScalarString="CONVERT_IMPLICIT(varchar(100),[@SubEntityTypeText],0)">
<Convert DataType="varchar" Length="100" Style="0" Implicit="1">
<ScalarOperator>
<Identifier>
<ColumnReference Column="@SubEntityTypeText" />
</Identifier>
</ScalarOperator>
</Convert>
</ScalarOperator>
</DefinedValue>
<DefinedValue>
<ColumnReference Column="Expr1008" />
<ScalarOperator ScalarString="CONVERT_IMPLICIT(varchar(50),[@UserName],0)">
<Convert DataType="varchar" Length="50" Style="0" Implicit="1">
<ScalarOperator>
<Identifier>
<ColumnReference Column="@UserName" />
</Identifier>
</ScalarOperator>
</Convert>
</ScalarOperator>
</DefinedValue>
</DefinedValues>
<RelOp NodeId="11" PhysicalOp="Compute Scalar" LogicalOp="Compute Scalar" EstimateRows="1" EstimateIO="0" EstimateCPU="1e-007" AvgRowSize="15" EstimatedTotalSubtreeCost="1.257e-006" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList>
<ColumnReference Column="Expr1003" />
</OutputList>
<ComputeScalar>
<DefinedValues>
<DefinedValue>
<ColumnReference Column="Expr1003" />
<ScalarOperator ScalarString="getidentity((2073058421),(9),NULL)">
<Intrinsic FunctionName="getidentity">
<ScalarOperator>
<Const ConstValue="(2073058421)" />
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(9)" />
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="NULL" />
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</DefinedValue>
</DefinedValues>
<RelOp NodeId="12" PhysicalOp="Constant Scan" LogicalOp="Constant Scan" EstimateRows="1" EstimateIO="0" EstimateCPU="1.157e-006" AvgRowSize="9" EstimatedTotalSubtreeCost="1.157e-006" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList />
<ConstantScan />
</RelOp>
</ComputeScalar>
</RelOp>
</ComputeScalar>
</RelOp>
</Update>
</RelOp>
</ComputeScalar>
</RelOp>
</ComputeScalar>
</RelOp>
<RelOp NodeId="35" PhysicalOp="Index Seek" LogicalOp="Index Seek" EstimateRows="1" EstimateIO="0.003125" EstimateCPU="0.0001581" AvgRowSize="12" EstimatedTotalSubtreeCost="0.0032831" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList>
<ColumnReference Column="IsBaseRow1032" />
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="docid" />
</OutputList>
<IndexScan Ordered="1" ScanDirection="FORWARD" ForcedIndex="0" NoExpandHint="0">
<DefinedValues>
<DefinedValue>
<ColumnReference Column="IsBaseRow1032" />
</DefinedValue>
<DefinedValue>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="docid" />
</DefinedValue>
</DefinedValues>
<Object Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Index="[i2]" />
<SeekPredicates>
<SeekPredicate>
<Prefix ScanType="EQ">
<RangeColumns>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="ftkey" />
</RangeColumns>
<RangeExpressions>
<ScalarOperator ScalarString="[Expr1042]">
<Identifier>
<ColumnReference Column="Expr1042" />
</Identifier>
</ScalarOperator>
</RangeExpressions>
</Prefix>
</SeekPredicate>
</SeekPredicates>
</IndexScan>
</RelOp>
</NestedLoops>
</RelOp>
<RelOp NodeId="37" PhysicalOp="Clustered Index Seek" LogicalOp="Clustered Index Seek" EstimateRows="1" EstimateIO="0.003125" EstimateCPU="0.0001581" AvgRowSize="9" EstimatedTotalSubtreeCost="0.0032831" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</OutputList>
<IndexScan Lookup="1" Ordered="1" ScanDirection="FORWARD" ForcedIndex="0" NoExpandHint="0">
<DefinedValues>
<DefinedValue>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</DefinedValue>
</DefinedValues>
<Object Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Index="[i1]" TableReferenceId="-1" />
<SeekPredicates>
<SeekPredicate>
<Prefix ScanType="EQ">
<RangeColumns>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="docid" />
</RangeColumns>
<RangeExpressions>
<ScalarOperator ScalarString="[KareoAudit].[sys].[fulltext_index_map_2073058421].[docid]">
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="docid" />
</Identifier>
</ScalarOperator>
</RangeExpressions>
</Prefix>
</SeekPredicate>
</SeekPredicates>
</IndexScan>
</RelOp>
</NestedLoops>
</RelOp>
<RelOp NodeId="41" PhysicalOp="Switch" LogicalOp="Switch" EstimateRows="1" EstimateIO="0" EstimateCPU="2e-007" AvgRowSize="9" EstimatedTotalSubtreeCost="0.0400055" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList />
<Switch>
<DefinedValues />
<RelOp NodeId="42" PhysicalOp="Assert" LogicalOp="Assert" EstimateRows="1" EstimateIO="0" EstimateCPU="1.8e-007" AvgRowSize="9" EstimatedTotalSubtreeCost="0.0400053" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList />
<Assert StartupExpression="0">
<RelOp NodeId="43" PhysicalOp="Clustered Index Update" LogicalOp="Update" EstimateRows="1" EstimateIO="0.04" EstimateCPU="4e-006" AvgRowSize="9" EstimatedTotalSubtreeCost="0.0400052" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList />
<Update>
<Object Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Index="[i1]" />
<Object Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Index="[i2]" />
<Object Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Index="[i3]" />
<Object Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Index="[i4]" />
<SetPredicate>
<ScalarOperator ScalarString="[KareoAudit].[sys].[fulltext_index_map_2073058421].[status] = RaiseIfNull([Expr1035]),[KareoAudit].[sys].[fulltext_index_map_2073058421].[ts] = RaiseIfNull([Expr1030])">
<ScalarExpressionList>
<ScalarOperator>
<MultipleAssign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
<ScalarOperator>
<Intrinsic FunctionName="RaiseIfNull">
<ScalarOperator>
<Identifier>
<ColumnReference Column="Expr1035" />
</Identifier>
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="ts" />
<ScalarOperator>
<Intrinsic FunctionName="RaiseIfNull">
<ScalarOperator>
<Identifier>
<ColumnReference Column="Expr1030" />
</Identifier>
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</Assign>
</MultipleAssign>
</ScalarOperator>
</ScalarExpressionList>
</ScalarOperator>
</SetPredicate>
<RelOp NodeId="44" PhysicalOp="Constant Scan" LogicalOp="Constant Scan" EstimateRows="1" EstimateIO="0" EstimateCPU="1.157e-006" AvgRowSize="9" EstimatedTotalSubtreeCost="1.157e-006" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList>
<ColumnReference Column="Expr1035" />
</OutputList>
<ConstantScan>
<Values>
<Row>
<ScalarOperator ScalarString="CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(1) THEN (1) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(152) THEN (144) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(208) THEN (144) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(144) THEN (144) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(8) THEN (1) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(0) THEN (0) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(184) THEN (176) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(240) THEN (176) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(176) THEN (176) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(2) THEN (1) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(192) THEN (128) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(128) THEN (128) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(3) THEN (0) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(224) THEN (160) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(160) THEN (160) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(4) THEN (0) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(5) THEN (0) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(6) THEN (0) ELSE CASE WHEN [KareoAudit].[sys].[fulltext_index_map_2073058421].[status]=(7) THEN (0) ELSE [KareoAudit].[sys].[fulltext_index_map_2073058421].[status] END END END END END END END END END END END END END END END END END END END">
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(1)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(1)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(152)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(144)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(208)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(144)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(144)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(144)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(8)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(1)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(0)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(0)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(184)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(176)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(240)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(176)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(176)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(176)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(2)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(1)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(192)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(128)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(128)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(128)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(3)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(0)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(224)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(160)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(160)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(160)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(4)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(0)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(5)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(0)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(6)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(0)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<IF>
<Condition>
<ScalarOperator>
<Compare CompareOp="EQ">
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(7)" />
</ScalarOperator>
</Compare>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(0)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
</Identifier>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Row>
</Values>
</ConstantScan>
</RelOp>
</Update>
</RelOp>
<Predicate>
<ScalarOperator ScalarString="CASE WHEN fulltextnotify((9),(6),(2073058421),[Expr1042]) IS NOT NULL THEN (0) ELSE NULL END">
<IF>
<Condition>
<ScalarOperator>
<Logical Operation="IS NOT NULL">
<ScalarOperator>
<Intrinsic FunctionName="fulltextnotify">
<ScalarOperator>
<Const ConstValue="(9)" />
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(6)" />
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(2073058421)" />
</ScalarOperator>
<ScalarOperator>
<Identifier>
<ColumnReference Column="Expr1042" />
</Identifier>
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</Logical>
</ScalarOperator>
</Condition>
<Then>
<ScalarOperator>
<Const ConstValue="(0)" />
</ScalarOperator>
</Then>
<Else>
<ScalarOperator>
<Const ConstValue="NULL" />
</ScalarOperator>
</Else>
</IF>
</ScalarOperator>
</Predicate>
</Assert>
</RelOp>
<RelOp NodeId="47" PhysicalOp="Clustered Index Insert" LogicalOp="Insert" EstimateRows="1" EstimateIO="0.04" EstimateCPU="4e-006" AvgRowSize="9" EstimatedTotalSubtreeCost="0.0400053" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList />
<Update>
<Object Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Index="[i1]" />
<Object Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Index="[i2]" />
<Object Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Index="[i3]" />
<Object Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Index="[i4]" />
<SetPredicate>
<ScalarOperator ScalarString="[KareoAudit].[sys].[fulltext_index_map_2073058421].[docid] = [Expr1038],[KareoAudit].[sys].[fulltext_index_map_2073058421].[status] = [Expr1039],[KareoAudit].[sys].[fulltext_index_map_2073058421].[ftkey] = RaiseIfNull([Expr1042]),[KareoAudit].[sys].[fulltext_index_map_2073058421].[ts] = RaiseIfNull([Expr1030])">
<ScalarExpressionList>
<ScalarOperator>
<MultipleAssign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="docid" />
<ScalarOperator>
<Identifier>
<ColumnReference Column="Expr1038" />
</Identifier>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="status" />
<ScalarOperator>
<Identifier>
<ColumnReference Column="Expr1039" />
</Identifier>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="ftkey" />
<ScalarOperator>
<Intrinsic FunctionName="RaiseIfNull">
<ScalarOperator>
<Identifier>
<ColumnReference Column="Expr1042" />
</Identifier>
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</Assign>
<Assign>
<ColumnReference Database="[KareoAudit]" Schema="[sys]" Table="[fulltext_index_map_2073058421]" Column="ts" />
<ScalarOperator>
<Intrinsic FunctionName="RaiseIfNull">
<ScalarOperator>
<Identifier>
<ColumnReference Column="Expr1030" />
</Identifier>
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</Assign>
</MultipleAssign>
</ScalarOperator>
</ScalarExpressionList>
</ScalarOperator>
</SetPredicate>
<RelOp NodeId="48" PhysicalOp="Compute Scalar" LogicalOp="Compute Scalar" EstimateRows="1" EstimateIO="0" EstimateCPU="1e-007" AvgRowSize="12" EstimatedTotalSubtreeCost="1.257e-006" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList>
<ColumnReference Column="Expr1038" />
<ColumnReference Column="Expr1039" />
</OutputList>
<ComputeScalar>
<DefinedValues>
<DefinedValue>
<ColumnReference Column="Expr1038" />
<ScalarOperator ScalarString="fulltextnotify((9),(6),(2073058421),NULL)">
<Intrinsic FunctionName="fulltextnotify">
<ScalarOperator>
<Const ConstValue="(9)" />
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(6)" />
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="(2073058421)" />
</ScalarOperator>
<ScalarOperator>
<Const ConstValue="NULL" />
</ScalarOperator>
</Intrinsic>
</ScalarOperator>
</DefinedValue>
<DefinedValue>
<ColumnReference Column="Expr1039" />
<ScalarOperator ScalarString="(0)">
<Const ConstValue="(0)" />
</ScalarOperator>
</DefinedValue>
</DefinedValues>
<RelOp NodeId="49" PhysicalOp="Constant Scan" LogicalOp="Constant Scan" EstimateRows="1" EstimateIO="0" EstimateCPU="1.157e-006" AvgRowSize="9" EstimatedTotalSubtreeCost="1.157e-006" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList />
<ConstantScan />
</RelOp>
</ComputeScalar>
</RelOp>
</Update>
</RelOp>
</Switch>
</RelOp>
</NestedLoops>
</RelOp>
<RelOp NodeId="55" PhysicalOp="Clustered Index Seek" LogicalOp="Clustered Index Seek" EstimateRows="1" EstimateIO="0.003125" EstimateCPU="0.0001581" AvgRowSize="9" EstimatedTotalSubtreeCost="0.0032831" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList />
<IndexScan Ordered="1" ScanDirection="FORWARD" ForcedIndex="0" NoExpandHint="0">
<DefinedValues />
<Object Database="[KareoAudit]" Schema="[dbo]" Table="[AuditActionType]" Index="[PK_AuditActionType]" />
<SeekPredicates>
<SeekPredicate>
<Prefix ScanType="EQ">
<RangeColumns>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditActionType]" Column="AuditActionTypeID" />
</RangeColumns>
<RangeExpressions>
<ScalarOperator ScalarString="[KareoAudit].[dbo].[AuditLog].[AuditActionTypeID]">
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditActionTypeID" />
</Identifier>
</ScalarOperator>
</RangeExpressions>
</Prefix>
</SeekPredicate>
</SeekPredicates>
</IndexScan>
</RelOp>
</NestedLoops>
</RelOp>
<RelOp NodeId="56" PhysicalOp="Clustered Index Seek" LogicalOp="Clustered Index Seek" EstimateRows="1" EstimateIO="0.003125" EstimateCPU="0.0001581" AvgRowSize="9" EstimatedTotalSubtreeCost="0.0032831" Parallel="0" EstimateRebinds="0" EstimateRewinds="0">
<OutputList />
<IndexScan Ordered="1" ScanDirection="FORWARD" ForcedIndex="0" NoExpandHint="0">
<DefinedValues />
<Object Database="[KareoAudit]" Schema="[dbo]" Table="[AuditType]" Index="[PK_AuditType]" />
<SeekPredicates>
<SeekPredicate>
<Prefix ScanType="EQ">
<RangeColumns>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditType]" Column="AuditTypeID" />
</RangeColumns>
<RangeExpressions>
<ScalarOperator ScalarString="[KareoAudit].[dbo].[AuditLog].[AuditTypeID]">
<Identifier>
<ColumnReference Database="[KareoAudit]" Schema="[dbo]" Table="[AuditLog]" Column="AuditTypeID" />
</Identifier>
</ScalarOperator>
</RangeExpressions>
</Prefix>
</SeekPredicate>
</SeekPredicates>
</IndexScan>
</RelOp>
</NestedLoops>
</RelOp>
<Predicate>
<ScalarOperator ScalarString="CASE WHEN [Expr1040] IS NULL THEN (0) ELSE CASE WHEN [Expr1041] IS NULL THEN (1) ELSE NULL END END">
<IF>
<Condition>
<ScalarOperator>
<Logical Operation="IS NULL">
<ScalarOperator>
<Identifier>
<ColumnReference Column="Expr1040" />
</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="Expr1041" />
</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>
<ParameterList>
<ColumnReference Column="@CreatedDate" ParameterCompiledValue="'2013-02-27 04:51:19.847'" />
<ColumnReference Column="@UserName" ParameterCompiledValue="N'Test User'" />
<ColumnReference Column="@UserId" ParameterCompiledValue="(64935)" />
<ColumnReference Column="@PracticeId" ParameterCompiledValue="(1)" />
<ColumnReference Column="@CustomerId" ParameterCompiledValue="(14391)" />
<ColumnReference Column="@SubEntityTypeText" ParameterCompiledValue="NULL" />
<ColumnReference Column="@SubEntityTypeId" ParameterCompiledValue="(0)" />
<ColumnReference Column="@EntityTypeText" ParameterCompiledValue="N'Marie Carter'" />
<ColumnReference Column="@EntityTypeId" ParameterCompiledValue="(78)" />
<ColumnReference Column="@ChangeSet" ParameterCompiledValue="NULL" />
<ColumnReference Column="@AuditTypeID" ParameterCompiledValue="(2)" />
<ColumnReference Column="@AuditActionTypeID" ParameterCompiledValue="(2)" />
<ColumnReference Column="@Application" ParameterCompiledValue="N'Audit Adapter'" />
</ParameterList>
</QueryPlan>
</StmtSimple>
</Statements>
</Batch>
</BatchSequence>
</ShowPlanXML>

Post #1424587
Posted Wednesday, February 27, 2013 10:32 AM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: Administrators
Last Login: Today @ 3:06 PM
Points: 33,169, Visits: 15,304
You definitely will get implicit conversions, which can be a huge slowdown. I'd fix this first.

The plan shows that the inserts to the AuditLog table, and then the full text table update and insert are the slowest parts. I'd work on the conversions first, and then see. I thought the FTIndex wasn't supposed to be an issue. It could be slow to catch up, but I didn't think it would cause slowness on inserts.







Follow me on Twitter: @way0utwest

Forum Etiquette: How to post data/code on a forum to get the best help
Post #1424644
Posted Wednesday, February 27, 2013 10:53 AM
Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Wednesday, August 13, 2014 7:06 PM
Points: 1,068, Visits: 416
Thanks.

I'll start there
Post #1424652
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse