[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.