【问题标题】:MDX date range with NON EMPTY clause is not slicing the data for the range带有 NON EMPTY 子句的 MDX 日期范围未对该范围的数据进行切片
【发布时间】:2015-06-09 07:31:44
【问题描述】:

我正在努力优化查询时间。但在我的情况下,case 1 和 case 2 返回相同的结果。 case 1 应返回特定数据范围的结果,即 [time].[2015].[5].[10] : [time].[2015].[6].[9],而不是仅返回 [time].[2015].[6].[9] 作为 case 2 的结果。 case 1 返回正确的结果,即范围的数据,但前提是您删除了非空子句。删除非空子句意味着它将搜索整个数据集,这又需要很多时间。再次case 3 返回正确的结果,但操作比第一种方法需要更多时间。遇到此类问题的任何人或可以指导我解决问题。

案例 1

WITH 
  MEMBER [Measures].[abc_type] AS 
    [abc].CurrentMember.Properties("abc_type") 
  MEMBER [Measures].[abc_desc] AS 
    [abc].CurrentMember.Properties("abc_desc") 
  MEMBER [Measures].[abc_class] AS 
    [abc].CurrentMember.Properties("abc_class") 
SELECT 
  NON EMPTY 
    {
      [Measures].[abc_type]
     ,[Measures].[abc_desc]
     ,[Measures].[abc_class]
    } ON COLUMNS
 ,NON EMPTY 
    Filter
    (
      {[abc].[abc_id].MEMBERS}
     ,St_contains
      (
        [district].[district_id].[1].Properties("the_geom")
       ,[abc].CurrentMember.Properties("the_geom")
      )
    ) ON ROWS
FROM [analytics_cube]
WHERE 
  [time].[2015].[5].[10] : [time].[2015].[6].[9];

案例 2

WITH 
  MEMBER [Measures].[abc_type] AS 
    [abc].CurrentMember.Properties("abc_type") 
  MEMBER [Measures].[abc_desc] AS 
    [abc].CurrentMember.Properties("abc_desc") 
  MEMBER [Measures].[abc_class] AS 
    [abc].CurrentMember.Properties("abc_class") 
SELECT 
  NON EMPTY 
    {
      [Measures].[abc_type]
     ,[Measures].[abc_desc]
     ,[Measures].[abc_class]
    } ON COLUMNS
 ,NON EMPTY 
    Filter
    (
      {[abc].[abc_id].MEMBERS}
     ,St_contains
      (
        [district].[district_id].[1].Properties("the_geom")
       ,[abc].CurrentMember.Properties("the_geom")
      )
    ) ON ROWS
FROM [analytics_cube]
WHERE 
  [time].[2015].[6].[9];

案例 3

WITH 
  MEMBER [Measures].[abc_type] AS 
    [abc].CurrentMember.Properties("abc_type") 
  MEMBER [Measures].[abc_desc] AS 
    [abc].CurrentMember.Properties("abc_desc") 
  MEMBER [Measures].[abc_class] AS 
    [abc].CurrentMember.Properties("abc_class") 
  MEMBER [time].[newtime] AS 
    Aggregate([time].[2015].[5].[10] : [time].[2015].[6].[9]) 
SELECT 
  NON EMPTY 
    {
      [Measures].[abc_type]
     ,[Measures].[abc_desc]
     ,[Measures].[abc_class]
    } ON COLUMNS
 ,NON EMPTY 
    Filter
    (
      {[abc].[abc_id].MEMBERS}
     ,St_contains
      (
        [district].[district_id].[1].Properties("the_geom")
       ,[abc].CurrentMember.Properties("the_geom")
      )
    ) ON ROWS
FROM [analytics_cube]
WHERE 
  [time].[newtime];

【问题讨论】:

    标签: mdx pentaho date-range mondrian


    【解决方案1】:

    时间范围总是由 Mondrian 评估为全级别扫描。它将加载给定时间级别的所有成员,并开始迭代成员,直到找到第一个边界。然后它将创建一个子列表,直到范围的最后一个成员。

    提交了一个将范围转换为 SQL 谓词 here 的增强请求。

    如果您有机会测试原型代码,请告诉我们它是如何为您工作的

    【讨论】:

    • 无法想象时间维度级别这么大?
    • 假设你需要查询5天,即[time].[2015].[5].[10] : [time].[2015].[5].[15],那么它也会搜索你的整个100万条记录并返回它。那我们就不能去天的范围了……?绩效只能针对特定的一天、一个月或一个季度?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-11
    • 2012-07-06
    • 1970-01-01
    • 1970-01-01
    • 2014-01-07
    相关资源
    最近更新 更多