Oracle has six types of indexes, namely: 1. B* tree index, whose structure is similar to a binary tree and can provide fast access to a row or a set of rows based on the key; 2. Bitmap index, suitable for highly repetitive applications And usually read-only data; 3. Function-based index, the result of a function calculation can be stored in the column of the row; 4. Application domain index, an index built and stored by yourself; 5. HASH index, must be used HASH cluster; 6. Partitioned index, simply divide an index into multiple fragments.
The operating environment of this article: Windows 10 system, Oracle version 19c, Dell g3 computer.
Oracle provides six different types of indexes for use.
Oracle includes the following indexes:
1, B* tree index
These are what I call "traditional" indexes. This is by far the most commonly used index in Oracle and most other databases.
B* The tree is constructed like a binary tree and can provide fast access to a row or a set of rows based on the key, usually requiring only a few reads to find the correct row. However, it is important to note that the "B" in "B* tree" does not represent binary, but represents balanced (balanced). A B* tree index is not a binary tree, as you will learn when we introduce how to physically store a B* tree on disk. B* tree indexes have the following subtypes:
Index organized table (index organized table): Index organized tables are stored in a B* tree structure. Unlike heap tables, where data rows are stored in an unorganized manner (data can be placed as long as there is available space), data in IOT is stored and sorted in the order of primary keys. To the application, the IOT behaves like a "regular" table; SQL is required to access the IOT correctly. IOT is most useful for information acquisition, spatial systems, and OLAP applications. IoT has been discussed in detail in the previous chapter.
B*tree cluster index (B*tree cluster index) These are a variant of the traditional B*tree index (with only slight changes). B* tree clustered indexes are used to index clustered keys (see the “Indexing Clustered Tables” section in Chapter 11.), so they will not be discussed in this chapter. In traditional B* trees, keys point to one row; unlike B* tree clustering, a clustering key points to a block that contains multiple rows related to this clustering key.
Descending index: Descending index allows data to be sorted in the index structure in "from large to small" order (descending order), rather than in "small to large" order (ascending order). We explain why descending indexes are important and explain how descending indexes work.
Reverse key index: This is also a B* tree index, except that the bytes in the key will be "reversed". With an inverted key index, the index entries can be more evenly distributed in the index if the index is populated with increasing values. For example, if you use a sequence to generate a primary key, the sequence will generate values such as 987500, 987501, 987502, and so on. The values are sequential, so if a traditional B* tree index was used, these values might be placed on the same right-hand block, which increases contention for this block. Using the reverse key, Oracle will logically index 205789, 105789, 005789, etc. Oracle will byte-reverse the stored data before placing it in the index, so that values that may have been adjacent to each other in the index will be far apart after the byte-reversal. By reversing the bytes, insertions into the index are spread over multiple blocks.
2. Bitmap index (bitmap index)
In a B* tree, there is usually a one-to-one relationship between index entries and rows: an index entry points to One line. For bitmap indexes, one index entry uses a bitmap to point to multiple rows at the same time. Bitmap indexes are suitable for data that is highly repetitive and usually read-only (highly repetitive means that the data has only a few distinct values relative to the total number of rows in the table). Consider a table with 1 million rows, where each column has only three possible values: Y, N, and NULL. For example, if you need to frequently count how many rows have the value Y, this is suitable for building a bitmap index. However, this does not mean that if a certain column in this table has 11.000 different values, a bitmap index cannot be created. Of course, a bitmap index can also be created for this column. In an OLTP database, bitmap indexes cannot be considered due to concurrency-related issues (we will discuss this later). Note that bitmap indexing requires Oracle Enterprise or Personal Edition.
Bitmap join index (bitmap join index): This provides a method of denormalizing data in an index structure (rather than a table). For example, consider the simple EMP and DEPT tables. Someone may ask this question: "How many people work in the department located in Boston?" EMP has a foreign key pointing to DEPT. To count the number of employees in the department with the LOC value of Boston, you usually have to complete a table join and LOC Column joins to EMP records to answer this question. By using a bitmap join index, you can index the LOC column on the EMP table.
3. Function-based index (function-based index)
These are B* tree indexes or bitmap indexes, which store the result of a function calculation in the column of the row instead of storing The column data itself. You can think of a function-based index as an index on a virtual column (or derived column); in other words, the column is not physically stored in the table. Function-based indexes can be used to speed up queries like SELECT * FROM T W HERE FUNCTION(DATABASE_COLUMN) = SAME_VALUE because the value FUNCTION(DATABASE_COLUMN) has been calculated in advance and stored in the index.
4. Application domain index (application domain index)
The application domain index is an index that you build and store yourself. It may be stored in Oracle or outside Oracle. You have to tell the optimizer how selective the index is and how expensive the execution is, and the optimizer will decide whether to use your index based on the information you provide. Oracle text indexes are an example of an application domain index; you can also build your own using the same tools you use to build Oracle text indexes. It should be pointed out that the "index" created here does not require the use of a traditional index structure. For example, Oracle text indexes use a set of tables to implement their index concepts.
5. HASH index
To use HASH index, you must use HASH cluster. When you create a cluster or HASH cluster, you also define a cluster key. This key tells Oracle how to store the table on the cluster. When storing data, all rows related to this cluster key are stored on a database block. If the data is stored in the same database block and a HASH index is used, Oracle can access the data by executing a HASH function and I/O - and by applying a binary height 4 B-tree index. data, you need to use 4 I/O when retrieving the data.
Tips: HASH indexes are very useful when there are restrictions (need to specify a certain value rather than a value range).
6. Partitioned index
Partitioned index simply divides an index into multiple fragments, so that smaller fragments can be accessed and these fragments can be stored on different hard disks ( avoid I/O problems). Both B-number indexes and bitmap indexes can be partitioned, but HASH indexes cannot be partitioned.
There are two types of partitioned indexes: local partitioned indexes and global partitioned indexes. Each type has two subtypes, prefixed and unprefixed. If a bitmap index is used, it must be a local index.
The main reason for partitioning the index is to reduce the size of the index that needs to be read. In addition, placing the partitions in different table spaces can improve the availability and reliability of the partitions.
The above is the detailed content of There are several types of indexes in oracle. For more information, please follow other related articles on the PHP Chinese website!

