本文内容

  • 创建非聚簇的相关表
  • 创建聚簇
  • 简单查询比较

本文简单比较建立聚簇后,对查询的影响。虽然就几条数据,但多少也能说明点问题。有机会的话,再试下大数据量的比较。

创建非聚簇的相关模式对象


创建 EMPLOYEESDEPTMENTS 表。

-- Create table
create table EMPLOYEES
(
  EMPNO    NUMBER(4) not null,
  ENAME    VARCHAR2(10),
  JOB      VARCHAR2(9),
  MGR      NUMBER(4),
  HIREDATE DATE,
  SAL      NUMBER(7,2),
  COMM     NUMBER(7,2),
  DEPTNO   NUMBER(3)
)
tablespace MYTBS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Create/Recreate primary, unique and foreign key constraints 
alter table EMPLOYEES
  add constraint PK_EMPLOYEES_EMPNO primary key (EMPNO)
  using index 
  tablespace MYTBS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Create table
create table DEPTMENTS
(
  DEPTNO NUMBER(3) not null,
  DNAME  VARCHAR2(14),
  LOC    VARCHAR2(13)
)
tablespace MYTBS
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );
-- Create/Recreate primary, unique and foreign key constraints 
alter table DEPTMENTS
  add constraint PK_DEPTMENTS_DEPTNO primary key (DEPTNO)
  using index 
  tablespace MYTBS
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64K
    next 1M
    minextents 1
    maxextents unlimited
  );

相关文章:

  • 2021-11-30
  • 2021-10-25
  • 2021-05-05
  • 2021-12-26
猜你喜欢
  • 2021-10-05
  • 2021-11-17
  • 2021-05-20
  • 2021-09-25
相关资源
相似解决方案