MDX查询执行了这么久

时间:2017-02-13 14:47:53

标签: mdx mondrian

我有一个MDX查询:

SELECT
{[Measures].[Count of Tickets], [Measures].[Ticket Average Per Day]} ON COLUMNS,
{[Specification].[Specification].Members} ON ROWS
FROM [Tickets Star Schema]
WHERE
({Filter([Creation Date].[Day].Members, [Creation Date].[Day].CurrentMember.Name >= '2017/02/06' AND [Creation Date].[Day].CurrentMember.Name <= '2017/02/13')} * ({[Ticket Type].[Ticket Type].[9145452713113549283], [Ticket Type].[Ticket Type].[9134488303913230171], [Ticket Type].[Ticket Type].[9138837241613081595], [Ticket Type].[Ticket Type].[9138836630013081453], [Ticket Type].[Ticket Type].[9134833380413407058], [Ticket Type].[Ticket Type].[9145452713113549281], [Ticket Type].[Ticket Type].[9134911151013454609], [Ticket Type].[Ticket Type].[9134783010613387189], [Ticket Type].[Ticket Type].[9134783010613387187], [Ticket Type].[Ticket Type].[9138837241613081613], [Ticket Type].[Ticket Type].[9134654662613285455], [Ticket Type].[Ticket Type].[9140432570013809078], [Ticket Type].[Ticket Type].[9145452972713549451], [Ticket Type].[Ticket Type].[9140432570013809076], [Ticket Type].[Ticket Type].[9138836630013081428], [Ticket Type].[Ticket Type].[9145452972713549453], [Ticket Type].[Ticket Type].[9145452972713549455], [Ticket Type].[Ticket Type].[9145452972713549457], [Ticket Type].[Ticket Type].[9145452972713549459], [Ticket Type].[Ticket Type].[9145609457713578112], [Ticket Type].[Ticket Type].[9134792932413392960], [Ticket Type].[Ticket Type].[9134833277313407014], [Ticket Type].[Ticket Type].[9134792932413392962], [Ticket Type].[Ticket Type].[9134911151013454617], [Ticket Type].[Ticket Type].[9134911151013454615], [Ticket Type].[Ticket Type].[9138836630013081446], [Ticket Type].[Ticket Type].[9145452713113549279], [Ticket Type].[Ticket Type].[9145452713113549277], [Ticket Type].[Ticket Type].[9138837241613081620], [Ticket Type].[Ticket Type].[9145452713113549275], [Ticket Type].[Ticket Type].[9139560292713345110], [Ticket Type].[Ticket Type].[9145609457713578108], [Ticket Type].[Ticket Type].[9134654662613285461], [Ticket Type].[Ticket Type].[9134654662613285463], [Ticket Type].[Ticket Type].[9139560292713345112], [Ticket Type].[Ticket Type].[9145609457713578106], [Ticket Type].[Ticket Type].[9134792932413392958], [Ticket Type].[Ticket Type].[9134488303913230179], [Ticket Type].[Ticket Type].[9135138327113743686], [Ticket Type].[Ticket Type].[9134783010613387181], [Ticket Type].[Ticket Type].[9134488303913230177]}))

我有一个聚合表,由mondrian在执行查询时使用。但是这个查询执行的时间太长了!当我不太重视&#34; Ticket Type&#34;过滤器,查询执行速度更快!请解释原因。

2 个答案:

答案 0 :(得分:0)

Crossjoins不是内存便宜的操作。尝试将“*”替换为“,”:

