In-depth understanding of Oracle indexes (3): Unique indexes and rowid

Source: Internet
Author: User
  SuoThe reference will contain rowid to locate the specific location, but the unique index will not use rowid as part of the "index key"
For example, if a non-unique index is created on column col1, the index key is col1 | rowid, so that the index key is unique, but the unique index does not add rowid to the column to form the index key.

Test:

SQL> Conn/As sysdba is connected. SQL> Create Table T as select * From dba_objects; the table has been created. SQL> Create index t_idx on T (object_id); the index has been created. SQL> select T. header_file, T. header_block from dba_segments T 2 where T. segment_name = 'T'; header_file header_block ----------- ------------ 1 58408sql> alter system dump datafile 1 block 58410; the system has changed. Common index with the following content: Row #0 [8024] flag: ------, lock: 0, Len = 12col 0; Len 2; (2): C1 03col 1; Len 6; (6): 00 40 E4 29 00 30sql> drop index t_idx; the index has been deleted. SQL> create unique index t_idx on T (object_id); the index has been created. SQL> select T. header_file, T. header_block from dba_segments T 2 where T. segment_name = 't_ idx'; header_file header_block ----------- ------------ 1 92136sql> alter system dump datafile 1 block 92138; the system has changed. SQL> unique index, content: Row #0 [8025] flag: ------, lock: 0, Len = 11, data :( 6): 00 40 E4 29 00 30col 0; len 2; (2): C1 03

It can be seen that in a non-unique index, oracle adds a column to store the corresponding rowid. For a unique index, it is placed in data (6 ).
However, rowid will still be stored

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.