想请教个问题
问题描述:1要记录电信级的通话记录
          2通话记录每天都会新增500-900万条记录
          3在客户查询某个号码的所有通话清单时能够在15秒内获得
请问我应该怎样设计这个表
有人提示我如下图的设计
  
我的问题:1、客户查询的时候查询的是那张表、数据分布是怎样的,最近一小时的消费记录在当前时间是否只保存在小时表中
          2、设计日表的原因
          

解决方案 »

  1.   

    那每天都需要新建一张表?那我要是查某个号码所以的消费记录,那不是要union all N个表了
    我认为gechangwei的方法根本不可行
      

  2.   

    该表应该有:year,month,day,service_id,call_date几个字段。
    对表按(year,month,day)做range partition,
    然后在(service_id,call_date)上建联合local index.查询时:
    1.查询某时间段:
    where year= 
    and month= 
    and day=
    and call_date between .. and ..(可用分区加index skip scan)
    2.查询某号码:
    where year=
    and month=
    and service_id=
    and call_date between ..一般的查询最多可能就看几个月,用year= and month between都能用上分区消除。