oracle asm指的是“自动存储管理”,是一种卷管理器,可自动管理磁盘组并提供有效的数据冗余功能;它是做为单独的Oracle实例实施和部署。asm的优势:1、配置简单、可最大化推动数据库合并的存储资源利用;2、支持BIGFILE文件等。

方法:1、利用“select*from user_indexes where table_name=表名”语句查询表中索引;2、利用“select*from all_indexes where table_name=表名”语句查询所有索引。

在Oracle中,可利用lsnrctl命令查询端口号,该命令是Oracle的监听命令;在启动、关闭或重启oracle监听器之前可使用该命令检查oracle监听器的状态,语法为“lsnrctl status”,结果PORT后的内容就是端口号。

在oracle中,可以利用“TO_SINGLE_BYTE(String)”将全角转换为半角;“TO_SINGLE_BYTE”函数可以将参数中所有多字节字符都替换为等价的单字节字符,只有当数据库字符集同时包含多字节和单字节字符的时候有效。

在oracle中,可以利用“drop sequence sequence名”来删除sequence;sequence是自动增加数字序列的意思,也就是序列号,序列号自动增加不能重置,因此需要利用drop sequence语句来删除序列。

在oracle中,可以利用“select ... From all_tab_columns where table_name=upper('表名') AND owner=upper('数据库登录用户名');”语句查询数据库表的数据类型。

方法:1、利用“LOWER(字段值)”将字段转为小写,或者利用“UPPER(字段值)”将字段转为大写;2、利用“REGEXP_LIKE(字符串,正则表达式,'i')”,当参数设置为“i”时,说明进行匹配不区分大小写。

方法:1、利用“alter system set sessions=修改后的数值 scope=spfile”语句修改session参数;2、修改参数之后利用“shutdown immediate – startup”语句重启服务器即可生效。

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

SublimeText3 Linux new version
SublimeText3 Linux latest version

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 English version
Recommended: Win version, supports code prompts!
