P. 1
index

index

|Views: 0|Likes:
Published by Subhasis Maity
index
index

More info:

Published by: Subhasis Maity on Feb 04, 2013
Copyright:Attribution Non-commercial

Availability:

Read on Scribd mobile: iPhone, iPad and Android.
download as DOCX, PDF, TXT or read online from Scribd
See more
See less

02/04/2013

pdf

text

original

Local indexes

Objective Create a local index on a partitioned table.
When you create a local index, it is automatically equipartitioned in the same way as its underlying table. This gives you the advantages of an equipartitioned index without declaring the index partitions when the index is created or when the table partitions are maintained or modified. The following MouseOver illustrates the relationship between a local index and its corresponding table.

Local Indexes In order to define a local partitioned index, you only have to add the keyword LOCAL to the end of the CREATE INDEXstatement, as in CREATE INDEX idxA ON tabA(colA) LOCAL (); The local index will automatically be partitioned in the same way as the underlying table. You can specify which tablespace a local index's partitions will be stored in. Prefixed and non-prefixed A prefixed index includes the columns used to partition the underlying table at the beginning of the column list for the index--the left of the column list. Any local index that does not include these columns is a non-prefixed partitioned index. Both prefixed and non-prefixed local indexes are partitioned on the underlying column(s) used to partition the associated table. For this example, assume that your underlying table contains three columns--colA, colB, and colC. The table is partitioned on colA. A local prefixed index could contain colA and colB, and it would be partitioned on colA. A local non-prefixed index may only contain colB, but it would still be partitioned on colA. Prefixed versus non-prefixed indexes There are advantages to using each type of index. When you have a local index that is prefixed, the Oracle optimizer will automatically know to eliminate both index partitions and table partitions if the partitioning key is a part of theWHERE clause. This matching provides the fastest query execution. If an index is not prefixed, you can specify a different column and still benefit from the improved performance. For instance, you could have a table that is partitioned by month and a non-prefixed local index that is partitioned by account number. Assuming that a query asked for the sales for a particular month for a particular account, Oracle could use the index to quickly locate the account number but would not have to search table partitions that did not contain the correct month. The next lesson explains global partitioned indexes.

Global indexes

A global index has entries that can refer to more than one table partition. you have to maintain the connection between the index partitions and the table partitions yourself. The next lesson explains how to merge existing partitions for a table or index. If colB is unique.Objective Create a global index on a partitioned table.Quiz Click the Quiz link below to answer a few questions about local and global partitions. a global index is not automatically equipartitioned with its underlying table. you have to explicitly define the partitions and their boundaries. Unlike local indexes. the syntax for defining a global index is different from defining a local index. Global indexes . You can use MAXVALUE for the last partition in either an index or a table. just as you do with a table. if a table is partitioned on colA. Global indexes .Quiz . PARTITION VALUES LESS THAN (MAXVALUE)). Using the example from the previous lesson. The MAXVALUE keyword sets an unlimited upper bound for the last partition in this definition. you would have to declare the index a global partitioned index. In addition. You only need to specify that a local index is LOCAL and Oracle does the rest. but it cannot be partitioned. For a global index. Although you could define a global partitioned index with the same partitions and range boundaries as its underlying table. Prefixed and non-prefixed Oracle does not support global non-prefixed indexes. as in: CREATE INDEX idxB ON tabA(colB) GLOBAL PARTITION BY RANGE (colB) (PARTITION VALUES LESS THAN 10. colB can not be unique. and the local index is partitioned on colB. PARTITION VALUES LESS THAN 100. When you define a global partitioned index. You can still have an index that is not prefixed. Oracle also does not support unique non-prefixed local indexes where the partitioning columns in the index are not a subset of the partition columns in the associated table. you have to specify the partitions in the CREATE INDEX statement.

You're Reading a Free Preview

Download
scribd
/*********** DO NOT ALTER ANYTHING BELOW THIS LINE ! ************/ var s_code=s.t();if(s_code)document.write(s_code)//-->