Slow performance when processing a JSON file in Azure

  • We have a stored procedure that can load up a JSON file and process this in 12 seconds

    However on Azure ...this is taking up to 90 seconds. this is running on an Azure pay as you go database.

    Now the code isnt too complex as is doing the following. Code is shown... Json File is attached to this post

    is there anything that looks

    table creation

    USE [Logger_Groups_CI]
    GO
    /****** Object: Table [dbo].[Device] Script Date: 24/03/2023 16:56:33 ******/SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[Device](
    [DeviceID] [uniqueidentifier] NOT NULL,
    [SerialNumber] [nvarchar](255) NOT NULL,
    [ProductCode] [nvarchar](255) NULL,
    [Description] [nvarchar](255) NULL,
    [SoftwareVersion] [nvarchar](255) NULL,
    [Build] [nvarchar](255) NULL,
    [BuildDate] [datetime2](7) NULL,
    [Assigned] [bit] NULL,
    [GroupID] [uniqueidentifier] NULL,
    [UpdatedDateTime] [datetime2](7) NULL,
    [RestartPointerNo] [int] NULL,
    [DeviceConnectionIndex] [int] NULL,
    PRIMARY KEY CLUSTERED
    (
    [DeviceID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    /****** Object: Table [dbo].[DeviceChannel] Script Date: 24/03/2023 16:56:33 ******/SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE TABLE [dbo].[DeviceChannel](
    [DeviceChannelID] [uniqueidentifier] NOT NULL,
    [DeviceID] [uniqueidentifier] NOT NULL,
    [GroupID] [uniqueidentifier] NULL,
    [ChannelTypeID] [uniqueidentifier] NULL,
    [DerivedChannelID] [uniqueidentifier] NULL,
    [ChannelID] [int] NOT NULL,
    [ChannelName] [nvarchar](255) NULL,
    [IsInternal] [bit] NULL,
    [Dimension] [nvarchar](255) NULL,
    [Symbol] [nvarchar](255) NULL,
    [Upper] [real] NULL,
    [Lower] [real] NULL,
    [Precision] [int] NULL,
    [ConversionTypeID] [smallint] NULL,
    PRIMARY KEY CLUSTERED
    (
    [DeviceChannelID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    ) ON [PRIMARY]
    GO
    INSERT [dbo].[Device] ([DeviceID], [SerialNumber], [ProductCode], [Description], [SoftwareVersion], [Build], [BuildDate], [Assigned], [GroupID], [UpdatedDateTime], [RestartPointerNo], [DeviceConnectionIndex]) VALUES (N'4bed12a8-a835-4fd2-aec0-42854f010fe0', N'940860', N'TGRF-4024-A', N'Office Desk', N'1.2.928', N'4843', NULL, NULL, NULL, CAST(N'2023-03-23T15:52:25.0900000' AS DateTime2), 0, 2)
    GO
    INSERT [dbo].[Device] ([DeviceID], [SerialNumber], [ProductCode], [Description], [SoftwareVersion], [Build], [BuildDate], [Assigned], [GroupID], [UpdatedDateTime], [RestartPointerNo], [DeviceConnectionIndex]) VALUES (N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', N'926371', N'TGRF-4602-A', N'Office Bookcase', N'1.2.928', N'4843', NULL, NULL, NULL, CAST(N'2023-03-23T15:52:24.9600000' AS DateTime2), 0, 2)
    GO
    INSERT [dbo].[Device] ([DeviceID], [SerialNumber], [ProductCode], [Description], [SoftwareVersion], [Build], [BuildDate], [Assigned], [GroupID], [UpdatedDateTime], [RestartPointerNo], [DeviceConnectionIndex]) VALUES (N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', N'939029', N'ACSR-3600-A', N'Metrology Test Receiver', N'1.2.928', N'4829', NULL, NULL, NULL, CAST(N'2023-03-23T15:52:24.9666667' AS DateTime2), 0, 1)
    GO
    INSERT [dbo].[Device] ([DeviceID], [SerialNumber], [ProductCode], [Description], [SoftwareVersion], [Build], [BuildDate], [Assigned], [GroupID], [UpdatedDateTime], [RestartPointerNo], [DeviceConnectionIndex]) VALUES (N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', N'876302', N'TR-3020-A', N'TR-3020-A', N'1.4.1', N'4829', NULL, NULL, NULL, CAST(N'2023-03-23T15:52:25.2400000' AS DateTime2), 0, 2)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'7066e1a2-e721-421a-a1bc-0409091d0865', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 10, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'462fa47e-aab9-47d7-955e-0597196f2519', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 8, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'84e0b6e7-2dea-4d0c-a5f3-0787e4faedc0', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'f1bb73c1-99c5-4ebd-a259-02c126c470c7', NULL, 15, N'Vdd (Unloaded)', 1, N'voltage', N'V', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'c57c959d-b09a-456c-85c9-0a9411069203', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'f1bb73c1-99c5-4ebd-a259-02c126c470c7', NULL, 12, N'Vbatt_chk', 1, N'voltage', N'V', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'16e89e11-615e-4053-9dc6-0c5693500c30', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 3, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'598a5f4c-0c68-4519-bc0f-0d16ea407f9f', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 1, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'039d8364-8860-46c7-9dda-11e40ed44604', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'f1bb73c1-99c5-4ebd-a259-02c126c470c7', NULL, 18, N'Vdd (Unloaded)', 1, N'voltage', N'V', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'21685be5-8621-4bd7-ab31-124306803fb5', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'f1bb73c1-99c5-4ebd-a259-02c126c470c7', NULL, 16, N'Vdd (Loaded)', 1, N'voltage', N'V', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'07c94f96-c77c-4ee8-9301-16d2e4361faa', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 6, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'9c5fe2ef-1367-468e-b4ac-18514bc4e8a4', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 0, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'86873b2b-3722-4f44-961f-185b995fcf9c', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 1, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'baa4723d-db9e-4677-88d7-1969e3468056', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'272cf5f0-3d2e-457b-97f4-c2e529d40090', NULL, 15, N'Probe A Humidity', 1, N'humidity', N'%RH', 110, -10, 1, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'e0981b52-31d4-4f7a-83c0-1e7cb7019da1', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 2, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'd92ae5a4-2278-4ab8-9aa8-1ff38ab2be43', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 2, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'5eeb6c18-38ce-4c8c-b600-2451791e2339', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'bc4b5d35-7fe4-422c-afbc-0decd5d76415', NULL, 20, N'Probe B Dewpoint', 1, N'temperature', N'°C', 110, -10, 0, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'66066ee0-ba55-4e34-b90f-27bc7968fec3', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 4, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'dfff6a46-c8d5-4325-817c-2d4aeaa1a3dd', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 0, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'dd67aa02-6f29-40e4-a21b-38edc742af23', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'fc468c6f-22b4-41ce-8c5a-84c4e6e7d6fe', NULL, 14, N'Ambient Temperature', 1, N'temperature', N'°C', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'c358870d-3e01-4384-adc3-3cce464f8198', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 2, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'6f084dc1-4629-4512-a6b8-3ec4fd8235b3', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 4, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'e67147e4-c11d-45f9-b86e-440751025c6a', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 4, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'67dc175d-383b-4925-8c98-44a127f6ac8e', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'f1bb73c1-99c5-4ebd-a259-02c126c470c7', NULL, 15, N'Vbatt_chk', 1, N'voltage', N'V', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'a977d757-66ed-47dc-a13d-49c43be752be', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'bc4b5d35-7fe4-422c-afbc-0decd5d76415', NULL, 17, N'Dewpoint', 1, N'temperature', N'°C', 110, -10, 0, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'21733134-cf22-4b3f-b975-4cf684fcf856', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'272cf5f0-3d2e-457b-97f4-c2e529d40090', NULL, 11, N'Probe D', 1, N'temperature', N'°C', 125, -40, 1, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'c60fae15-9a3e-4930-8c8b-5ab942b6eed5', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 8, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'3c5a412c-d78e-4b77-9def-5eac11c566d7', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'272cf5f0-3d2e-457b-97f4-c2e529d40090', NULL, 12, N'Probe A Temperature', 1, N'temperature', N'°C', 85, -25, 1, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'0b62fc6a-396e-4a0c-8715-60d2a3a37293', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'fc468c6f-22b4-41ce-8c5a-84c4e6e7d6fe', NULL, 17, N'Ambient Temperature', 1, N'temperature', N'°C', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'923d5b8a-d2ff-4b53-8e9d-6137b6db2ad5', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 1, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'752b6ab8-b5be-40cc-b1bd-640b652e6591', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 9, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'28f06dd3-c260-44f8-81ee-686c56307396', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 2, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'3d63ce34-318a-43b5-b220-690fe6634d8e', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 7, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'ead7d749-36aa-41ef-8035-6d0d4515262b', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 9, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'a0ab6e94-7d38-499b-9b89-6ec86a104666', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 6, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'704cfb1b-3fb7-45f5-af74-71ddebf55a59', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'272cf5f0-3d2e-457b-97f4-c2e529d40090', NULL, 14, N'Humidity', 1, N'humidity', N'%RH', 110, -10, 1, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'0688c9a0-9667-4df4-a657-729c5fbc3bc4', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 5, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'95943706-d159-4c1a-bcb8-74a69c7e20f5', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'f1bb73c1-99c5-4ebd-a259-02c126c470c7', NULL, 14, N'Vdd (Loaded)', 1, N'voltage', N'V', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'd2fbf1f8-f001-4a86-b45d-757b1cf8ff09', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 7, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'7b72bc02-d455-4df2-bcc9-7960059b6bec', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'272cf5f0-3d2e-457b-97f4-c2e529d40090', NULL, 14, N'Probe A', 1, N'temperature', N'°C', 125, -40, 1, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'44364fbb-ae8c-41b5-b1fb-7cb8520b2d63', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 7, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'1be189b6-146a-44da-9b25-7e5d9b191513', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 8, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'2d3d650b-83e1-4a38-aaf0-7ffc982e534e', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'f1bb73c1-99c5-4ebd-a259-02c126c470c7', NULL, 13, N'Vdd (Loaded)', 1, N'voltage', N'V', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'ad46ff39-184b-49a7-b30c-82bce1939591', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 8, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'50d2fe58-f767-4adf-9c7e-8d86242319db', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 0, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'dbaa0f16-9c1d-42a5-bf80-903f2f28e012', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 6, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'93820d47-d01c-4b06-8dab-91eca7f0fd2f', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'272cf5f0-3d2e-457b-97f4-c2e529d40090', NULL, 16, N'Probe B Humidity', 1, N'humidity', N'%RH', 110, -10, 1, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'61a4a1fb-402d-4ec5-85ba-937ccec4d32c', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 4, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'42aefe5e-b393-4bf8-ae4a-97a57e30439a', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 9, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'c6623a97-03d8-4fc2-8298-98dd874b9d26', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'f1bb73c1-99c5-4ebd-a259-02c126c470c7', NULL, 12, N'Vbatt_chk', 1, N'voltage', N'V', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'358e4c55-78fe-432b-b862-9dc7d79fd910', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 7, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'73758f00-b6c2-4dbd-bc6d-9e2db9995d36', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'fc468c6f-22b4-41ce-8c5a-84c4e6e7d6fe', NULL, 17, N'Ambient Temperature', 1, N'temperature', N'°C', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'e7d324cf-8cb6-4485-a672-a543fc2be441', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'f1bb73c1-99c5-4ebd-a259-02c126c470c7', NULL, 16, N'Vdd (Unloaded)', 1, N'voltage', N'V', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'a3235db7-ed1b-42f1-abf7-a5e235941919', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 10, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'f7ae19ca-4e70-481e-b125-ae9c3dd22fa7', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 5, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'51895eaa-3691-4205-931c-afc92b249c5b', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'f1bb73c1-99c5-4ebd-a259-02c126c470c7', NULL, 13, N'Vbatt_chk', 1, N'voltage', N'V', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'907aedb3-23db-45b1-a055-b4b54ccca582', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'272cf5f0-3d2e-457b-97f4-c2e529d40090', NULL, 11, N'Temperature', 1, N'temperature', N'°C', 85, -25, 1, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'c97c9b9d-0b48-45f5-894a-b5ca4461e697', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 10, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'c3a04547-c564-48e0-a620-bf33ff77a183', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'bc4b5d35-7fe4-422c-afbc-0decd5d76415', NULL, 19, N'Probe A Dewpoint', 1, N'temperature', N'°C', 110, -10, 0, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'724cb0de-36e4-4a21-a1c0-c4c01814cc47', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 1, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'848e7ae6-bcb2-4615-8914-c9ab744e0b73', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'272cf5f0-3d2e-457b-97f4-c2e529d40090', NULL, 11, N'Temperature', 1, N'temperature', N'°C', 85, -40, 1, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'4189407f-4d00-4964-b694-d3c598bb83a3', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'272cf5f0-3d2e-457b-97f4-c2e529d40090', NULL, 13, N'Probe B', 1, N'temperature', N'°C', 125, -40, 1, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'5956544c-065a-4c6d-ad65-dba535df2220', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 5, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'deb7db5a-e132-4f84-b16b-dbb762182f57', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 3, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'be1b5acc-137f-47b9-810a-dc135e684de4', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 3, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'b4e06675-6aee-48c2-be93-dc165335146b', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'fc468c6f-22b4-41ce-8c5a-84c4e6e7d6fe', NULL, 15, N'Ambient Temperature', 1, N'temperature', N'°C', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'685d4e95-e54a-4bf3-bc2d-e24d1b92879f', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'272cf5f0-3d2e-457b-97f4-c2e529d40090', NULL, 12, N'Probe C', 1, N'temperature', N'°C', 125, -40, 1, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'd34175d6-19a7-4145-bb86-e627645bd1b2', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'272cf5f0-3d2e-457b-97f4-c2e529d40090', NULL, 11, N'Probe B Temperature', 1, N'temperature', N'°C', 85, -25, 1, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'321bcd2b-137b-4ac6-8782-ebf72cb2fa33', N'2b88abf1-16e1-48c4-afc7-a84b519c2e37', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 5, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'81711cf8-65d2-40da-b95f-eda4d6fbd46b', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 3, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'602c81c4-2a6b-4879-a623-efc97070e4fc', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 10, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'80cdc7d7-6001-4df8-a4b4-f5ef9be698a9', N'90393c4f-6e70-4d88-b8ef-bc23a7fe2987', NULL, N'f1bb73c1-99c5-4ebd-a259-02c126c470c7', NULL, 13, N'Vdd (Loaded)', 1, N'voltage', N'V', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'6819e57f-07ab-4d4b-9784-f628f1680829', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 6, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'2b49b3f9-7b79-4be3-bd55-f6d57cc4fced', N'8eaf1b0d-9583-487d-b62e-d232cab5c8bd', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 9, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'74d5f74d-e49f-48e6-9a28-f8a4c06e3ecc', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'f1bb73c1-99c5-4ebd-a259-02c126c470c7', NULL, 18, N'Vdd (Unloaded)', 1, N'voltage', N'V', NULL, NULL, NULL, 0)
    GO
    INSERT [dbo].[DeviceChannel] ([DeviceChannelID], [DeviceID], [GroupID], [ChannelTypeID], [DerivedChannelID], [ChannelID], [ChannelName], [IsInternal], [Dimension], [Symbol], [Upper], [Lower], [Precision], [ConversionTypeID]) VALUES (N'4951bc53-ef49-449f-ab01-faf83e1b6b9e', N'4bed12a8-a835-4fd2-aec0-42854f010fe0', NULL, N'f5524938-2e38-4324-8089-33542159be2b', NULL, 0, NULL, 1, N'', N'', NULL, NULL, NULL, 0)
    GO
    /****** Object: Index [DeviceChannel_DeviceID_ChannelId] Script Date: 24/03/2023 16:56:33 ******/ALTER TABLE [dbo].[DeviceChannel] ADD CONSTRAINT [DeviceChannel_DeviceID_ChannelId] UNIQUE NONCLUSTERED
    (
    [DeviceID] ASC,
    [ChannelID] ASC
    )WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
    GO
    ALTER TABLE [dbo].[Device] ADD DEFAULT (newid()) FOR [DeviceID]
    GO
    ALTER TABLE [dbo].[Device] ADD DEFAULT (getdate()) FOR [UpdatedDateTime]
    GO
    ALTER TABLE [dbo].[Device] ADD DEFAULT ((0)) FOR [RestartPointerNo]
    GO
    ALTER TABLE [dbo].[Device] ADD DEFAULT ((2)) FOR [DeviceConnectionIndex]
    GO
    ALTER TABLE [dbo].[DeviceChannel] ADD DEFAULT (newid()) FOR [DeviceChannelID]
    GO
    ALTER TABLE [dbo].[Device] WITH CHECK ADD CONSTRAINT [FKDevice_DeviceConnectionType] FOREIGN KEY([DeviceConnectionIndex])
    REFERENCES [dbo].[DeviceConnectionType] ([DeviceConnectionIndex])
    GO
    ALTER TABLE [dbo].[Device] CHECK CONSTRAINT [FKDevice_DeviceConnectionType]
    GO
    ALTER TABLE [dbo].[Device] WITH CHECK ADD CONSTRAINT [FKDevice951246] FOREIGN KEY([GroupID])
    REFERENCES [dbo].[Groups] ([GroupID])
    GO
    ALTER TABLE [dbo].[Device] CHECK CONSTRAINT [FKDevice951246]
    GO
    ALTER TABLE [dbo].[DeviceChannel] WITH CHECK ADD CONSTRAINT [FKDevice_DeviceChannel] FOREIGN KEY([DeviceID])
    REFERENCES [dbo].[Device] ([DeviceID])
    GO
    ALTER TABLE [dbo].[DeviceChannel] CHECK CONSTRAINT [FKDevice_DeviceChannel]
    GO
    ALTER TABLE [dbo].[DeviceChannel] WITH CHECK ADD CONSTRAINT [FKDeviceChan248448] FOREIGN KEY([ChannelTypeID])
    REFERENCES [dbo].[ChannelType] ([ChannelTypeID])
    GO
    ALTER TABLE [dbo].[DeviceChannel] CHECK CONSTRAINT [FKDeviceChan248448]
    GO
    ALTER TABLE [dbo].[DeviceChannel] WITH CHECK ADD CONSTRAINT [FKDeviceChan30310] FOREIGN KEY([ConversionTypeID])
    REFERENCES [dbo].[ConversionType] ([ConversionTypeID])
    GO
    ALTER TABLE [dbo].[DeviceChannel] CHECK CONSTRAINT [FKDeviceChan30310]
    GO
    ALTER TABLE [dbo].[DeviceChannel] WITH CHECK ADD CONSTRAINT [FKDeviceChan3820] FOREIGN KEY([GroupID])
    REFERENCES [dbo].[Groups] ([GroupID])
    GO
    ALTER TABLE [dbo].[DeviceChannel] CHECK CONSTRAINT [FKDeviceChan3820]
    GO
    ALTER TABLE [dbo].[DeviceChannel] WITH CHECK ADD CONSTRAINT [FKDeviceChan92763] FOREIGN KEY([DerivedChannelID])
    REFERENCES [dbo].[DerivedChannel] ([DerivedChannelID])
    GO
    ALTER TABLE [dbo].[DeviceChannel] CHECK CONSTRAINT [FKDeviceChan92763]
    GO

     

    And this is the code which is proving to be slow (Referecnes the attached JSON file)

    I suspect the join into DeviceChannel is slowing this down

    DECLARE @JSON NVARCHAR(MAX)
    DECLARE
    @DeviceIDUNIQUEIDENTIFIER = NULL,
    @DeviceSerialNumberNVARCHAR(10),
    @DataHashDtoSourceNVARCHAR(500),
    @NewDownloadTableNVARCHAR(5)


    -- change the path to point to a folder containing the JSON

    SELECT @JSON = BulkColumn
    FROM OPENROWSET (BULK 'C:\ChrisDev\Readings\926371.json', SINGLE_CLOB) as j



    DECLARE @Channel_Info TABLE
    (
    [ID]INTNOT NULLIDENTITY(1,1),
    ChannelIdINT,
    DeviceChannelIDUNIQUEIDENTIFIER ,
    ReadingDownloadTable NVARCHAR(100),
    MainLevelDataTable NVARCHAR(100),
    MainLevelDataTableRecordCountsTable NVARCHAR(100),
    ReadingsDTONVARCHAR(MAX)

    )


    SELECT
    @DeviceSerialNumber = device.DeviceSerialNumber,
    @DeviceID = D.DeviceID,
    @DataHashDtoSource = device.DataHashDto,
    @NewDownloadTable = device.NewDownloadTable
    FROM
    OPENJSON(@JSON)
    WITH
    (
    DeviceSerialNumberNVARCHAR(10)'$.DeviceSerialNumber',
    DataHashDto NVARCHAR(64)'$.DataHashDto',
    NewDownloadTableNVARCHAR(10)'$.NewDownloadTable'

    ) AS device

    LEFT JOIN
    Device D ON device.DeviceSerialNumber = D.SerialNumber


    INSERT INTO @Channel_Info(ChannelId, DeviceChannelID,ReadingDownloadTable,MainLevelDataTable,MainLevelDataTableRecordCountsTable,ReadingsDTO)
    --INSERT INTO @Channel_Info(ReadingsDTO)

    SELECT
    Channel.ChannelId,
    DC.DeviceChannelID,
    'ChannelReading_' + @DeviceSerialNumber + '_' + FORMAT( ((Channel.ChannelID)),'0#') + '_'+ CAST(DC.DeviceChannelID AS NVARCHAR(100)),
    'ChannelReading_' + @DeviceSerialNumber + '_' + FORMAT( ((Channel.ChannelID)),'0#') + '_'+ CAST(DC.DeviceChannelID AS NVARCHAR(100)) + '_MainLevelData',
    'ChannelReading_' + @DeviceSerialNumber + '_' + FORMAT( ((Channel.ChannelID)),'0#') +'_'+ CAST(DC.DeviceChannelID AS NVARCHAR(100)) + '_MainLevelData_TableRecordCounts',
    Channel.ReadingsDto
    FROM
    OPENJSON(@JSON,'$.ChannelReadings')
    WITH
    (
    ChannelId INT'$.ChannelId',
    ReadingsDto NVARCHAR(MAX) '$.ReadingsDto' AS JSON
    ) AS Channel
    JOIN
    DeviceChannel DC ON Channel.ChannelId = DC.ChannelID and dc.DeviceID = @DeviceID

     

    • This topic was modified 1 year, 9 months ago by  Weegee71.
    Attachments:
    You must be logged in to view attached files.
  • Thanks for posting your issue and hopefully someone will answer soon.

    This is an automated bump to increase visibility of your question.

  • This was removed by the editor as SPAM

  • The Azure pay as you go databases have several different levels you can set as to performance.  You don't say which choice you made, and using the absolute minimum will not perform very well.  You can change the setting to a higher performance level temporarily and test your code and then lower it when done.  While at the higher level you will pay more but if for short periods it is manageable.  Some testing with various levels will allow you to determine what sizing gives you comparable performance.

     

    Generally an on-prem Sql Server will be sized for max load which means many things will perform very well while all the choices in Azure take some experimentation to find acceptable performance at a reasonable cost.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply