SSAS 2019: Complex stored proc querying OLAP goes slower after upgrade
1
vote
0
answers
226
views
I've performed an in place upgrade of Windows 2012 to 2019 and SQL Server from 2016 to 2019 on my Dev server.
Since the upgrade we have found one *process* related to financial forecasting has slowed from 20 minutes to 35-40 minutes. Which is considered an unacceptable loss of performance.
The core of this process is a stored procedure which works through iterations of recursive queries including a Multidimensional OLAP cube.
The stored proc prepares an MDX query, then queries OLAP via a Linked server to a cube on the same server. The query returns the results to SQL Server and inserts the results in a table, which is then re-processed by the OLAP Cube. (The Cube uses ROLAP to update between iterations.)
Depending on how many years data is being processed (between 1 & 10) and the options selected, it could run through a step as described above 300-1500 times.
As far as I can tell SQL Server and SSAS Queries are running just as fast, yet the overall process is slower.
What have I done:
I ran SQL benchmark tests using Hammer Db. Comparing my Dev and Test servers. Win 2012 vs 2019 & SQL 2016 vs 2019. Both have 4 CPU's & 64Gb RAM with the same drive layout running on the same VMWare Host and SAN. The test returned comparible results. If anything Dev was marginally faster.
Timed results has me focussing on the SQL-SSAS-SQL loop. I created a test stored proc to run on on my Dev and Test servers. The SP prepares a simple query, hits olap, returns the result and inserts it into table. It does this 5 times. Not sure if it's improtant but i'll share it:
CREATE TABLE [dbo].[Loggy](
[Idx] [int] IDENTITY(1,1) NOT NULL,
[RunDT] [datetime] NULL,
[Measure] [varchar](255) NULL,
[Cnt] [int] NULL,
[Min] [float] NULL,
[Max] [float] NULL,
[DT] [datetime] NULL,
CONSTRAINT [PK_Loggy] PRIMARY KEY CLUSTERED
(
[Idx] 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
CREATE PROCEDURE [dbo].[Loopy] AS
BEGIN
SET NOCOUNT ON;
--I Do...
DECLARE
@RunDt as datetime,
@mdx_query as varchar(max),
@open_query as nvarchar(max),
@linked_server as varchar(max) = 'LNK_EBICUBE' ,
@Counter INT
SET @Counter=1
SET @RunDt = (Select GETDATE())
-- Prep MDX query
SET @mdx_query = '
SELECT NON EMPTY { [Measures].[Count of Values], [Measures].[Minimum Value], [Measures].[Maximum Value]} ON COLUMNS,
NON EMPTY { [Data Source].[Data Source Name].[Data Source Name].[Water Level] } ON ROWS
FROM ( SELECT ( { [Site].[Site Name].&[Waipaoa River at Kanakanaia] } ) ON COLUMNS
FROM [Environmental Data]) '
-- Prep query for inserting to log table
SET @open_query = '
INSERT INTO LOGGY ([Measure], [Cnt] , [Min] , [Max] )
SELECT *
FROM OpenQuery(' + @linked_server + ',''' + @mdx_query + ''')'
-- Create a while loop.. Run this 5 times.
WHILE ( @Counter <= 5)
BEGIN
-- Log the start of the execution.
INSERT INTO LOGGY ([RunDT], [Measure], [Cnt], [DT] )
VALUES (@RunDt, 'Start', @Counter ,Getdate())
--Execute open query
EXECUTE sp_executesql @open_query
-- Log the end of the execution.
INSERT INTO LOGGY ([RunDT], [Measure], [Cnt], [DT] )
VALUES (@RunDt, 'Stop', @Counter ,Getdate())
SET @Counter = @Counter + 1
END
END
GO
Using an extended events trace I have found each OLAP query seems about the same or even faster than before. But the overall process is slower.
The image above shows total time (start to finish) in milliseceonds running the same test SP on 2 servers, querying the same data in matching cubes.
Note: the test above was querying only and not processing a cube. This was only done to try and isolate and identify delays.
What I need to do is identify the causes of the delays. My boss wants an explanation.
Cheers
Pete
Edit: I need to rethink this: It's not just one query it's dozens. Hence providing an individual Query plan isn't going to cut it.

Asked by Sir Swears-a-lot
(3253 rep)
Jul 26, 2021, 04:55 AM
Last activity: Jul 30, 2021, 03:49 AM
Last activity: Jul 30, 2021, 03:49 AM