文章目录

  • 1 概述
  • 2 分区索引
    • 2.1 本地分区索引
    • 2.2 全局分区索引
    • 2.3 索引查询
  • 3 扩展
    • 3.1 表分区

1 概述

#mermaid-svg-sGSwuCo7gqIZ05IC {font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}#mermaid-svg-sGSwuCo7gqIZ05IC .error-icon{fill:#552222;}#mermaid-svg-sGSwuCo7gqIZ05IC .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-sGSwuCo7gqIZ05IC .edge-thickness-normal{stroke-width:2px;}#mermaid-svg-sGSwuCo7gqIZ05IC .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-sGSwuCo7gqIZ05IC .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-sGSwuCo7gqIZ05IC .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-sGSwuCo7gqIZ05IC .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-sGSwuCo7gqIZ05IC .marker{fill:#333333;stroke:#333333;}#mermaid-svg-sGSwuCo7gqIZ05IC .marker.cross{stroke:#333333;}#mermaid-svg-sGSwuCo7gqIZ05IC svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-sGSwuCo7gqIZ05IC .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-sGSwuCo7gqIZ05IC .cluster-label text{fill:#333;}#mermaid-svg-sGSwuCo7gqIZ05IC .cluster-label span{color:#333;}#mermaid-svg-sGSwuCo7gqIZ05IC .label text,#mermaid-svg-sGSwuCo7gqIZ05IC span{fill:#333;color:#333;}#mermaid-svg-sGSwuCo7gqIZ05IC .node rect,#mermaid-svg-sGSwuCo7gqIZ05IC .node circle,#mermaid-svg-sGSwuCo7gqIZ05IC .node ellipse,#mermaid-svg-sGSwuCo7gqIZ05IC .node polygon,#mermaid-svg-sGSwuCo7gqIZ05IC .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-sGSwuCo7gqIZ05IC .node .label{text-align:center;}#mermaid-svg-sGSwuCo7gqIZ05IC .node.clickable{cursor:pointer;}#mermaid-svg-sGSwuCo7gqIZ05IC .arrowheadPath{fill:#333333;}#mermaid-svg-sGSwuCo7gqIZ05IC .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-sGSwuCo7gqIZ05IC .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-sGSwuCo7gqIZ05IC .edgeLabel{background-color:#e8e8e8;text-align:center;}#mermaid-svg-sGSwuCo7gqIZ05IC .edgeLabel rect{opacity:0.5;background-color:#e8e8e8;fill:#e8e8e8;}#mermaid-svg-sGSwuCo7gqIZ05IC .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-sGSwuCo7gqIZ05IC .cluster text{fill:#333;}#mermaid-svg-sGSwuCo7gqIZ05IC .cluster span{color:#333;}#mermaid-svg-sGSwuCo7gqIZ05IC div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-sGSwuCo7gqIZ05IC :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;}

索引是否分区
非分区索引
普通索引
分区索引
本地分区索引:Local
本地前缀分区索引:Prefixed,索引列 = 分区列
全局分区索引:Global
不适用:位图索引
本地非前缀分区索引:Nonprefixed,索引列 <> 分区列

2 分区索引

2.1 本地分区索引

create table scott.partition (p_id   number,p_id2  number,p_name varchar2(50),p_date date
) partition by range(p_id)(partition p1 values less than (20000),partition p2 values less than (40000),partition p3 values less than (80000),partition p4 values less than (100000),partition p5 values less than (maxvalue)
);-- 试图创建本地分区索引
-- ORA-14024: local 索引的分区数必须等于基础表的分数数,如: 3 != 5
create index scott.partition_local on scott.partition(p_id)
local(partition p1,partition p2,partition p3);-- 创建本地分区索引
create index scott.partition_local on scott.partition(p_id)
local(partition p1, -- 索引分区个数 必须与 表分区数 完全对应partition p2,partition p3,partition p4,partition p5);-- drop index scott.partition_local;
-- 等同上述,写法简洁,推荐
create index scott.partition_local on scott.partition(p_id)
local;-- 默认:普通索引(非分区索引)
create index scott.partition_normal on scott.partition(p_name);-- p_id 是 表分区列,故 scott.partition_local 为 本地前缀分区索引
-- p_id2 不是 ..., 故 scott.partition_local2 为 本地非...
create index scott.partition_local2 on scott.partition(p_id2)
local;

2.2 全局分区索引

create index scott.partition_global on scott.partition(p_date)
global partition by range(p_date)
(partition pg1 values less than(to_date('2020-01-01', 'YYYY-MM-DD')),partition pg2 values less than(to_date('2021-01-01', 'YYYY-MM-DD')),partition pg3 values less than(to_date('2022-01-01', 'YYYY-MM-DD')),partition pg4 values less than(to_date('2023-01-01', 'YYYY-MM-DD')),partition pg5 values less than(maxvalue));-- drop index scott.partition_global;
-- 同理,若分区表已存在列分区,以下为简洁写法
create index scott.partition_global on scott.partition(p_date)
global;

