《Microsoft SQL Server 2008 Analysis Services Step by Step》学习笔记十五:设计聚合(Aggregatio
SQL Server 2008中SQL应用系列及BI笔记系列--目录索引导读:本文继续介绍Analysis Services中设计聚合(Aggregations)。
本文将包括以下内容:
■1、使用Aggregation设计向导设计Aggregation
■2、通过创建属性关联和用户自定义层次来改善Aggregation
■3、使用AggregationUsage特性控制一个属性的聚合
■4、设计一个独立的Aggregation
■5、通过长期的数据量的估算改善Aggregation(Improve aggregation design by using long-term estimates of data volume)
■6、启用Analysis Services查询日志
■7、基于使用Usage-Based的优化向导的日志查询设计Aggregation
本文末尾提供两个项目源码:AdventureWorks_BI_Begin13和AdventureWorks_BI_End13,顾名思义,开始和完成。另外,包括数据库文件SSAS2008SBS_Data,请读者自行修改数据源ds的连接串。
4、不使用聚合向导设计聚合
下面我们不使用聚合设计向导设计聚合。
http://l3grwg.bay.livefilestore.com/y1psgwD7prxh82ue-pE64siNWNdzFDo6YemMviDCIG1LvMnG_NspN439scSTBMCLFRCuhHTVULKGbfdPK8FdLrrG8LUFQCL2SE5/2011-6-5%208-32-28.png?psid=1
http://l3grwg.bay.livefilestore.com/y1pl-4otQM9moS860OkMUaS7IQN3JsILLPw4v8-AFpAQwiVVN1kr-5hwhz-Bmo1CzWso5J-vrWaBzeo9bnKum1m3b4O9n1C6zfQ/2011-6-5%208-45-19.png?psid=1
改变Partition Counts
http://l3grwg.bay.livefilestore.com/y1pl-4otQM9moREtLQx5yA7MgURR6izbOd9bTDBiXZEOMixrjVqR94sQkJhS6G5BnfVVtLk0moaNobsxG1Mcwxa_4uKPUq3O37i/2011-6-5%208-48-43.png?psid=1
http://l3grwg.bay.livefilestore.com/y1pl-4otQM9moQliQAxPP1X35vK6MIr7P6LyauYC3FDmjGthSWrUAfnHD9LBsVhdzPn8FI4McU82IqA4Otdm7WMJiXCmjMA67Tf/2011-6-5%208-53-38.png?psid=1
http://l3grwg.bay.livefilestore.com/y1p3eT55MnPzfrLSkvTFf7xy4Bmo2SHiIm5eJxwXyXT7t3aLqao9StAyNshJX_087qljQpCKBI1mGXQvkvWVZevlYsKaBeyS2zg/2011-6-5%208-56-15.png?psid=1
http://l3grwg.bay.livefilestore.com/y1pQ3tLFsvij6Kvz7x_r7fmAwq_N1ndKDMx1DNE3CglijroOL8QGOG0i2G5aaymg7sGfBFAhSVD9isONlweI8TY7V88bB0obEmV/2011-6-5%208-57-17.png?psid=1
部署项目。
5-7、使用Usage-Based优化向导
除了使用聚合向导,还可以使用基于Usage-Based优化向导来设计聚合(http://64.4.11.252/zh-cn/library/ms189706(SQL.90).aspx),区别在于:
Usage-Based的优化向导用于为分区设计聚合,设计聚合时所基于的是 Analysis Services 实例查询日志中所记录的特定使用模式的查询。
聚合向导则考虑所有可能的查询。
我们启用查询日志
http://l3grwg.bay.livefilestore.com/y1pEhmUAHtGQ-WqbCVHoJRXJRMOBFqu9LCFVXluMN7mZU7kZum6Fn1GGMpEp8ib1_K3m5e2yfrH0P4KIJYlnWW_bjIV6IFcv5JJ/2011-6-5%2010-39-40.png?psid=1
http://l3grwg.bay.livefilestore.com/y1pp8EO_lidDWuS1_NFjbyoOr3On5BeZDXrccBShHulRutCsIRUvTSD9rnJnrGnnswwaVH7IG6qAGEi0PukC3JtdsRK2eackZ4c/2011-6-5%2010-34-20.png?psid=1
重新切换到vs项目,
http://l3grwg.bay.livefilestore.com/y1pfIubL_1xUGhQiroqCO16h3aIpbzHFQQrc9rRJnbWSlY7PUdpgmbr51MAqVzoCwHCQfjOg1RB0vbNwDtbE1wGwWfmlQCISLo_/2011-6-5%2010-52-27.png?psid=1
http://l3grwg.bay.livefilestore.com/y1p752VKqekF50Mi-CzAEet5mpfb-4Fox0nMBpZkbSyHoDVM5ouiVDaSnleABv6v0AZ-RYjcJkhj5cqDNYAfxsBSdqdKL-18RtR/2011-6-5%2010-55-13.png?psid=1
OLAPQueryLOG数据表的字段如下:
MSOLAP_Database: Name of the Analysis Services database
MSOLAP_ObjectPath: Fully qualifed name of the object that was queried in the format ServerName DatabaseName CubeName PartitionName
MSOLAP_User: Name of the user who executed the query
Dataset: A string of zeros and ones indicating the level of each attribute hierarchy used to provide the query resultsDon’t worry about trying
to interpret this string; the Usage-Based Optimization Wizard will interpret the string and display the names of the attribute hierarchies returned by a query
StartTime: Time the query began in Coordinated Universal Time (UTC)
Duration: Length of time, in milliseconds, that it took to execute the query
下面我们使用日志进行Usage-Based的优化聚合设计
http://l3grwg.bay.livefilestore.com/y1psss-_spVxP1PXR-MDEA5_6MKCgocNZFlQ-408qCp675ZrTW-SEea3GyTBepKCEnel3tvWdF9CgJ_MBJO2De7WhJSlrI27BON/2011-6-5%2011-04-37.png?psid=1
http://l3grwg.bay.livefilestore.com/y1phpnA9i4Cos_ti7v1c2FyPuiDdc8VE7ko4EFhTmFjop7frtXidVqyHN1sdQC8-ez76qckV_6wyglW_S1aKN7bO0_ukD8M_Ruc/2011-6-5%2011-06-29.png?psid=1
http://l3grwg.bay.livefilestore.com/y1pn9cOirisbUJQtEwonlfecCrnfd61Y2wAhuMY0huHE496e5LCzDUAUGSGAitAml9cBCC3Y8gysbw7vjesPZAYtJnsKb-P2TuX/2011-6-5%2011-07-02.png?psid=1
http://l3grwg.bay.livefilestore.com/y1phpnA9i4Cos9m0Whz1f2kSfwEKhZefOh_qzO74Ax14AC0KEIrKUk1cGtJ5XCB3Vqg4Rk-QR__wsEcl9VdP5HEvn8LxjZY9sP7/2011-6-5%2011-11-15.png?psid=1
http://l3grwg.bay.livefilestore.com/y1pG7rpDYMxeYvZbd4wsmzkmzml-petIvwFK7YnixFip1LO3Auz8CQn9-P0vGIIJs-F7SjOEiITRcNCCFljisiB9mm4jk2wyuHR/2011-6-5%2011-13-01.png?psid=1
http://l3grwg.bay.livefilestore.com/y1pd_Qc1jg9FVhST_S2zKenvlHKc3a2ZozSwiMLa-eiKYdrIyN3mLMIq0Fgz9WlcUyco0AQeEU8_OStrEpAH_paiuKbdUTVqDAI/2011-6-5%2011-16-20.png?psid=1
http://l3grwg.bay.livefilestore.com/y1pt1FzqsFPk-CiYdddZtc18xGxHllmJjMmKLyFajZpS_DxZ1XqDTe31NHkpPczzFe0kA1ZBBuZI42J4a3-ugGTFaN5--GYJDAZ/2011-6-5%2011-17-57.png?psid=1
http://l3grwg.bay.livefilestore.com/y1ps9hpTNT4NyjzqJj1BW6Fj4dKqLmf6nV3SZ2xuZDshTwA3rQsIQllqOJ95sqn1y9bWY4Aw_-oSoXa8rga9hMQJ8vhxfBNFqvm/2011-6-5%2011-18-32.png?psid=1
源码下载:
begin13
end13
数据库下载
参考资源:
1、SQL Server Analysis Services 官方教程
(http://technet.microsoft.com/zh-cn/library/ms170208.aspx)
页:
[1]