Detailed Oracle table access

Table access method

Table access Explanation
table access full (full table scan)
table access by rowid (scan by rowid)
table access by index scan (index scan) index unique scan (index unique scan)
index range scan (index range scan)
index full scan (index full scan).
index fast full scan (index fast scan)
index skip scan (index skip scan)

table access full (full table scan)

  • Oracle will read all rows in the table and check whether each row meets the where restrictions
  • Multi-block read (read multiple data blocks at one I/O) operation can be used during full table scan to improve throughput
  • Usage suggestion: It is not recommended to use a full table scan for a table with a large amount of data, unless there is a lot of data that needs to be retrieved, which accounts for 5% to 10% or more of the total table data

Insert picture description here

table access by rowid (scan by rowid)

  • rowid: Pseudo column, which comes with Oracle, does not store the value of rowid, and cannot be added, deleted, or modified
  • Once a row of data is inserted, its corresponding rowid is unique in the life cycle of the row, even if the row migration occurs, the rowid value of the row will not change

Insert picture description here

table access by index scan (index scan)

Insert picture description here

  • In the index block, both the key value of each index and the rowid of the row with the key value are stored
  • So the index scan is actually divided into two steps:
    • Scan the index to get the corresponding rowid
    • Locate a specific row to read data through rowid

1. index unique scan (index unique scan)

  • Return at most one record at a time
  • There are the following two situations (when the query field has the following constraints)
    • unique
    • primary key

Insert picture description here

2. index range scan (index range scan)

  • Return at least one record at a time
  • Generally there are the following three situations
    • A range operator is used on the unique index column (eg:> <>= <= between)
    • In the composite index, only part of the column is used for query (the leading column must be included in the query, otherwise a full table scan will be taken)
    • Any queries on non-unique index columns

3. index full scan (index full scan)

  • order by unique index column

Insert picture description here

4. index fast full scan (index fast scan)

  • Similar to index full scan, but does not sort

5. index skip scan (index skip scan)

  • Must be a composite index
  • In addition to the leading column (the first column in the index) other columns as conditions

Guess you like

Origin blog.csdn.net/qq_34745941/article/details/96475940