StmtText
-----------------------
SET SHOWPLAN_TEXT ON
(1 row(s) affected)
StmtText
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
DECLARE @MessageStaging TABLE (
DeviceAddress char(17) Collate Database_Default,
PushPort smallint ,
LogDateTime datetime,
LogClass varchar(50) Collate Database_Default,
Media_ID int,
Campaign_ID int
)
INSERT INTO @MessageStag
(1 row(s) affected)
StmtText
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|--Table Insert(OBJECT:(@MessageStaging), SET:([DeviceAddress] = [Expr1004],[PushPort] = [Expr1005],[LogDateTime] = getdate(),[LogClass] = [Expr1007],[Media_ID] = [Expr1008],[Campaign_ID] = [Expr1009]), DEFINE:([Expr1004]='00:00:00:00:00:00', [Expr1005]=
(1 row(s) affected)
StmtText
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
INSERT
INTO OUI
( OUI
, Manufacturer )
SELECT DISTINCT LEFT(MessageStaging.DeviceAddress, 8)
, 'Unknown OUI, ' + CONVERT(VARCHAR(25), GETDATE(), 121)
FROM @MessageStaging As MessageStaging
LEFT OUTER
JOIN OUI
ON OUI.OUI
(1 row(s) affected)
StmtText
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|--Clustered Index Insert(OBJECT:([NewLoggingModel].[dbo].[OUI].[UK_OUI]), OBJECT:([NewLoggingModel].[dbo].[OUI].[PK_OUI]), SET:([NewLoggingModel].[dbo].[OUI].[OUI] = RaiseIfNull([Expr1012]),[NewLoggingModel].[dbo].[OUI].[Manufacturer] = RaiseIfNull([Exp
|--Compute Scalar(DEFINE:([Expr1012]=CONVERT_IMPLICIT(char(8),[Expr1009],0), [Expr1013]=CONVERT_IMPLICIT(varchar(100),[ConstExpr1014],0)))
|--Compute Scalar(DEFINE:([Expr1011]=getidentity((69575286),(7),NULL)))
|--Top(ROWCOUNT est 0)
|--Sort(DISTINCT ORDER BY:([Expr1009] ASC))
|--Compute Scalar(DEFINE:([ConstExpr1014]='Unknown OUI, '+CONVERT(varchar(25),getdate(),121)))
|--Filter(WHERE:([NewLoggingModel].[dbo].[OUI].[OUI] IS NULL))
|--Nested Loops(Left Outer Join, OUTER REFERENCES:([Expr1009]))
|--Compute Scalar(DEFINE:([Expr1009]=substring(@MessageStaging.[DeviceAddress] as [MessageStaging].[DeviceAddress],(1),(8))))
| |--Table Scan(OBJECT:(@MessageStaging AS [MessageStaging]))
|--Clustered Index Seek(OBJECT:([NewLoggingModel].[dbo].[OUI].[UK_OUI]), SEEK:([NewLoggingModel].[dbo].[OUI].[OUI]=[Expr1009]) ORDERED FORWARD)
(11 row(s) affected)
StmtText
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
INSERT
INTO Device
( OUI_ID
, Address
, PushPort )
SELECT DISTINCT
OUI.OUI_ID
, SUBSTRING(MessageStaging.DeviceAddress,10,8)
, MessageStaging.PushPort
FROM @MessageStaging As MessageStaging
INNER
JOIN OUI
(1 row(s) affected)
StmtText
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|--Assert(WHERE:(CASE WHEN [Expr1019] IS NULL THEN (0) ELSE NULL END))
|--Nested Loops(Left Semi Join, OUTER REFERENCES:([NewLoggingModel].[dbo].[Device].[OUI_ID]), DEFINE:([Expr1019] = [PROBE VALUE]))
|--Clustered Index Insert(OBJECT:([NewLoggingModel].[dbo].[Device].[PK_DeviceAddress]), OBJECT:([NewLoggingModel].[dbo].[Device].[idx_Device_OUI_ID_Address]), SET:([NewLoggingModel].[dbo].[Device].[OUI_ID] = [NewLoggingModel].[dbo].[OUI].[OUI_I
| |--Compute Scalar(DEFINE:([Expr1014]=CONVERT_IMPLICIT(char(8),[Expr1012],0)))
| |--Compute Scalar(DEFINE:([Expr1013]=getidentity((133575514),(7),NULL)))
| |--Top(ROWCOUNT est 0)
| |--Sort(DISTINCT ORDER BY:([NewLoggingModel].[dbo].[OUI].[OUI_ID] ASC, [Expr1012] ASC, [MessageStaging].[PushPort] ASC))
| |--Filter(WHERE:([NewLoggingModel].[dbo].[Device].[OUI_ID] IS NULL))
| |--Nested Loops(Left Outer Join, OUTER REFERENCES:([NewLoggingModel].[dbo].[OUI].[OUI_ID], [Expr1012]) OPTIMIZED)
| |--Nested Loops(Inner Join, OUTER REFERENCES:([Expr1018]))
| | |--Compute Scalar(DEFINE:([Expr1012]=substring(@MessageStaging.[DeviceAddress] as [MessageStaging].[DeviceAddress],(10),(8)), [Expr1018]=substring(@MessageStaging.[DeviceAddress] as [MessageStaging].[Devi
| | | |--Table Scan(OBJECT:(@MessageStaging AS [MessageStaging]))
| | |--Clustered Index Seek(OBJECT:([NewLoggingModel].[dbo].[OUI].[UK_OUI]), SEEK:([NewLoggingModel].[dbo].[OUI].[OUI]=[Expr1018]) ORDERED FORWARD)
| |--Index Seek(OBJECT:([NewLoggingModel].[dbo].[Device].[idx_Device_OUI_ID_Address]), SEEK:([NewLoggingModel].[dbo].[Device].[OUI_ID]=[NewLoggingModel].[dbo].[OUI].[OUI_ID] AND [NewLoggingModel].[dbo].[Device].
|--Index Seek(OBJECT:([NewLoggingModel].[dbo].[OUI].[PK_OUI]), SEEK:([NewLoggingModel].[dbo].[OUI].[OUI_ID]=[NewLoggingModel].[dbo].[Device].[OUI_ID]) ORDERED FORWARD)
(15 row(s) affected)
StmtText
-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
INSERT
INTO LogClass (Name)
SELECT DISTINCT MessageStaging.LogClass
FROM @MessageStaging As MessageStaging
LEFT OUTER
JOIN LogClass
ON LogClass.Name = MessageStaging.LogClass
WHERE LogClass.Name IS NULL
(1 row(s) affected)
StmtText
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|--Clustered Index Insert(OBJECT:([NewLoggingModel].[dbo].[LogClass].[PK_LogClass]), SET:([NewLoggingModel].[dbo].[LogClass].[Name] = RaiseIfNull(@MessageStaging.[LogClass] as [MessageStaging].[LogClass]),[NewLoggingModel].[dbo].[LogClass].[LogClass_ID]
|--Compute Scalar(DEFINE:([Expr1009]=getidentity((2105058535),(7),NULL)))
|--Top(ROWCOUNT est 0)
|--Sort(DISTINCT ORDER BY:([MessageStaging].[LogClass] ASC))
|--Filter(WHERE:([NewLoggingModel].[dbo].[LogClass].[Name] IS NULL))
|--Nested Loops(Left Outer Join, WHERE:([NewLoggingModel].[dbo].[LogClass].[Name]=@MessageStaging.[LogClass] as [MessageStaging].[LogClass]))
|--Table Scan(OBJECT:(@MessageStaging AS [MessageStaging]))
|--Clustered Index Scan(OBJECT:([NewLoggingModel].[dbo].[LogClass].[PK_LogClass]))
(8 row(s) affected)
StmtText
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
INSERT
INTO MessageLog
( Device_ID
, LogDateTime
, LogClass_ID
, Media_ID
, Campaign_ID
, ThinkTank_ID )
SELECT Device.Device_ID
, MessageStaging.LogDateTime
, LogClass.LogClass_ID
, MessageSta
(1 row(s) affected)
StmtText
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|--Assert(WHERE:(CASE WHEN [Expr1029] IS NULL THEN (0) ELSE CASE WHEN [Expr1030] IS NULL THEN (1) ELSE CASE WHEN [Expr1031] IS NULL THEN (2) ELSE NULL END END END))
|--Nested Loops(Left Semi Join, OUTER REFERENCES:([NewLoggingModel].[dbo].[MessageLog].[ThinkTank_ID]), DEFINE:([Expr1031] = [PROBE VALUE]))
|--Nested Loops(Left Semi Join, OUTER REFERENCES:([NewLoggingModel].[dbo].[MessageLog].[LogClass_ID]), DEFINE:([Expr1030] = [PROBE VALUE]))
| |--Nested Loops(Left Semi Join, OUTER REFERENCES:([NewLoggingModel].[dbo].[MessageLog].[Device_ID]) OPTIMIZED, DEFINE:([Expr1029] = [PROBE VALUE]))
| | |--Clustered Index Insert(OBJECT:([NewLoggingModel].[dbo].[MessageLog].[PK_MessageLog]), OBJECT:([NewLoggingModel].[dbo].[MessageLog].[_dta_index_MessageLog_7_277576027__K4_K3_K7_K2_K5]), SET:([NewLoggingModel].[dbo].[MessageLog].[Dev
| | | |--Compute Scalar(DEFINE:([ConstExpr1026]=CONVERT_IMPLICIT(int,'#LOCAL.ThinkTank.ThinkTank_ID#',0)))
| | | |--Compute Scalar(DEFINE:([Expr1015]=getidentity((277576027),(7),NULL)))
| | | |--Top(ROWCOUNT est 0)
| | | |--Nested Loops(Inner Join, OUTER REFERENCES:([NewLoggingModel].[dbo].[OUI].[OUI_ID], [Expr1027]) OPTIMIZED)
| | | |--Nested Loops(Inner Join, OUTER REFERENCES:([Expr1028]))
| | | | |--Hash Match(Inner Join, HASH:([MessageStaging].[LogClass])=([NewLoggingModel].[dbo].[LogClass].[Name]), RESIDUAL:(@MessageStaging.[LogClass] as [MessageStaging].[LogClass]=[NewLoggingModel].[dbo].[LogCl
| | | | | |--Compute Scalar(DEFINE:([Expr1027]=substring(@MessageStaging.[DeviceAddress] as [MessageStaging].[DeviceAddress],(10),(8)), [Expr1028]=substring(@MessageStaging.[DeviceAddress] as [MessageStaging].
| | | | | | |--Table Scan(OBJECT:(@MessageStaging AS [MessageStaging]))
| | | | | |--Clustered Index Scan(OBJECT:([NewLoggingModel].[dbo].[LogClass].[PK_LogClass]))
| | | | |--Clustered Index Seek(OBJECT:([NewLoggingModel].[dbo].[OUI].[UK_OUI]), SEEK:([NewLoggingModel].[dbo].[OUI].[OUI]=[Expr1028]) ORDERED FORWARD)
| | | |--Index Seek(OBJECT:([NewLoggingModel].[dbo].[Device].[idx_Device_OUI_ID_Address]), SEEK:([NewLoggingModel].[dbo].[Device].[OUI_ID]=[NewLoggingModel].[dbo].[OUI].[OUI_ID] AND [NewLoggingModel].[dbo].[Device].
| | |--Clustered Index Seek(OBJECT:([NewLoggingModel].[dbo].[Device].[PK_DeviceAddress]), SEEK:([NewLoggingModel].[dbo].[Device].[Device_ID]=[NewLoggingModel].[dbo].[MessageLog].[Device_ID]) ORDERED FORWARD)
| |--Clustered Index Seek(OBJECT:([NewLoggingModel].[dbo].[LogClass].[PK_LogClass]), SEEK:([NewLoggingModel].[dbo].[LogClass].[LogClass_ID]=[NewLoggingModel].[dbo].[MessageLog].[LogClass_ID]) ORDERED FORWARD)
|--Clustered Index Seek(OBJECT:([NewLoggingModel].[dbo].[ThinkTank].[PK_ThinkTank]), SEEK:([NewLoggingModel].[dbo].[ThinkTank].[ThinkTank_ID]=[NewLoggingModel].[dbo].[MessageLog].[ThinkTank_ID]) ORDERED FORWARD)
(19 row(s) affected)