From: PhilBob on
Hey,

I have a created a report model which sits on top of a data warhouse, and
for the most part it works fine. I am having an issue where te sql generated
by the report is really bad and slowing down the report to crawl.

Here is an exmaple of the sql

SET DATEFIRST 7
SELECT
[BESPOKE_factStates2].[LinkedReferenceList] [LinkedReferenceList],
[BESPOKE_factStates].[RealTimeState] [RealTimeState],
[BESPOKE_factStates].[Ref] [Ref]
FROM
(
SELECT
[BESPOKE_factStates].[Ref] [RealTimeState],
[BESPOKE_factStates].[Ref] [Ref]
FROM
[Realtime].[BESPOKE_factStates] [BESPOKE_factStates]
) [BESPOKE_factStates]
LEFT OUTER JOIN (
SELECT
[BESPOKE_factStates].[Ref] [RealTimeState],
[BESPOKE_factStates].[Linked_ReferenceList] [LinkedReferenceList]
FROM
[Realtime].[BESPOKE_factStates] [BESPOKE_factStates]
) [BESPOKE_factStates2] ON [BESPOKE_factStates].[RealTimeState] =
[BESPOKE_factStates2].[RealTimeState]

If any more details are required please ask, I very stuck

Thanks

PhilBob
From: Uri Dimant on
Hi
Does not it work for you? Why do not you have a WHERE condition?
SELECT <columns> FROM BESPOKE_factStates AS BF1

LEFT JOIN BESPOKE_factStates AS BF2

ON BF1.[RealTimeState]=B2.[RealTimeState]





"PhilBob" <PhilBob(a)discussions.microsoft.com> wrote in message
news:044199A6-7027-4149-B640-037A0AB73CDB(a)microsoft.com...
> Hey,
>
> I have a created a report model which sits on top of a data warhouse, and
> for the most part it works fine. I am having an issue where te sql
> generated
> by the report is really bad and slowing down the report to crawl.
>
> Here is an exmaple of the sql
>
> SET DATEFIRST 7
> SELECT
> [BESPOKE_factStates2].[LinkedReferenceList] [LinkedReferenceList],
> [BESPOKE_factStates].[RealTimeState] [RealTimeState],
> [BESPOKE_factStates].[Ref] [Ref]
> FROM
> (
> SELECT
> [BESPOKE_factStates].[Ref] [RealTimeState],
> [BESPOKE_factStates].[Ref] [Ref]
> FROM
> [Realtime].[BESPOKE_factStates] [BESPOKE_factStates]
> ) [BESPOKE_factStates]
> LEFT OUTER JOIN (
> SELECT
> [BESPOKE_factStates].[Ref] [RealTimeState],
> [BESPOKE_factStates].[Linked_ReferenceList]
> [LinkedReferenceList]
> FROM
> [Realtime].[BESPOKE_factStates] [BESPOKE_factStates]
> ) [BESPOKE_factStates2] ON [BESPOKE_factStates].[RealTimeState] =
> [BESPOKE_factStates2].[RealTimeState]
>
> If any more details are required please ask, I very stuck
>
> Thanks
>
> PhilBob