High watermark identyfying [message #205340] |
Fri, 24 November 2006 05:24 |
Brayan
Messages: 315 Registered: June 2002
|
Senior Member |
|
|
Hi,
I have a large table with around 10000000 records.
Becuase of some delete the high-watermark has not reduced, and as a reason the table size is showing very big
(initial_extent+(next_extent*extents)).
How can I know whehter the high watermark is not reduced to do a alter table move/export&import.
Brian.
|
|
|
|
|
|
|
|
Re: High watermark identyfying [message #205485 is a reply to message #205340] |
Sat, 25 November 2006 02:44 |
Brayan
Messages: 315 Registered: June 2002
|
Senior Member |
|
|
Hi,
In my one of table <table1>,
dba_segments.blocks = 5244870
dba_tables.blocks = 4537586
dba_table.empty_blocks = 706211
Suppose, If I do "alter table table1 move" or export/import will the dba_tables.blocks becomes 0.
Brian.
|
|
|
|
Re: High watermark identyfying [message #205517 is a reply to message #205485] |
Sat, 25 November 2006 06:21 |
Mohammad Taj
Messages: 2412 Registered: September 2006 Location: Dubai, UAE
|
Senior Member |
|
|
hi
In my one of table <table1>,
dba_segments.blocks = 5244870
dba_tables.blocks = 4537586
dba_table.empty_blocks = 706211
go through below link...
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:669044239081
Suppose, If I do "alter table table1 move" or export/import will the dba_tables.blocks becomes 0
NO,
SQL> exec dbms_stats.gather_table_stats('HR','BIG_TABLE');
PL/SQL procedure successfully completed.
SQL> SELECT BLOCKS, EMPTY_BLOCKS ,NUM_ROWS FROM DBA_TABLES
2 WHERE TABLE_NAME = 'BIG_TABLE' AND OWNER='HR';
BLOCKS EMPTY_BLOCKS NUM_ROWS
---------- ------------ ----------
5284 8 381096
SQL> SELECT BLOCKS FROM DBA_segments
2 WHERE segment_NAME = 'BIG_TABLE' AND OWNER='HR';
BLOCKS
----------
5376
SQL> delete hr.big_table where rownum <= 100000;
100000 rows deleted.
SQL> commit;
Commit complete.
SQL> SELECT BLOCKS FROM DBA_segments
2 WHERE segment_NAME = 'BIG_TABLE' AND OWNER='HR';
BLOCKS
----------
5376
SQL> SELECT BLOCKS, EMPTY_BLOCKS ,NUM_ROWS FROM DBA_TABLES
2 WHERE TABLE_NAME = 'BIG_TABLE' AND OWNER='HR';
BLOCKS EMPTY_BLOCKS NUM_ROWS
---------- ------------ ----------
5284 8 381096
Note : bcoz delete never reset HVM. you have to used import or export / alter table ... move option for reset HVM.
SQL> host exp hr/hr tables=big_table
Export: Release 10.1.0.2.0 - Production on Sat Nov 25 16:01:49 2006
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Produc
tion
With the Partitioning, OLAP and Data Mining options
Export done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
About to export specified tables via Conventional Path ...
. . exporting table BIG_TABLE 281808 rows exported
Export terminated successfully without warnings.
SQL> drop table hr.big_table purge;
Table dropped.
SQL> host imp hr/hr tables=big_table
Import: Release 10.1.0.2.0 - Production on Sat Nov 25 16:02:43 2006
Copyright (c) 1982, 2004, Oracle. All rights reserved.
Connected to: Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - Produc
tion
With the Partitioning, OLAP and Data Mining options
Export file created by EXPORT:V10.01.00 via conventional path
import done in WE8MSWIN1252 character set and AL16UTF16 NCHAR character set
. importing HR's objects into HR
. . importing table "BIG_TABLE" 281808 rows imported
Import terminated successfully without warnings.
SQL> exec dbms_stats.gather_table_stats('HR','BIG_TABLE');
PL/SQL procedure successfully completed.
SQL> SELECT BLOCKS, EMPTY_BLOCKS ,NUM_ROWS FROM DBA_TABLES
2 WHERE TABLE_NAME = 'BIG_TABLE' AND OWNER='HR';
BLOCKS EMPTY_BLOCKS NUM_ROWS
---------- ------------ ----------
3898 0 281808
SQL> SELECT BLOCKS FROM DBA_segments
2 WHERE segment_NAME = 'BIG_TABLE' AND OWNER='HR';
BLOCKS
----------
3968
SQL>
hope this helps
Taj
|
|
|
|
Re: High watermark identyfying [message #205705 is a reply to message #205340] |
Mon, 27 November 2006 03:23 |
bwetkstr
Messages: 114 Registered: August 2005
|
Senior Member |
|
|
Hey if you have a table with 10.000.000 rows,
and you delete lets say 1.000.000.
Then your highwatermark will still be at 10.000.000, and as you know when you perform a full table scan, the scan will always run until it reaches the HWM.
So in case of a large delete it is always recommended that you reorg your table.
Kr
Karel.
|
|
|