海信家电”换帅 “ 高玉玲接替代慧忠出任新任董事长
2024-11-22
set echo off feed off ver off pages 0 spool audon.sql select ’audit select on ’||owner||’.’||object_name||’ by access;’ from dba_objects where object_type in (’VIEW’,’TABLE’) and owner in (’ORDADM’); spool off set echo on feed on ver on |
audit select on ORDADM.DOCTOR_ORDERS by access; audit select on ORDADM.GROUP_ORDER_ITEMS by access; audit select on ORDADM.GROUP_ORDER_MASTER by access; audit select on ORDADM.ORDERS by access; audit select on ORDADM.ORDERS_COSTS by access; audit select on ORDADM.ORDERS_SHEET_IMAGE by access; audit select on ORDADM.VITAL_SIGNS_REC by access; |
create table aud_summary ( obj_name varchar2(30), owner varchar2(30), hits number); |
insert into aud_summary select obj_name,owner,count(*) from dba_audit_object group by obj_name,owner; |
set echo off feed off ver off pages 0 spool audoff.sql select ’noaudit select on ’||owner||’.’||object_name|| ’ by access;’ from dba_objects where object_type in (’VIEW’,’TABLE’) and owner in (’ORDADM’); spool off set echo on feed on ver on |
delete sys.aud$ |
col obj_name form a30 col owner form a20 col hits form 99,990 selec obj_name,owner,hits from aud_summary; OBJ_NAME OWNER COUNT(*) ----------- ------------- ---------- DOCTOR_ORDERS ORDADM 30309 DRUG_STOCK PHARMACY 11094 GROUP_ORDER_ITEMS ORDADM 1030 GROUP_ORDER_MASTER ORDADM 1196 ORDERS ORDADM 40421 ORDERS_COSTS ORDADM 10109 |
表 | 行数 | 命中率 |
doctor_orders | 2052709 | 30309 |
drug_stock | 2511 | 11094 |
group_order_item | 3800 | 1030 |
group_order_master | 186 | 1196 |
orders | 1633010 | 40421 |
orders_costs | 2403214 | 10109 |
Analyze table ORDADM.ORDERS estimate statistics sample 20 percent; |
select table_name,column_name,num_distinct from DBA_TAB_COLUMNS where owner like ’ORDADM’; |
列 | 不同的值 |
PATIENT_ID | 28720 |
VISIT_ID | 2 |
ORDER_NO | 395 |
ORDER_SUB_NO | 10 |
ORDER_CLASS | 9 |
ORDER_CODE | 825 |
ORDER_TEXT | 1551 |
ORDERING_DEPT | 15 |
START_DATE_TIME | 1194176 |
STOP_DATE_TIME | 636798 |
从表1-2中,我们可以看到欲分区表的各个候选分区键的分布频谱,ORDER_CODE(医嘱代码)键值没有出现一种均匀分布,用它作分区键,明显不合适;
ORDER_CLASS(医嘱类别代码)、ORDERING_DEPT(开医嘱科室代码),键值出现均匀分布,如用它的各个键值作基于范围的分区,每个分区具有的记录数比较均匀,但这种方法对于每天增加上万条记录的表来看,显然不是最优的。如果选用START_DATE_TIME(医嘱开始时间)建立范围分区,每月的数据建立一个分区,在每个分区内基于ORDERING_DEPT建立散列子分区,每月的数据形成一个组合分区,会使每个分区的记录数分布均匀、查询速度提高、易于备份和删除。因为大多数的统计和查询是在一个月的范围内,而且从实际的查询效果看,跨月和跨年数据的统计和查询速度,也比未分区的时候大大缩短,效果非常明显。
评论 {{userinfo.comments}}
{{child.content}}
{{question.question}}
提交