Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Verify how heap table is stored

2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Verify how heap table is stored

The storage method of heap table:

The most common and commonly used Oralce database system is the heap table.

The data storage mode of the heap table is unordered storage, that is, any DML operation may make free space available in the current data block.

For space-saving reasons, the free space available on the block is filled with newly inserted rows, rather than sequentially populated on the last used block.

The above operation mode leads to the disorder of the data.

When an index is created, the index block is populated in order based on the specified columns, which is ascending by default.

When you create or rebuild an index, the order on the index columns is ordered, while the order on the table is out of order, that is, there is a difference, that is, it is represented as a clustering factor.

Verify:

1. Create a table

SQL > conn scott/tiger

Connected.

SQL > create table T1

2 (an int

3b varchar2 (4000) default rpad ('*', 4000 jinx)

4 c varchar2 (3000) default rpad ('*', 3000 jinx')

5)

6 /

Table created.

SQL > desc T1

Name Null? Type

-

A NUMBER (38)

B VARCHAR2 (4000)

C VARCHAR2 (3000)

2. Insert data

SQL > insert into T1 (a) values (1)

1 rows created

SQL > insert into T1 (a) values (2)

1 rows created

SQL > insert into T1 (a) values (3)

1 rows created

SQL > select a from T1

A

-

one

two

three

3. Delete a row of data

SQL > delete from T1 where astat2

1 row deleted.

SQL > select a from T1

A

-

one

three

4. Reinsert a row of records

SQL > insert into T1 (a) values (4)

1 row created.

SQL > select a from T1

A

-

one

four

three

As can be seen from the above, the data insertion is not inserted sequentially, but uses the space of the record that was originally deleted!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report