The difference between dba_segments and dba_tables

Source: Internet
Author: User

CREATE TABLE Tset as SELECT * from Dba_objects;

Select COUNT (*) from Tset;

Select Table_name,blocks,empty_blocks from Dba_tables

where table_name= ' Tset ';

Select Segment_name,bytes,blocks,extents from Dba_segments

where segment_name= ' Tset ';

The problem comes, from dba_tables query blocks is empty, not according to the common sense card Ah ~ ~ What ghost, what Ghost

Select table_name,blocks,empty_blocks,last_analyzed from Dba_tables

where table_name= ' Tset ';

Last_analyzed is an analysis of the time, the null value represents no analysis, so EXECUTE statement analysis under look

Analyze table Tset compute statistics;

1071+80=1151

There seems to be less a blocks, not as if, is less a block. (Let's go ahead and not be sure to find out why).

The above is I found dba_tables and dba_segments the number of blocks inconsistent after the query network obtained;

Probably the individual summarizes the following:

The blocks in 1.dba_segments corresponds to the blocks+empty_blocks in Dba_tables.

2.

The dba_tables view Describes a "logical" structure whiledba_segments describes the "physical" data segm ENT, like a data file.

Also, columns like "blocks" is different between dba_tables and dba_segments. In dba_tables, the "blocks" was calculated when you run Dbms_stats, while indba_segments, ' blocks ' is th e actual number of blocks used by the object on disk.

(not explained, can't explain, I feel just feel understood), attached link: http://www.dba-oracle.com/t_difference_dba_tables_dba_segments.htm

One of the Oracle communities does not use CTAs to create tables to illustrate dba_segments and dba_tables inconsistencies, I repeat:

1. CREATE TABLE Tset1 as SELECT * from Dba_objects where 1=0;

Select Segment_name,bytes,blocks,extents from Dba_segments

where segment_name= ' TSET1 ';

Breaking:

The number of rows in the TSET1 table is 0, the default is assigned a extent, a extent=8 blocks, and a block=8k (65536/1024/8)

is Oracle 11g not a deferred segment assignment (default)?

All right, let's go, next time, this is the end of the interrupt.

2.select table_name,blocks,empty_blocks from Dba_tables where table_name= ' TSET1 ';

Analyze table Tset1 compute statistics;

Select Table_name,blocks,empty_blocks from Dba_tables where table_name= ' TSET1 ';

3.insert to Tset1 select * from Dba_objects;

Commit

4. Select Segment_name,bytes,blocks,extents from Dba_segments

where segment_name= ' TSET1 ';

Select Table_name,blocks,empty_blocks from Dba_tables

where table_name= ' TSET1 ';

Analyze table Tset1 comput statistics;

Select Table_name,blocks,empty_blocks from Dba_tables

where table_name= ' TSET1 ';

1068+83=1151, or not equal to 1152.

Attached to the Oracle Community link, the test results above are equal Oh!

Https://community.oracle.com/thread/582356?start=0&tstart=0

The difference between dba_segments and dba_tables

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.