2.3 索引查询

-- 分区索引
select * from dba_part_indexes;
select * from dba_ind_partitions;-- 普通索引
select * from dba_indexes;

3 扩展

3.1 表分区

  • Oracle 表分区详解(partition table)

Oracle 分区索引详解(local、global)相关推荐

  1. MS SQL Server:分区表、分区索引详解

    MS SQL Server:分区表.分区索引 详解 1. 分区表简介 使用分区表的主要目的,是为了改善大型表以及具有各种访问模式的表的可伸缩性和可管理性.  大型表:数据量巨大的表.  访问模式: ...

  2. ORACLE分区表、分区索引详解

    ORACLE分区表.分区索引ORACLE对于分区表方式其实就是将表分段存储,一般普通表格是一个段存储,而分区表会分成多个段,所以查找数据过程都是先定位根据查询条件定位分区范围,即数据在那个分区或那几个 ...

  3. oracle 分区表 字符串,ORACLE分区表、分区索引详解(转)

    今天逛论坛发现了一篇好文章,分享一下,自己也备个份,方便查找!! ORACLE分区表.分区索引ORACLE对于分区表方式其实就是将表分段存储,一般普通表格是一个段存储,而分区表会分成多个段,所以查找数 ...

  4. oracle索引图解,oracle 位图索引详解

    一.什么是位图索引 我们目前大量使用的索引一般主要是B*Tree索引,在索引结构中存储着键值和键值的RowID,并且是一一对应的. 而位图索引主要针对大量相同值的列而创建(例如:类别,操作员,部门ID ...

  5. oracle分区索引及循环插入

    表可以按range.hash.list分区,表分区后,其上的索引和普通表上的索引有所不同,oracle对于分区表上的索引分为2类,即局部索引和全局索引,下面分别对这2种索引的特点和局限性做个总结. 局 ...

  6. oracle数据库中索值,Oracle数据库中的索引详解

    Oracle数据库中的索引详解以下文字资料是由(历史新知网www.lishixinzhi.com)小编为大家搜集整理后发布的内容,让我们赶快一起来看一下吧! 一 ROWID的概念 存储了row在数据文 ...

  7. Oracle索引详解(索引的原理,创建索引,删除索引,修改索引等)

    Oracle索引详解 一.索引概述 Oracle作为关系型数据库,用户查找数据与行的物理位置无关,表中的每一行均用一个ROWID来标识,当Oracle数据库中存储海量的记录时,就意味着有大量的ROWI ...

  8. 如何获得Oracle分区索引类型

    碰巧在墨天轮上看资料就看到了eygle的这篇文章<如何获得 Oracle 分区索引的类型 - 全局分区索引.本地分区索引>,秉承了eygle大神一如既往的风格,文章"短小&quo ...

  9. oracle11 share pool,Oracle Shared pool 详解

    . Shared Pool概述 在之前的blog对的内存也做了一个概述,参考: Oracle内存架构详解 在网上搜到一篇介绍shared pool非常详细的pdf资料. 原文链接以找不到,但还是要感谢 ...

最新文章

  1. python中*args **kwargs用法
  2. P1131-[ZJOI2007]时态同步【树形dp】
  3. Oracle入门(六)之用户操作
  4. Spring 实现数据库读写分离
  5. [恢]hdu 2021
  6. python读取大文件性能_强悍的Python读取大文件的解决方案
  7. WordCount处理过程
  8. android 多行排列,安卓简单布局样例_采用LinearLayout实现多列多行展示
  9. 解决无法打开虚拟机的方法
  10. EF – 4.CRUD与事务
  11. 手机直播帧数测试软件,斗鱼直播伴侣帧数如何查看?帧数查看方法图文介绍
  12. 在线vim配色加term与gui统一颜色调整python脚本
  13. 不同品牌路由器无线桥接的设置方法
  14. 数据结构和算法二十一
  15. P1293 班级聚会
  16. PyQt5快速开发与实战 5.2 容器:装载更多的控件
  17. springboot报错 The Bean Validation API is on the classpath but no implementation could be found
  18. linux怎么找宝塔地址,宝塔Linux面板安全入口地址忘了(方法一)
  19. DBeaver显示Unknown database错误
  20. CGB2105-Day13

热门文章

  1. android 漏斗 动画,android 漏斗图
  2. android 手电筒 开源,1.【小萌伴Android】思量再三,终于鼓起勇气开源~
  3. Linux的su命令
  4. 预测泰坦尼克号生存问题
  5. 年收入100万的家庭如何买保险最划算?
  6. 面试典籍(整理于7.8-7.14)
  7. 腾讯自己的直播答题,如何实现稳定的性能输出
  8. 美摄科技X哔哩哔哩|“必剪”支持全面HDR,带来全新视觉体验
  9. Vue 3 父子组件传递数据的几种通信方式 (Prop、自定义事件、v-model...)
  10. Linux的超级用户及权限