We are using oracle 10G and one of the table takes lot of time if we query/delete data. This table contains around 10 million records.
Recently we discovered that ROW_MOVEMENT is disabled on this table, we want to understand following:
Any help would be highly appreciated.
Thanks in advance !!
enable row movement in 9i The row_movement_clause lets you specify whether Oracle can move a table row. It is possible for a row to move, for example, during data segment compression or an update operation on partitioned data.
When you add the clause "enable row movement" to a create table statement, you are giving Oracle permission to change the ROWID's. This allows Oracle to condense table rows and make it easier to reorganize tables.
If the table has row movement disabled, why is it you can drop the table and flashback the table to before the drop without row movement being enabled? SQL> ALTER TABLE CITY_OFFICES DISABLE ROW MOVEMENT; Table altered.
You can check if row movement is already enabled by querying the ROW_MOVEMENT column of the [DBA|ALL|USER]_TABLES views. Row movement is enabled with the following command. ALTER TABLE emp ENABLE ROW MOVEMENT; Repeating the previous query shows row movement is now enabled.
Row movement is mainly applied to partition tables. It allows rows to be moved across partitions. With row movement disabled, which is the default, you can't move a row with an update:
SQL> CREATE TABLE part_table (ID NUMBER)
2 PARTITION BY RANGE (ID)
3 (PARTITION p0 VALUES LESS THAN (1),
4 PARTITION p1 VALUES LESS THAN (MAXVALUE));
Table created
SQL> INSERT INTO part_table VALUES (0);
1 row inserted
SQL> UPDATE part_table SET ID = 2;
UPDATE part_table SET ID = 2
ORA-14402: updating partition key column would cause a partition change
When you allow row movement, you can move rows with an update:
SQL> ALTER TABLE part_table ENABLE ROW MOVEMENT;
Table altered
SQL> UPDATE part_table SET ID = 2;
1 row updated
This feature doesn't affect performance in most cases: the rows are stored and queried in exactly the same manner whether the feature is enabled or not. However, when row movement is enabled, the rows can be physically moved (similar to delete+insert) with ALTER TABLE SHRINK SPACE
for example. This may in turn affect index cluster factor for instance, which may affect the performance of some queries.
Row movement is disabled by default because it implies that the rowid
of a row may change, which is not the usual behaviour in Oracle.
Downside of row movement is that ROWID
s may be changed. So if you have any queries based on ROWID
they may return wrong results
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With