Using Oracle Data Storage Structures Efficiently

1.创建集群表

create cluster mycluster (deptno number(2)) size 1024;

]

 

2.为集群表创建索引

create index myc_idx on cluster mycluster;

 

3.创建普通表与集群表关联

create table dept(

 deptid number(2) primary key,

 dname varchar2(20),

 loc varchar2(30)

)

cluster mycluster(deptid);

 

create table emp(

empid number primary key,

ename varchar2(20),

sal number,

deptno number(2) references dept(deptid)

)

cluster mycluster(deptno)

 

修正

SQL > 4 修改第四行

SQL > c/number/number, 修改number为number,

 

4.创建partition 表

create table kk(

rk date,

data varchar2(20)

)

partition by range(rk)(

partition p1 values less than (to_date('2009-01-01','yyyy-mm-dd')) tablespace ts0,

partition p2 values less than ((to_date('2010-01-01','yyyy-mm-dd')) tablespace ts1

);

 

5.查看记录

select * from kk partition(p1);

 

6.涵盖所有记录

alter table kk add partition  p3 values less than (MAXVALUE) tablespace ts2;

 

7.创建Hash Partition 表

create table emp(

empno number,

ename varchar2(20)

)

partition by hash(empno)(

partition part1 tablespace ts1,

partition part2 tablespace ts2

);

 

8.创建List partition表

create table locations(

location_id number,

street_address varchar2(40),

city varchar2(20),

state_province(30),

country_id number)

) tablespace users

partition by LIST (state_province)

(partition region_east values('MA','NY','CT','ME','MD'),

partition  region_west values('CA','ZA'),

partition region_south values('TX','KY'),

partition region_default values(default)

 

9.创建组合分区表

create table composite1(

range_key date,

hash_key int,

data varchar2(20)

)

partition by range(range_key)

subpartition by hash(hash_key) subpartitions 2

(

  partition part1 values less than((to_date('2008-01-01','yyyy-mm-dd'))

  (

    subpartition h1,

    subpartition h2

  ),

 partition part2 values less than(to_date('2009-01-01','yyyy-mm-dd'))

 (

   subpartition h22,

   subpartition h21

 )

)

 

10.创建分区表索引

 1.local index

create index local_index on table1(a,b) local;

 

2.global index

 create index global_index on table1(b) global

partition by range(b)

(

 partition idx1 values less than (1000),

 partition idx2 values less than (MAXVALUE)

);

 

11.移动表

 alter table hr.employees move tablespace users;

 

12.压缩索引

 create index emp_index on hr.employee (last_name,first_name) compress.

 

alter index emp_index rebuild compress;

 

13. IOT表

create table T(id int primary key,

 y varchar2(2000),

 z varchar2(2000)

) organization index

pctthreshold 20/including y

overflow tablespace users;

 

 

 

 

 

 

 

 

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Rust数据结构是指在Rust编程语言中可以用于存储和组织数据的不同方式和类型。Rust提供了许多内置的数据结构,同时也可以使用各种第三方库来扩展这些数据结构。 常见的Rust数据结构包括: 1. 向量(Vectors):向量是一个动态长度的数组,可以在其中存储任意类型的数据。向量可以动态增长或缩小,也可以按索引访问元素。 2. 哈希映射(Hash Maps):哈希映射是一种键值对的数据结构,其中每个键都与一个唯一的值相关联。哈希映射的插入和查找操作的时间复杂度通常为O(1),因此在需要快速查找或数据去重的场景中非常有用。 3. 字符串(Strings):Rust中的字符串是一系列Unicode标量值的集合。它们可以通过字面量、转换或动态构建来创建和操作。Rust还提供了许多与字符串相关的方法和操作符。 4. 切片(Slices):切片是对数组或向量的引用,允许您引用整个集合或仅引用集合的一部分。切片非常适用于通过传递指定范围的数据来减少内存占用和提高性能的情况。 此外,还有很多其他数据结构可以在Rust中使用,例如堆栈、队列、链表等。Rust还提供了许多强大的工具和概念,如所有权、借用和生命周期,这些可以帮助开发人员安全地管理数据结构的访问和修改。 通过使用各种数据结构,Rust为开发人员提供了灵活和高效的方式来存储和操作数据,使他们能够更轻松地构建稳健和高性能的应用程序。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值