wxlcanary 2015-06-29 17:56
浏览 854

如何设计数据库能优化查询速度

请教一个数据库设计相关的问题。为一个中型公司设计数据仓库,架构是从Staging databases -> Central OLTP Database -> Central OLAP Database, 最终在OLAP数据库上运行报表。所有的数据库用的都是SQL Server 2012。

设计1.尽量放主子表,保证主表和自标的Key都是数字。
主表: Account
字段:ID, AccountNumber, AccountName, AccountStatuSID, AccountPaymentTypeID ...........
A1 1010011 AN1 1 1
A2 1010012 AN2 3 2

子表1:AccountStatue
字段: AccountStatusID, AccountStatusName
1 Active
2 Inactive
3 Pending

子表2: AccountPaymentType
字段:AccountPaymentTypeID, AccountPaymentTypeName
1 Debit
2 Credit

其他子表就不一一举例了

设计2. 就一个主表,直接显示Name
主表: Account
字段:ID, AccountNumber, AccountName, AccountStatuS, AccountPaymentType ...........
A1 1010011 AN1 Active Debit
A2 1010012 AN2 Pending Credit

设计3. 就一个主表,显示ID和Name。报表运行时Where条件用ID
主表: Account
字段:ID, AccountNumber, AccountName, AccountStatuSID, AccountStatuS, AccountPaymentTypeID, AccountPaymentType ...........
A1 1010011 AN1 1 Active 1 Debit
A2 1010012 AN2 3 Pending 2 Credit

如果基于这种架构,如何设计OLAP数据库能得到最好的数据查询性能哪,并且易于ETL过程的Troubleshooting? 数据量几十G,几百G或几个T各适用哪个设计?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 js调用html页面需要隐藏某个按钮
    • ¥15 ads仿真结果在圆图上是怎么读数的
    • ¥20 Cotex M3的调试和程序执行方式是什么样的?
    • ¥20 java项目连接sqlserver时报ssl相关错误
    • ¥15 一道python难题3
    • ¥15 牛顿斯科特系数表表示
    • ¥15 arduino 步进电机
    • ¥20 程序进入HardFault_Handler
    • ¥15 oracle集群安装出bug
    • ¥15 关于#python#的问题:自动化测试