oracle 分区表的相关索引

局部索引

create table sale_fact_part
partition by range(year)
( partition p_1997 values less than (1998),
  partition p_1998 values less than (1999),
  partition p_1999 values less than (2000),
  partition p_2000 values less than (2001),
  partition p_max values less than (maxvalue)
)
as select * from sale_fact;

create index idx_sale_fact_part on sale_fact_part(product,year) local;

全局索引

create index idx_sale_fact_part on sale_fact_part(year) 
global partition by range(year)
( partition p_1997 values less than (1998),
  partition p_1998 values less than (1999),
  partition p_1999 values less than (2000),
  partition p_2000 values less than (2001),
  partition p_max values less than (maxvalue)
)

散列分区索引

create table sale_fact_part
partition by  hash(id)
partitions 32
as
select seq1.nextval id,f.* from sales_fact f;

create unique index idx_sale_fact_part on sale_fact_part(id) local;

压缩索引

create index idx_name 
on schema.tabname(col1,col2...)
compress N 
Storage-parameter-clause;

基于函数的索引

基于函数的索引加入了一个虚拟列,所声明的表达式值作为默认值,然后在这个虚拟机列上建立索引。

create index idx_sale_fact_part on sales_fact_part(to_char(id));

反转键索引

create unique index idx_sale_fact_part on sale_fact_part(id) global reverse;

降序索引

create index idx_sale_fact on sales_fact (product desc,year desc,week desc)

不可见索引

alter index idx_sale_part invisible;

虚拟索引

create index idx_sale_part on sales(cust_id,promo_id) nosegment;
alter session set "_use_nosegment_indexes"=true;   #开启虚拟索引

位图索引

create bitmap index idx_sale_part on sales_fact_part(country) local;

索引组织表

create table sales_iot
( col1 int,
  col2 int,
  col3 int,
  col4 int,
  primary key(col1,col2)
)
organization index;

位图联结索引

create bitmap index idx_sale_part on sales (p.prod_name,c.cust_first_name,ch.channel_desc)
from  sales s,products p,customers c,channels ch
where       s.prod_id=p.prod_id 
       and  s.cust_id = c.cust_id
       and  s.channel_id = ch.channel_id
local;

rownum的用法

select * from (
select * from sales_fact where ...
) where rownum < 100;

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

请叫我曾阿牛

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值