sql - Oracle:在包含分区 LOB 列的表上创建索引

标签 sql oracle oracle11g

我想在 Oracle DD 中创建索引(Oracle Database 11g 企业版版本 11.2.0.4.0 - 64 位生产版) 我从 Oracle 文档中了解到,为了提高查询性能,我可以在分区 LOB 列上创建索引。例如:

CREATE INDEX index_name 
   ON table_name (LOB_column_1, LOB_column_2, ...) LOCAL;

我已经尝试过

CREATE INDEX fullsearch_description ON T_DESCRIPTION (UPPER(text));

但我收到一个错误:

错误

r starting at line : 1 in command -
CREATE INDEX fullsearch_description ON T_DESCRIPTION (UPPER(text))
Error at Command Line : 1 Column : 55
Error report -
SQL Error: ORA-02327: cannot create index on expression with datatype LOB
02327. 00000 -  "cannot create index on expression with datatype %s"
*Cause:    An attempt was made to create an index on a non-indexable
           expression.
*Action:   Change the column datatype or do not create the index on an
           expression whose datatype is one of  VARRAY, nested table, object,
           LOB, or  REF.

最佳答案

您无法在 LOB 列上构建 B 树。 在您的case upper(lob) 返回lob。而oracle不能使用lob建立索引。

你可以使用这样的东西。因为函数index的结果是varchar2。但我认为这个解决方案没有用。

CREATE INDEX fullsearch_description ON T_DESCRIPTION (UPPER(dbms_lob.substr(text,1,1000)));

在 lob 列上,您可以使用域索引。 Database Data Cartridge - 有关于域索引的章节。以及如何实现。 (使用可扩展索引、构建域索引、定义运算符、可扩展索引接口(interface)、可扩展优化器接口(interface)) Oracle 提供了几种域索引的实现。 Oracle Text 。 * 这些索引方法非常复杂。

关于sql - Oracle:在包含分区 LOB 列的表上创建索引,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40460813/

相关文章:

mysql - 查找之前在mysql中进行了哪些查询

Oracle - 审计跟踪生成器?

使用左外连接时 Oracle 分区修剪不起作用

java - 使用 Oracle createTemporary 更新 Clob

oracle11g - 在 oracle 11g 中缩小永久表空间

mysql - 在 SQL 中比较 n 与 (n-1) 和 (n-2) 条记录

sql - Postgresql 按多个列进行分组并在每个组内进行排序

SQL SELECT FREETEXT 按等级排序

sql - 计算来自两个不同表的两行之间的差异

.net - 使用 Entity Framework 连接到 Oracle 时如何通过连接字符串更改架构?