Index

Checking the validity of the index

BLOCKS PCT_USED LF_ROWS DEL_LF_ROWS

- -- -- --

25 11 14 0

1 row selected.

 

Note: If the percentage of LF_ROWS within the DEL_LF_ROWS passes 30% then the index should be analyzed and recreated after being checked.

To view the index usage

Start with

 

ALTER INDEX summit.orders_id_idx MONITORING USAGE;

 

 

Followed by retrieving the following column information from V$OBJECT_USAGE:

INDEX_NAME

TABLE_NAME

MONITORING: Monitoring status (ON/OFF)

USED: YES / NO Whether the index has been used whilst monitoring was active

START_MONITORING: The start monitoring time

END_MONITORING: The end monitoring time

 

To end the monitoring

Freeing some space by compressing the indexes

 

create index emp_last_name_idx on employees (last_name, first_name) compress;

alter index emp_last_name_idx rebuild compress;

 

 

Getting detailed information about indexes by reviewing the views/tables below

It is important to collect statistical information for Cost Based Optimizers (CBO). There are several ways to accomplish this:

The first is to retrieve information about a particular time:

 

DBMS_STATS.GATHER_INDEX_STATS (‘SCHEMA_NAME’,’INDEX_NAME’);

 

 

Another way is by performing the following while creating the index

It may be necessary to rebuild the indexes from time to time. Index statistics can be gathered during this rebuilding process.

With 10g, the DBMS gathers statistics while building the index.

 

To see an example of this:

index_name last_analyzed num_rows sample_size

TTEST_ID_IDX 2/12/2007 3:59:01 PM 12332 12332

 

Statistics aren’t updated as transactions are carried out on the tables. To check:

An insert operation (or any operation) performed on a table doesn’t automatically update the "last_analyzed" field. To compute statistics run analyze index ttest_id_idx compute statistics.

 

Viewing the results after running the command:

By running ”GATHER_STATS_JOB” the DBMS can automatically gather statistics whenever necessary. To view the status of the this setting, run this command: (TRUE indicates that it’s active)

Deleting an index necessitates creating a new one. Creating a new and updated index would increase a database’s performance.

 

Rebuilding indexes would normally lock the tables, this method shows how to set the lock to a minimum:

Viewing the amount of index fragmentation

Reviewed using the following query

If the fragmentation percentage is high

To find the index tables belonging to this user

Kategori seçin...