Hi all,
I have a simple OLTP database that i've created some views over to transform it into a star schema. This star schema is used to generate an extract (basically a denormalised select * from all views inner joined). The fact view has 1.2million rows
It runs in <3 minutes on 2008 Std sp3 (2 core, 4gb ram)
I've restored the db onto a 2014 enterprise SP1 server, converted the relevant tables into CCI - server is an azure vm (16 core, 114g ram)
sql 2014 is on SP1. they've been running for 30+minutes without returning a single row
The views by themselves run ok and in the same amount of time as on the 2008 box, but join them up and it all goes to hell VERY quickly.
The format of the views is
WITH North_Header AS (
SELECT DISTINCT x.buskey, 1 AS IsInferredMember FROM DB1.dbo.orderheader x
), North_Cust AS (
SELECT cust.buskey
, other dim attributes
, 0 AS IsInferredMember
FROM DB1.dbo.customers cust
),South_Header AS (
SELECT DISTINCT x.buskey, 1 AS IsInferredMember FROM DB2.dbo.orderheader x
), South_Cust AS (
SELECT cust.buskey
, other dim attributes
, 0 AS IsInferredMember
FROM DB2.dbo.customers cust
)
SELECT 'N-'+rtrim(ISNULL(c.buskey,h.buskey)) AS CustomerKey
, other dim attribs
, 'North' AS Source
, COUNT(*) OVER (PARTITION BY ISNULL((c.buskey,h.buskey)) AS DupeCheck
, ISNULL(c.IsInferredMember,h.IsInferredMember) AS IsInferredMember
FROM North_Header h
FULL JOIN North_Cust c
ON h.buskey = c.buskey
UNION ALL
SELECT 'S-'+rtrim(ISNULL(c.buskey,h.buskey)) AS CustomerKey
, other dim attribs
, 'South' AS Source
, COUNT(*) OVER (PARTITION BY ISNULL((c.buskey,h.buskey)) AS DupeCheck
, ISNULL(c.IsInferredMember,h.IsInferredMember) AS IsInferredMember
FROM South_Header h
FULL JOIN South_Cust c
ON h.buskey = c.buskey
GO
this caters for inferred members etc etc. This expands to a very complex overall query when you're joining about 10 views like this to a fact table that is itself a union all of two tables across two databases. Joins are done on the manufactured keys (like
CustomerKey above)
But the issue is that it's taking much less time on a old 2008 Standard instance of sql server on a much MUCH weaker machine.
It's not even beginning to complete on the 2014 box.
It's the same issue when using 'normal' indexed tables to perform this task.
Is there some bug or hotfix im not aware of?
Thanks
Jakub @ Melbourne, Australia <a href="http://jakubka.blogspot.com">Blog</a>