Oracle全文索引的性能优势实例

WBOY
풀어 주다: 2016-06-07 16:44:36
원래의
931명이 탐색했습니다.

一、实验说明: 操作系统:rhel 5.4 x86 数据库:Oracle 11g R2 二、操作步骤: 2.1、首先创建一个表t_btree,并创建

Linux公社

首页 → 数据库技术

背景:

阅读新闻

Oracle全文索引的性能优势实例

[日期:2014-10-08] 来源:Linux公社  作者:Linux [字体:]

一、实验说明:

     操作系统:rhel 5.4 x86

    数据库:Oracle 11g R2

二、操作步骤:

  2.1、首先创建一个表t_btree,并创建B-Tree索引,索引键是object_name:

SQL> create table t_btree as select * from dba_objects;

Table created.

SQL> create index ind_btree on t_btree(object_name);

Index created.

接着是执行下面的查询语句两次:

SQL> set linesize 150;
SQL> set autotrace on;
SQL> select count(*) from t_btree where t_btree.object_name like '%ObjectStreamClass%';

  COUNT(*)
----------
    84


Execution Plan
----------------------------------------------------------
Plan hash value: 3266099700

-----------------------------------------------------------------------------------
| Id  | Operation          | Name      | Rows  | Bytes | Cost (%CPU)| Time      |
-----------------------------------------------------------------------------------
|  0 | SELECT STATEMENT      |      |    1 |    66 |  103  (0)| 00:00:02 |
|  1 |  SORT AGGREGATE      |      |    1 |    66 |          |      |
|*  2 |  INDEX FAST FULL SCAN| IND_BTREE |    12 |  792 |  103  (0)| 00:00:02 |
-----------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

  2 - filter("T_BTREE"."OBJECT_NAME" IS NOT NULL AND
          "T_BTREE"."OBJECT_NAME" LIKE '%ObjectStreamClass%')

Note
-----
  - dynamic sampling used for this statement (level=2)


Statistics
----------------------------------------------------------
    28  recursive calls
      0  db block gets
    454  consistent gets
    726  physical reads
      0  redo size
    422  bytes sent via SQL*Net to client
    419  bytes received via SQL*Net from client
      2  SQL*Net roundtrips to/from client
      0  sorts (memory)
      0  sorts (disk)
      1  rows processed

SQL> select count(*) from t_btree where t_btree.object_name like '%ObjectStreamClass%';

  COUNT(*)
----------
    84


Execution Plan
----------------------------------------------------------
Plan hash value: 3266099700

-----------------------------------------------------------------------------------
| Id  | Operation          | Name      | Rows  | Bytes | Cost (%CPU)| Time      |
-----------------------------------------------------------------------------------
|  0 | SELECT STATEMENT      |      |    1 |    66 |  103  (0)| 00:00:02 |
|  1 |  SORT AGGREGATE      |      |    1 |    66 |          |      |
|*  2 |  INDEX FAST FULL SCAN| IND_BTREE |    12 |  792 |  103  (0)| 00:00:02 |
-----------------------------------------------------------------------------------

Predicate Information (identified by operation id):
---------------------------------------------------

  2 - filter("T_BTREE"."OBJECT_NAME" IS NOT NULL AND
          "T_BTREE"."OBJECT_NAME" LIKE '%ObjectStreamClass%')

Note
-----
  - dynamic sampling used for this statement (level=2)


Statistics
----------------------------------------------------------
      0  recursive calls
      0  db block gets
    369  consistent gets
      0  physical reads
      0  redo size
    422  bytes sent via SQL*Net to client
    419  bytes received via SQL*Net from client
      2  SQL*Net roundtrips to/from client
      0  sorts (memory)
      0  sorts (disk)
      1  rows processed

2.2、创建表t_bmap,并创建BitMap索引:

t_bmap
SQL
6 Index created。

执行之前的同样的语句查询:

SQL> select count(*) from t_bmap where t_bmap.object_name like '%ObjectStreamClass%';

  COUNT(*)
----------
    84


Execution Plan
----------------------------------------------------------
Plan hash value: 891302759

관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿
회사 소개 부인 성명 Sitemap
PHP 중국어 웹사이트:공공복지 온라인 PHP 교육,PHP 학습자의 빠른 성장을 도와주세요!