Skip to Main Content

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Ravi.

Asked: March 01, 2017 - 3:36 am UTC

Last updated: March 02, 2017 - 5:10 am UTC

Version: 11GR2

Viewed 1000+ times

You Asked

Hi TOM,
Please go through the following and i have posted my question at the bottom :

SQL> CREATE TABLESPACE ts01 DATAFILE 'd:\ts01.dbf' SIZE 2000k uniform size 40k autoextend on;


SQL> SELECT initial_extent,next_extent,extent_management, allocation_type,segment_space_management
FROM dba_tablespaces WHERE TABLESPACE_NAME='TS01';

INITIAL_EXTENT NEXT_EXTENT EXTENT_MAN ALLOCATIO SEGMEN
-------------- ----------- ---------- --------- ------
40960 40960 LOCAL UNIFORM AUTO



SQL> SHOW PARAMETER DB_BLOCK_SIZE;

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_block_size integer 8192


SQL> create table t (x int, y char(2000) default '*') storage(initial 40k next 40k minextents 5) tablespace ts01;

Table created.

SQL> select extent_id,file_id,block_id,bytes,blocks from dba_extents where table
space_name='TS01';


EXTENT_ID FILE_ID BLOCK_ID BYTES BLOCKS
------------- ---------- ------------ -------- ---------
0 116 8 40960 5
1 116 13 40960 5
2 116 18 40960 5
3 116 23 40960 5
4 116 28 40960 5


SQL> insert into t (x) values ( 1 );

1 row created.

SQL> analyze table t compute statistics;

Table analyzed.

SQL> select extent_id, bytes, blocks from user_extents where segment_name='T' AND
SEGMENT_TYPE='TABLE';

EXTENT_ID BYTES BLOCKS
---------- ---------- ----------
0 40960 5
1 40960 5
2 40960 5
3 40960 5
4 40960 5

SQL> SELECT BLOCKS,EMPTY_BLOCKS,AVG_SPACE,NUM_FREELIST_BLOCKS FROM USER_TABLES WHERE TABLE_NAME='T';

BLOCKS EMPTY_BLOCKS AVG_SPACE NUM_FREELIST_BLOCKS
---------- -------------- ----------- --------------------
2 23 7066 0

In the above output, first block being used by the system for extent map, i was anticipating that NUM_FREELIST_BLOCKS will
have value 1 as the second data block is having data and has some space to allocate a row or two, which makes this as a
candidate in the Freelist blocks. But, NUM_FREELIST_BLOCKS is having value 0 instead.

Please explain me why NUM_FREELIST_BLOCKS is having value 0 in this case.

and Connor said...

Freelists are relevant for segments *not* stored in ASSM tablespaces (ie, segment space management = AUTO).

For example, on my system,

SQL> select distinct num_freelist_blocks
  2  from dba_tables;

NUM_FREELIST_BLOCKS
-------------------

                  0


Free block management is done via bitmaps

https://asktom.oracle.com/pls/asktom/f?p=100:11:0::::P11_QUESTION_ID:2929412562998



Is this answer out of date? If it is, please let us know via a Comment