2

我有简单的 MDX 查询。执行它需要不到 1 秒的时间:

SELECT
NON EMPTY {  } ON COLUMNS,
NON EMPTY
  {[Z_OP].[LEVEL01].MEMBERS *
   [Z_NV].[LEVEL01].MEMBERS *
   [Z_DT].[LEVEL01].MEMBERS }
ON ROWS
FROM
  [Z_TEST/Z_TEST_REQ]

但是,当我使用 olap4j 库时,执行它需要超过 30 秒的时间。这是我的代码:

Class.forName("org.olap4j.driver.xmla.XmlaOlap4jDriver");
final String query = "[query]";
final Connection connection =
    DriverManager.getConnection(
        "jdbc:xmla:Server=[URL]?sap-client=200;catalog=[catalog]",
        "[login]",
        "[password]");

final OlapConnection olapConnection = connection.unwrap(OlapConnection.class);

final CellSet cellSet = olapConnection
    .createStatement()
    .executeOlapQuery(query);

我发现它额外发出 300 个“发现”请求来获取元数据(对于每个值成员/级别/属性等)。是否可以禁用或最小化这些请求的数量?

4

1 回答 1

0

这三个层次结构可能很大 - 如果您有一些可以与函数一起使用的度量,NonEmpty那么也许您可以添加一个WITH子句以在点击之前使集合更小SELECT

WITH 
   SET [OP] AS NONEMPTY([Z_OP].[LEVEL01].MEMBERS, [MEASURES].[EssentialMeasureInCube])
   SET [NV] AS NONEMPTY([Z_NV].[LEVEL01].MEMBERS, [MEASURES].[EssentialMeasureInCube])
   SET [DT] AS NONEMPTY([Z_DT].[LEVEL01].MEMBERS, [MEASURES].[EssentialMeasureInCube])
SELECT
  NON EMPTY {  } ON 0,
  NON EMPTY [OP] * [NV] * [DT] ON 1
FROM
  [Z_TEST/Z_TEST_REQ];
于 2015-09-16T15:06:34.560 回答