[Oracle]-[insert read sequence]-sequential relationship between insert reads

Source: Internet
Author: User

[Oracle]-[insert read sequence]-sequence relationship between insert reads: is the sequence of Oracle insert records read? Through a simple experiment:

SQL> create table t( x int,a char(2000) default 'x',b char(2000) default 'x',c char(2000) default 'x');Table created.SQL> insert into t (x) values ( 1 );1 row created.SQL> insert into t (x) values ( 2); 1 row created.SQL> insert into t (x) values ( 3); 1 row created.SQL> commit;Commit complete.SQL> select x, rownum, rowid from t;          X     ROWNUM ROWID---------- ---------- ------------------         3          1 AAAOXNAAHAAAAasAAA         1          2 AAAOXNAAHAAAAavAAA         2          3 AAAOXNAAHAAAAawAAASQL> delete from t where x = 2;1 row deleted.SQL> commit;Commit complete.SQL> select x, rownum, rowid from t;          X     ROWNUM ROWID---------- ---------- ------------------         3          1 AAAOXNAAHAAAAasAAA         1          2 AAAOXNAAHAAAAavAAASQL> insert into t (x) values ( 4 );1 row created.SQL> select x, rownum, rowid from t;          X     ROWNUM ROWID---------- ---------- ------------------         3          1 AAAOXNAAHAAAAasAAA         1          2 AAAOXNAAHAAAAavAAA         4          3 AAAOXNAAHAAAAawAAAinsert into t (x) values ( 5);SQL> select x, rownum, rowid from t;          X     ROWNUM ROWID---------- ---------- ------------------         3          1 AAAOXNAAHAAAAasAAA         5          2 AAAOXNAAHAAAAatAAA         1          3 AAAOXNAAHAAAAavAAA         4          4 AAAOXNAAHAAAAawAAASQL> insert into t (x) values ( 10);1 row created.SQL> select x, rownum, rowid from t;          X     ROWNUM ROWID---------- ---------- ------------------         3          1 AAAOXNAAHAAAAasAAA         5          2 AAAOXNAAHAAAAatAAA        10          3 AAAOXNAAHAAAAauAAA         1          4 AAAOXNAAHAAAAavAAA         4          5 AAAOXNAAHAAAAawAAA

 

It can be seen that Oracle reads data in ascending order by default according to the record ROWID. Oracle is a type of heap table (default). The heap means disorder. Data is inserted based on internal algorithms, find available data blocks. Generally, for efficiency consideration, the original space is not used. The read sequence is not directly related to the COMMIT because the new space of the Logical Block is used, it is best to use order.

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.