SELECT
{[Measures].[Count of Tickets], [Measures].[Ticket Average Per Day]} ON COLUMNS,
{[Specification].[Specification].Members} ON ROWS
FROM [Tickets Star Schema]
WHERE
({Filter([Creation Date].[Day].Members, [Creation Date].[Day].CurrentMember.Name >= '2017/02/06' AND [Creation Date].[Day].CurrentMember.Name <= '2017/02/13')}, ({[Ticket Type].[Ticket Type].[9145452713113549283], [Ticket Type].[Ticket Type].[9134488303913230171], [Ticket Type].[Ticket Type].[9138837241613081595], [Ticket Type].[Ticket Type].[9138836630013081453], [Ticket Type].[Ticket Type].[9134833380413407058], [Ticket Type].[Ticket Type].[9145452713113549281], [Ticket Type].[Ticket Type].[9134911151013454609], [Ticket Type].[Ticket Type].[9134783010613387189], [Ticket Type].[Ticket Type].[9134783010613387187], [Ticket Type].[Ticket Type].[9138837241613081613], [Ticket Type].[Ticket Type].[9134654662613285455], [Ticket Type].[Ticket Type].[9140432570013809078], [Ticket Type].[Ticket Type].[9145452972713549451], [Ticket Type].[Ticket Type].[9140432570013809076], [Ticket Type].[Ticket Type].[9138836630013081428], [Ticket Type].[Ticket Type].[9145452972713549453], [Ticket Type].[Ticket Type].[9145452972713549455], [Ticket Type].[Ticket Type].[9145452972713549457], [Ticket Type].[Ticket Type].[9145452972713549459], [Ticket Type].[Ticket Type].[9145609457713578112], [Ticket Type].[Ticket Type].[9134792932413392960], [Ticket Type].[Ticket Type].[9134833277313407014], [Ticket Type].[Ticket Type].[9134792932413392962], [Ticket Type].[Ticket Type].[9134911151013454617], [Ticket Type].[Ticket Type].[9134911151013454615], [Ticket Type].[Ticket Type].[9138836630013081446], [Ticket Type].[Ticket Type].[9145452713113549279], [Ticket Type].[Ticket Type].[9145452713113549277], [Ticket Type].[Ticket Type].[9138837241613081620], [Ticket Type].[Ticket Type].[9145452713113549275], [Ticket Type].[Ticket Type].[9139560292713345110], [Ticket Type].[Ticket Type].[9145609457713578108], [Ticket Type].[Ticket Type].[9134654662613285461], [Ticket Type].[Ticket Type].[9134654662613285463], [Ticket Type].[Ticket Type].[9139560292713345112], [Ticket Type].[Ticket Type].[9145609457713578106], [Ticket Type].[Ticket Type].[9134792932413392958], [Ticket Type].[Ticket Type].[9134488303913230179], [Ticket Type].[Ticket Type].[9135138327113743686], [Ticket Type].[Ticket Type].[9134783010613387181], [Ticket Type].[Ticket Type].[9134488303913230177]}))

答案 1 :(得分:0)

将Where子句替换为:

过滤器操作非常繁重,您可以使用范围(:)

轻松完成
WHERE
(
    {
        [Creation Date].[Day].[2017/02/06]:[Creation Date].[Day].[2017/02/13]
    },  
    {
        [Ticket Type].[Ticket Type].[9145452713113549283], 
        [Ticket Type].[Ticket Type].[9134488303913230171], 
        [Ticket Type].[Ticket Type].[9138837241613081595], 
        [Ticket Type].[Ticket Type].[9138836630013081453], 
        [Ticket Type].[Ticket Type].[9134833380413407058], 
        [Ticket Type].[Ticket Type].[9145452713113549281], 
        [Ticket Type].[Ticket Type].[9134911151013454609], 
        [Ticket Type].[Ticket Type].[9134783010613387189], 
        [Ticket Type].[Ticket Type].[9134783010613387187], 
        [Ticket Type].[Ticket Type].[9138837241613081613], 
        [Ticket Type].[Ticket Type].[9134654662613285455], 
        [Ticket Type].[Ticket Type].[9140432570013809078], 
        [Ticket Type].[Ticket Type].[9145452972713549451], 
        [Ticket Type].[Ticket Type].[9140432570013809076], 
        [Ticket Type].[Ticket Type].[9138836630013081428], 
        [Ticket Type].[Ticket Type].[9145452972713549453], 
        [Ticket Type].[Ticket Type].[9145452972713549455], 
        [Ticket Type].[Ticket Type].[9145452972713549457], 
        [Ticket Type].[Ticket Type].[9145452972713549459], 
        [Ticket Type].[Ticket Type].[9145609457713578112], 
        [Ticket Type].[Ticket Type].[9134792932413392960], 
        [Ticket Type].[Ticket Type].[9134833277313407014], 
        [Ticket Type].[Ticket Type].[9134792932413392962], 
        [Ticket Type].[Ticket Type].[9134911151013454617], 
        [Ticket Type].[Ticket Type].[9134911151013454615], 
        [Ticket Type].[Ticket Type].[9138836630013081446], 
        [Ticket Type].[Ticket Type].[9145452713113549279], 
        [Ticket Type].[Ticket Type].[9145452713113549277], 
        [Ticket Type].[Ticket Type].[9138837241613081620], 
        [Ticket Type].[Ticket Type].[9145452713113549275], 
        [Ticket Type].[Ticket Type].[9139560292713345110], 
        [Ticket Type].[Ticket Type].[9145609457713578108], 
        [Ticket Type].[Ticket Type].[9134654662613285461], 
        [Ticket Type].[Ticket Type].[9134654662613285463], 
        [Ticket Type].[Ticket Type].[9139560292713345112], 
        [Ticket Type].[Ticket Type].[9145609457713578106], 
        [Ticket Type].[Ticket Type].[9134792932413392958], 
        [Ticket Type].[Ticket Type].[9134488303913230179], 
        [Ticket Type].[Ticket Type].[9135138327113743686], 
        [Ticket Type].[Ticket Type].[9134783010613387181], 
        [Ticket Type].[Ticket Type].[9134488303913230177]
    }
)