• 创建分区表


    --分区表,范围分区
    create table achievement(
    id number primary key,
    name varchar2(10),
    subject varchar2(10),
    score number)
    partition by range(score)
    (
     partition part1 values less than(60) tablespace users,
     partition part2 values less than(80) tablespace users,
     partition part3 values less than(maxvalue) tablespace users
    )
    
    insert into achievement values(3,'张天','Java',null);
    
    select * from achievement 
    select * from achievement partition(part3);
    
    --全并分区
    alter table achievement merge partitions part2,part3 into partition part4
    
    
    select * from achievement partition(part4);
    --删除分区
    alter table achievement drop partition part4
    
    
    如果没有使用maxvalue 值,则可以给范围分区表增分区
    alter table achievement add partition part5 values less than(120);
    当新增加的分区取值没有超过现在分区的最大值,系统会提示出错误
    
    
    --建立局部分区索引,各个分区索引之间是独立的
    create index achievement_index 
    on achievement (name) local
    (
    partition index1 tablespace users,
    partition index2 tablespace users,
    partition index3 tablespace users
    )
    
    --建立全局分区索引,各个分区索引之间不是独立的,分区索引和分区表之间也不是简单的一对一关系
    create index achievement_global_index 
    on achievement (score) global partition by range(score)
    (
    partition part1 values less than(60) tablespace users,
    partition part2 values less than(80) tablespace users,
    partition part3 values less than(maxvalue) tablespace users,
    )
  • 相关阅读:
    Sqlite && EF Code FIRST 终极解决方案 2019.5.17
    网卡 API 相关
    (依赖注入框架:Ninject ) 一 手写依赖注入
    Nlog 日志框架简单教程
    调试时候输出信息到输出窗口
    利用VS 性能探查器 解决代码性能不高问题
    Image 释放
    记一次数据丢失(电脑硬盘closed to down)的经历
    [极短]数字求和
    在博客园中使用pixijs
  • 原文地址:https://www.cnblogs.com/tianmingt/p/4085633.html
Copyright © 2020-2023  润新知