数据库:Oracle 11gOracle 11g此表的分区策略
我正在开发一个新建项目并设计数据库模式。我有一个审计表,顾名思义, 最终将成长为拥有大量记录。以下是表定义(修剪无关列后)。
create table ClientAudit (
id number(19,0) primary key,
clientId number(19,0) not null,
createdOn timestamp with time zone default systimestamp not null
);
id是由oracle序列填充的自然数。
clientId是一个唯一的客户端标识符。
为了便于查询的报告,我创建一个下面的视图为好,这给基于createdOn为每个客户端的最新记录,:
create or replace view ClientAuditView
as
select * from (
select ca.*,max(ca.createdOn) keep (dense_rank last order by ca.createdOn)
over (partition by ca.clientId) maxCreatedOn
from ClientAudit ca
)
where createdOn=maxCreatedOn;
/
我不知道什么应该在这里,如果分区键我将分区ClientAudit表。
它应该是ClientId还是CreatedOn?
什么应该是分区策略?