2010-06-30 110 views
0

我遇到由mondrian OLAP服务器生成的查询问题。它需要很长时间。该查询如下所示。查询优化

select "TABLE1"."column0" as "c0" from "FACT_TABLE" as "FACT_TABLE", 
"TABLE7" as "TABLE7", 
"TABLE6" as "TABLE6", 
"TABLE5" as "TABLE5", 
"TABLE4" as "TABLE4", 
"TABLE4" as "TABLE3", 
"TABLE2" as "TABLE2", 
"TABLE1" as "TABLE2" 
where "FACT_TABLE"."column1" = 'VALUE' and 
"FACT_TABLE"."column2" =0 and 
"FACT_TABLE"."column3" = 0 and 
"TABLE2"."table1Fk" = "TABLE1"."table1Id" and 
"TABLE3"."table2Fk" = "TABLE2"."table2Id" and 
"TABLE4"."table3Fk" = "TABLE3"."table3Id" and 
"TABLE5"."table4Fk" = "TABLE4"."table4Id" and 
"TABLE6"."table5Fk" = "TABLE5"."table5Id" and 
"TABLE7"."table6Fk" = "TABLE6"."table6Id" and 
"FACT_TABLE"."table7Fk" = "TABLE7"."table7Id" 
    group by "TABLE1"."column0" 
    order by "TABLE1"."column0" ASC 

FACT_TABLE有1.346.000行aprox的。 TABLE7有895行aprox。 TABLE6有445行。 TABLE5有183行。 TABLE4有258行。 TABLE3 = TABLE4。 TABLE2有126行。 TABLE1有29行。

该查询在生产环境中采用2.00 seg aprox,我真的不知道如何改进查询性能。

即时通过8GB的RAM。 intel xeon L5420在2.50GHZ。 MSSQL 2005

我会apreciated任何帮助,你可以给我

回答

0

我会怀疑你没有在你的外键字段的索引。

这不会导致您的问题,但我个人不希望使用创建隐式而不是显式连接的工具。你怎么能相信那些使用18年前取而代之的语法的东西?

哦别的东西我刚刚注意到,我没有看到任何聚合,所以你为什么分组?

+0

问题是这个语法不是由我生成的。它由别人称为Mondrian生成的是一个OLAP服务器。我只是想知道如何改善这可能创建正确的索引或其他东西 – rfders 2010-06-30 22:05:17