Creating index on large partitioned table
Is anyone aware of a method for telling how far along is the creation of an index on a large partitioned table? The statement I am executing is like this:
CREATE INDEX "owner"."new_index"
ON "owner"."mytable"(col_1, col_2, col_3, col_4)
PARALLEL 8 NOLOGGING ONLINE LOCAL;
This is a two-node RAC system on Windows 2003 x64, using ASM. There are more than 500,000,000 rows in the table, and I'd estimate that each row is about 600-1000 bytes in size.
Thank you.
you can know the progress from v$session_longops.
select
substr(SID ||','||SERIAL# ,1,8) "sid,srl#",
substr(OPNAME ||'>'||TARGET,1,50) op_target,
substr(trunc(SOFAR/TOTALWORK*100)||'%',1,5) progress,
TIME_REMAINING rem,
ELAPSED_SECONDS elapsed
from v$session_longops
where SOFAR!=TOTALWORK
order by sid;
hth
Similar Messages
-
BUG ? Create index on a partitioned table drops the complete table !
Hi ...
now i had twice the problem when i tried to create a local index (with 2 fields) on a partitioned table .
I set initrans to 1 and maxtrans to 255 (i know - initrans has to be at least 2).
I got an error - and the table (including the data) was gone ... :-((
Has anybody the same behavior and is it a bug ??
ChristianSee 1.5 Bad bug when creating index fails.
Have fun,
K. -
How to create index on specific partition table?
Hi Experts,
we created 4 partitions on table .
Table Name : test
partitions : Test_prt1
Test_prt2
Test_prt3
Test_prt4
Our requiremnt create the index on specific partition (ex : Test_prt2) only.Creating Partitioned Tables and Indexes
http://technet.microsoft.com/en-us/library/ms187526(v=sql.105).aspx
you can create a aligned index, the index will be spread over the filegroups
Create NonClustered Index IX_orders_aligned
On dbo.orders(order_id)
On test_monthlyDateRange_ps(orderDate);
OR
Unaligned parition, you can create index on any filegroups
Create NonClustered Index IX_orders_unpartitioned
On dbo.orders(order_id)
On [Test_prt2_FileGroup];
For more information refer the below link
http://sqlfool.com/2008/12/indexing-for-partitioned-tables/
Or
You can try Creating a filtered index (I've not tried it though)
http://www.mssqltips.com/sqlservertip/1785/sql-server-filtered-indexes-what-they-are-how-to-use-and-performance-advantages/
--Prashanth -
Creating a bit map index on a partitioned table
Dear friends,
I am trying to create a bitmap index on a partitioned table but am receiving the following ORA error. Can you please let me know on how to create a local bit map index as the message suggests?
ERROR at line 1:
ORA-25122: Only LOCAL bitmap indexes are permitted on partitioned tables
Trying to use the keyword local in front leads to wrong syntax.
Thanks in advance !!
SomnathORA-25122 Only LOCAL bitmap indexes are permitted on partitioned tables
Cause: An attempt was made to create a global bitmap index on a partitioned table.
Action: Create a local bitmap index instead
Example of a Local Index Creation
CREATE INDEX employees_local_idx ON employees (employee_id) LOCAL;
Example is about btree and I think it will work for bitmap also. -
Non-Partitioned Global Index on Range-Partitioned Table.
Hi All,
Is it possible to create Non-Partitioned Global Index on Range-Partitioned Table?
We have 4 indexes on CS_BILLING range-partitioned table, in which one is CBS_CLIENT_CODE(*local partitioned index*) and others are unknown types of index to me??
Means other 3 indexes are what type indexes ...either non-partitioned global index OR non-partitioned normal index??
Also if we create index as :(create index i_name on t_name(c_name)) By default it will create Global index. Please correct me......
Please help me in identifying other 3 indexes types by referring below ouputs!!!
select INDEX_NAME,TABLE_NAME,PARTITIONING_TYPE,LOCALITY from dba_part_indexes where TABLE_NAME='CS_BILLING';
INDEX_NAME TABLE_NAME PARTITI LOCALI
CSB_CLIENT_CODE CS_BILLING RANGE LOCAL
select index_name,index_type,table_name,table_type,PARTITIONED from dba_indexes where table_name='CS_BILLING';
INDEX_NAME INDEX_TYPE TABLE_NAME TABLE_TYPE PAR
CSB_CREATE_DATE NORMAL CS_BILLING TABLE NO
CSB_SUBMIT_ORDER NORMAL CS_BILLING TABLE NO
CSB_CLIENT_CODE NORMAL CS_BILLING TABLE YES
CSB_ORDER_NBR NORMAL CS_BILLING TABLE NO
select INDEX_OWNER,INDEX_NAME,TABLE_NAME,COLUMN_NAME from dba_ind_columns where TABLE_NAME='CS_BILLING';
INDEX_OWNER INDEX_NAME TABLE_NAME COLUMN_NAME
RPADMIN CSB_CREATE_DATE CS_BILLING CREATE_DATE
RPADMIN CSB_SUBMIT_ORDER CS_BILLING SUBMIT_TO_INVOICE
RPADMIN CSB_SUBMIT_ORDER CS_BILLING ORDER_NBR
RPADMIN CSB_CLIENT_CODE CS_BILLING CLIENT_CODE
RPADMIN CSB_ORDER_NBR CS_BILLING ORDER_NBR
select dip.index_name, dpi.locality, dip.partition_name, dip.status
from dba_part_indexes dpi, dba_ind_partitions dip
where dpi.table_name ='CS_BILLING'
and dpi.index_name = dip.index_name;
INDEX_NAME LOCALI PARTITION_NAME STATUS
CSB_CLIENT_CODE LOCAL CSB_2006_4Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2006_3Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2007_1Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2007_2Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2007_3Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2007_4Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2008_1Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2008_2Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2008_3Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2008_4Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2009_1Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2009_2Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2009_3Q USABLE
CSB_CLIENT_CODE LOCAL CSB_2009_4Q USABLE
select * from dba_part_indexes
where table_name ='CS_BILLING'
and locality = 'GLOBAL';
no rows selected
-Yasser
Edited by: YasserRACDBA on Mar 5, 2009 11:45 PMYaseer,
Is it possible to create Non-Partitioned and Global Index on Range-Partitioned Table?
Yes
We have 4 indexes on CS_BILLING range-partitioned table, in which one is CBS_CLIENT_CODE(*local partitioned index*) and others are unknown types of index to me??
Means other 3 indexes are what type indexes ...either non-partitioned global index OR non-partitioned normal index??
You got local index and 3 non-partitioned "NORMAL" b-tree tyep indexes
Also if we create index as :(create index i_name on t_name(c_name)) By default it will create Global index. Please correct me......
Above staement will create non-partitioned index
Here is an example of creating global partitioned indexes
CREATE INDEX month_ix ON sales(sales_month)
GLOBAL PARTITION BY RANGE(sales_month)
(PARTITION pm1_ix VALUES LESS THAN (2)
PARTITION pm2_ix VALUES LESS THAN (3)
PARTITION pm3_ix VALUES LESS THAN (4)
PARTITION pm12_ix VALUES LESS THAN (MAXVALUE));Regards -
How to manage large partitioned table
Dear all,
we have a large partitioned table with 126 columns and 380G not indexed can any one tell me how to manage it because now the queries are taking more that 5 days
looking forward for your reply
thank youHi,
You can store partitioned tables in separate tablespaces. This does the following:
Reduce the possibility of data corruption in multiple partitions
Back up and recover each partition independently
Control the mapping of partitions to disk drives (important for balancing I/O load)
Improve manageability, availability, and performance
Remeber as the doc states :
The maximum number of partitions or subpartitions that a table may have is 1024K-1.
Lastly you can use SQL*Loader and the import and export utilities to load or unload data stored in partitioned tables. These utilities are all partition and subpartition aware.
Document Reference:
http://download-east.oracle.com/docs/cd/B19306_01/server.102/b14231/partiti.htm
Adith -
Indexes on a partitioned table
hi experts.... which data dict view shows that an index on a partitioned table is,
a Local Index or
a Global Index or
a Global Partitioned Index?Hi,
LOCALITY column tells whether it is LOCAL or GLOBAL.
See the link for more details.
http://download.oracle.com/docs/cd/B19306_01/server.102/b14237/statviews_2015.htm#REFRN20156
Regards, -
Unable to create a single larger partition using diskpart
Hello,
I am fairly new to Windows server management.
I have a Windows Server 2008 R2 RDP machine on Amazon EC2 cloud. I have about 10 different partitions which are 8GB each. I would like to merge them all and create a single larger partition. I know diskpart generally does the trick (as per forums) but in
this case it hasn't.
I have converted three 8GB partitions into dynamic disks and I then I type the following command in diskpart:
create volume raid disk = 4,5,6
which gives me the following:
Virtual Disk Service error:
The size of the extent is less than the minimum.
I do not understand why is this happening. Would someone please be able to throw some light on this issue?
I would eventually want to add 6*1TB partitions and then merge them into a single large partition of 5TB (I got to know that 1TB will be reserved for parity).
I also tried running the following command:
create volume raid size=10000 disk = 4,5,6
and got the following:
The volume you have specified is too big for the specified disk(s).
Any help would be greatly appreciated.
CheersHi,
Command line:
Create volume raid used to create a RAID-5 volume using three or more specified dynamic disks.
http://technet.microsoft.com/pt-pt/library/cc731343(v=WS.10).aspx
Partitions does not equal to disks.
If you do not familiar with Diskpart, you can use Disk Management to perform the same tasks.
Disk Management
http://technet.microsoft.com/en-us/library/cc770943.aspx
More information:
Partitions and Volumes
http://technet.microsoft.com/en-us/library/dd163559.aspx
Understanding Disk Terminology
http://technet.microsoft.com/en-us/library/dd163557.aspx
How To Use Disk Management to Configure Dynamic Disks
http://support.microsoft.com/kb/308424/en-us
Hope this helps.
Jeremy Wu
TechNet Community Support -
Creating Local partitioned index on Range-Partitioned table.
Hi All,
Database Version: Oracle 8i
OS Platform: Solaris
I need to create Local-Partitioned index on a column in Range-Partitioned table having 8 million records, is there any way to perform it in fastest way.
I think we can use Nologging, Parallel, Unrecoverable options.
But while considering Undo and Redo also mainly time required to perform this activity....Which is the best method ?
Please guide me to perform it in fastest way and also online !!!
-YasserYasserRACDBA wrote:
3. CREATE INDEX CSB_CLIENT_CODE ON CS_BILLING (CLIENT_CODE) LOCAL
NOLOGGING PARALLEL (DEGREE 14) online;
4. Analyze the table with cascade option.
Do you think this is the only method to perform operation in fastest way? As table contain 8 million records and its production database.Yasser,
if all partitions should go to the same tablespace then you don't need to specify it for each partition.
In addition you could use the "COMPUTE STATISTICS" clause then you don't need to analyze, if you want to do it only because of the added index.
If you want to do it separately, then analyze only the index. Of course, if you want to analyze the table, too, your approach is fine.
So this is how the statement could look like:
CREATE INDEX CSB_CLIENT_CODE ON CS_BILLING (CLIENT_CODE) TABLESPACE CS_BILLING LOCAL NOLOGGING PARALLEL (DEGREE 14) ONLINE COMPUTE STATISTICS;
If this operation exceeds particular time window....can i kill the process?...What worst will happen if i kill this process?Killing an ONLINE operation is a bit of a mess... You're already quite on the edge (parallel, online, possibly compute statistics) with this statement. The ONLINE operation creates an IOT table to record the changes to the underlying table during the build operation. All these things need to be cleaned up if the operation fails or the process dies/gets killed. This cleanup is supposed to be performed by the SMON process if I remember correctly. I remember that I once ran into trouble in 8i after such an operation failed, may be I got even an ORA-00600 when I tried to access the table afterwards.
It's not unlikely that your 8.1.7.2 makes your worries with this kind of statement, so be prepared.
How much time it may take? (Just to be on safer side)The time it takes to scan the whole table (if the information can't read from another index), the sorting operation, plus writing the segment, plus any wait time due to concurrent DML / locks, plus the time to process the table that holds the changes that were done to the table while building the index.
You can try to run an EXPLAIN PLAN on your create index statement which will give you a cost indication if you're using the cost based optimizer.
Please suggest me if any other way exists to perform in fastest way.Since you will need to sort 8 million rows, if you have sufficient memory you could bump up the SORT_AREA_SIZE for your session temporarily to sort as much as possible in RAM.
-- Use e.g. 100000000 to allow a 100M SORT_AREA_SIZE
ALTER SESSION SET SORT_AREA_SIZE = <something_large>;
Regards,
Randolf
Oracle related stuff blog:
http://oracle-randolf.blogspot.com/
SQLTools++ for Oracle (Open source Oracle GUI for Windows):
http://www.sqltools-plusplus.org:7676/
http://sourceforge.net/projects/sqlt-pp/ -
HOW TO CREATE LOCAL INDEX ON BIG PARTITION TABLE
Dear All,
I have one big table 450GB stored on 9 partitions and same partitions I have created for the index. Now the problem is when i am trying to create local index it took one and half day and is still going on...
is there any shortest way to create local index on this table easily.
Database version is 11.2.0.1.0
INDEX SCRIPT IS
CREATE INDEX INDEX_SPACE0_IX_LOCAL ON FINANCE (END_TIME)
INITRANS 2 MAXTRANS
255
LOCAL ( PARTITION INDEX_SPACE01
LOGGING
NOCOMPRESS
TABLESPACE INDEX_SPACE01
PCTFREE 5 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS 1 MAXEXTENTS
2147483645 BUFFER_POOL
DEFAULT), PARTITION INDEX_SPACE02
LOGGING
NOCOMPRESS
TABLESPACE INDEX_SPACE02 PCTFREE
5 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS 1 MAXEXTENTS
2147483645 BUFFER_POOL DEFAULT),
PARTITION INDEX_SPACE03
LOGGING
NOCOMPRESS
TABLESPACE
INDEX_SPACE03
PCTFREE 5 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS 1 MAXEXTENTS
2147483645 BUFFER_POOL DEFAULT),
PARTITION INDEX_SPACE04
LOGGING
NOCOMPRESS
TABLESPACE
INDEX_SPACE04 PCTFREE 5 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS
1 MAXEXTENTS
2147483645 BUFFER_POOL DEFAULT),
PARTITION INDEX_SPACE05
LOGGING
NOCOMPRESS
TABLESPACE
INDEX_SPACE05 PCTFREE 5 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS
1 MAXEXTENTS 2147483645 BUFFER_POOL DEFAULT),
PARTITION INDEX_SPACE06
LOGGING
NOCOMPRESS
TABLESPACE INDEX_SPACE06 PCTFREE 5 INITRANS 2
MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS 1 MAXEXTENTS 2147483645 BUFFER_POOL
DEFAULT),
PARTITION INDEX_SPACE07
LOGGING
NOCOMPRESS
TABLESPACE INDEX_SPACE07 PCTFREE
5 INITRANS 2
MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS 1 MAXEXTENTS 2147483645 BUFFER_POOL
DEFAULT),
PARTITION INDEX_SPACE08
LOGGING
NOCOMPRESS
TABLESPACE INDEX_SPACE08 PCTFREE
5 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS 1 MAXEXTENTS
2147483645
BUFFER_POOL DEFAULT),
PARTITION INDEX_SPACE09
LOGGING
NOCOMPRESS
TABLESPACE
INDEX_SPACE09 PCTFREE 5 INITRANS 2 MAXTRANS 255 STORAGE (INITIAL 1M MINEXTENTS
1 MAXEXTENTS 2147483645 BUFFER_POOL
DEFAULT))
NOPARALLEL;
Thanks in advance......
Thanks,
Edited by: sherkhan on Aug 24, 2011 3:36 AM
Edited by: sherkhan on Aug 24, 2011 3:49 AMHave you verified that 'n' Index partition segments have got created so far ? (they would apepar as TEMPORARY segments only till the full index creation is completed). Have you monitored the session statistics and waits and confirmed that it is not waiting on something horrible ?
A CREATE INDEX can well be NOLOGGING instead of LOGGING. It could also use PARALLEL but I always recommend setting it back to NOPARALLEL immediately after the CREATE is completed.
You can also "quickly" build an empty index and then gradually create (i.e. build) each partition
CREATE INDEX INDEX_SPACE0_IX_LOCAL ......... UNUSABLE ;
ALTER INDEX INDEX_SPACE0_IX_LOCAL REBUILD PARTITION PARTITION INDEX_SPACE01;
ALTER INDEX INDEX_SPACE0_IX_LOCAL REBUILD PARTITION PARTITION INDEX_SPACE02;
...Hemant K Chitale -
Domain index on list-partitioned table?
Hi,
I have a list-partitioned table, and wanted to create a partitioned Oracle Text index on it. I keep getting an error, and am now wondering if it's possible to do. Here is my syntax:
CREATE INDEX SCHEMA1.IDX_ALL_TEXT_LOCAL ON SCHEMA1.TABLE1(ALL_TEXT)
INDEXTYPE IS CTXSYS.CONTEXT
LOCAL
(PARTITION PTN1 PARAMETERS('sync (on commit) storage ptn1'),
PARTITION PTN2 PARAMETERS('sync (on commit) storage ptn2'),
PARTITION PTN3 PARAMETERS('sync (on commit) storage ptn3'),
PARTITION PTN4 PARAMETERS('sync (on commit) storage ptn4'),
PARTITION PTN5 PARAMETERS('sync (on commit) storage ptn5'),
PARTITION PTN6 PARAMETERS('sync (on commit) storage ptn6'),
PARTITION PTN7 PARAMETERS('sync (on commit) storage ptn7'),
PARTITION PTN8 PARAMETERS('sync (on commit) storage ptn8')
PARAMETERS('section group my_group lexer new_lexer');
ERROR at line 1:
ORA-29850: invalid option for creation of domain indexes
Any advice would be much appreciated.
Thanks,
Nora... will it spread the index across the tablespaces that are associated with each partition?No, as demonstrated below.
SCOTT@orcl_11gR2> CREATE TABLE table1
2 ( id NUMBER(6),
3 all_text VARCHAR2 (20)
4 )
5 PARTITION BY LIST (id)
6 (PARTITION ptn1 VALUES (2,4) TABLESPACE example,
7 PARTITION ptn2 VALUES (3,9) TABLESPACE example
8 )
9 /
Table created.
SCOTT@orcl_11gR2> INSERT ALL
2 INTO table1 VALUES (2, 'test2')
3 INTO table1 VALUES (3, 'test3')
4 INTO table1 VALUES (4, 'test4')
5 INTO table1 VALUES (9, 'test9')
6 SELECT * FROM DUAL
7 /
4 rows created.
SCOTT@orcl_11gR2> CREATE INDEX IDX_ALL_TEXT_LOCAL
2 ON TABLE1 (ALL_TEXT)
3 INDEXTYPE IS CTXSYS.CONTEXT
4 /
Index created.
SCOTT@orcl_11gR2> SELECT table_name, tablespace_name
2 FROM user_tab_partitions
3 WHERE table_name = 'TABLE1'
4 /
TABLE_NAME TABLESPACE_NAME
TABLE1 EXAMPLE
TABLE1 EXAMPLE
2 rows selected.
SCOTT@orcl_11gR2> SELECT table_name, tablespace_name
2 FROM user_tables
3 WHERE table_name LIKE '%IDX_ALL_TEXT_LOCAL%'
4 /
TABLE_NAME TABLESPACE_NAME
DR$IDX_ALL_TEXT_LOCAL$I USERS
DR$IDX_ALL_TEXT_LOCAL$R USERS
DR$IDX_ALL_TEXT_LOCAL$N
DR$IDX_ALL_TEXT_LOCAL$K
4 rows selected.
SCOTT@orcl_11gR2> -
Creating index for standard SAP tables
Hi!
What are the advantages and disadvantages of creating addtional indexes for tables with massive amount of data (BSEG, BKPF, COEP, etc...).
If I create a new index it supposed to make the table access faster, for the cost of hard disk space.
Am I right?
Thank you
TamáHi,
Primary and secondary indexes
Index: Technical key of a database table.
Primary index: The primary index contains the key fields of the table and a pointer to the non-key fields of the table. The primary index is created automatically when the table is created in the database.
Secondary index: Additional indexes could be created considering the most frequently accessed dimensions of the table.
Structure of an Index
An index can be used to speed up the selection of data records from a table.
An index can be considered to be a copy of a database table reduced to certain fields. The data is stored in sorted form in this copy. This sorting permits fast access to the records of the table (for example using a binary search). Not all of the fields of the table are contained in the index. The index also contains a pointer from the index entry to the corresponding table entry to permit all the field contents to be read.
When creating indexes, please note that:
An index can only be used up to the last specified field in the selection! The fields which are specified in the WHERE clause for a large number of selections should be in the first position.
Only those fields whose values significantly restrict the amount of data are meaningful in an index.
When you change a data record of a table, you must adjust the index sorting. Tables whose contents are frequently changed therefore should not have too many indexes.
Make sure that the indexes on a table are as disjunctive as possible.
(That is they should contain as few fields in common as possible. If two indexes on a table have a large number of common fields, this could make it more difficult for the optimizer to choose the most selective index.)
Accessing tables using Indexes
The database optimizer decides which index on the table should be used by the database to access data records.
You must distinguish between the primary index and secondary indexes of a table. The primary index contains the key fields of the table. The primary index is automatically created in the database when the table is activated. If a large table is frequently accessed such that it is not possible to apply primary index sorting, you should create secondary indexes for the table.
The indexes on a table have a three-character index ID. '0' is reserved for the primary index. Customers can create their own indexes on SAP tables; their IDs must begin with Y or Z.
If the index fields have key function, i.e. they already uniquely identify each record of the table, an index can be called a unique index. This ensures that there are no duplicate index fields in the database.
When you define a secondary index in the ABAP Dictionary, you can specify whether it should be created on the database when it is activated. Some indexes only result in a gain in performance for certain database systems. You can therefore specify a list of database systems when you define an index. The index is then only created on the specified database systems when activated
Thanks and Regards
Arun Joseph -
Indexing on a Partitioned Table
Hi, Everybody,
I have already an partitioned table which has 8 partitions. I have indexes also on this partitiioned table. I have created the partioned indexes. It is partitioned by range. I have now added 3 more partitions and inserted data into the 3 new partitions.
Now my question is :
1. Can i create indexes only on the new partitions? What is the syntax?
2. Or should i drop all the indexes and create new indexes for all the partitions again?
Thanks in advance...
RegardsCan i create indexes only on the new partitions? I give up. Can you?
What is the syntax?http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_5010.htm#sthref6509
Or should i drop all the indexes and create new indexes for all the partitions again?What would be gained by doing so? -
Hi,
We have a huge table and there is no index on this table, I want to create index on this table, we are working on Oracle 11g/Linux.
Our business users are frequently accessing this table and select statement taking very long time.
Please let me know which index type would be best suited for this and what would the command to create index on it.
Would appreciate your assistance.
Regards.>
We have a huge table and there is no index on this table, I want to create index on this table, we are working on Oracle 11g/Linux.
Our business users are frequently accessing this table and select statement taking very long time.
Please let me know which index type would be best suited for this and what would the command to create index on it.
>
We need loads of information to suggest anything useful
a) What database version is yours? (if 11g, you have good more options)
b) What type of environment is it? OLTP or Warehouse?
c) How big is the table?
d) How many distinct values are there in that column that you want to index?
e) Would this index undergo lots of inserts/deletes/updates? That is, is this table used mainly for querying or will it undergo continous inserts/updates/deletes?
In case your environment is warehouse type where you load once and then mainly used for queries and more importantly, if that column has very few distinct columns (typical example is a GENDER column where you have only two distinct values), you will be largely benefitted from BITMAP index. If it's an OLTP environment where multiple processes will be inserting into the table, you never ever go near BITMAP index but do only B-Tree index.
Finally, have you arrived at a concrete reason on why you want to build that index now rather than when you designed the table? If you don't need an index for sure, better not have it. If you are on 11g, you can have INVISIBLE index.
Also, if it's a very large table, you may create the index nologging to avoid loads of redo generation (not recommended on production environment though). But you have to be aware that in the event of disaster recovery you will have to recreate the index after you restore the database. Also if you are on Dataguard environment, you have to take necessary precautions while doing NOLOGGING operations.
Edited by: user12035575 on Sep 11, 2011 12:37 PM -
Errors creating indexes on Binary XML Tables
Hi,
Oracle details are as follows:
Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
PL/SQL Release 11.2.0.2.0 - Production
"CORE 11.2.0.2.0 Production"
TNS for IBM/AIX RISC System/6000: Version 11.2.0.2.0 - Production
NLSRTL Version 11.2.0.2.0 - Production
I'm currently having an issue when attempting to create a suitable index on a binary xml table. I have a Binary xml table that stores a number of xml documents. I have created an index on this table as follows:
create index TEST_WQI_idx_1 on TEST_WEB_QUOTE_INDX1(OBJECT_VALUE)
INDEXTYPE IS XDB.XMLINDEX
PARAMETERS ('PATHS (INCLUDE
(/webPolicy/QuoteId))');
Querying the table with the following:
SQL> l
1 select xmlcast(xmlquery('/webPolicy/Sections/interopSection[1]/PolicyItems/item/Version/text()' PASSING OBJECT_VALUE RETURNING CONTENT)
2 as number) "VERSION",
3 xmlcast(xmlquery('/webPolicy/QuoteId/text()' PASSING OBJECT_VALUE RETURNING CONTENT)
4 as number) "QUOTEID"
5 FROM TEST_WEB_QUOTE_INDX1
6 where xmlcast(xmlquery('/webPolicy/QuoteId/text()' PASSING OBJECT_VALUE RETURNING CONTENT)
7* as number) = 22824
SQL> /
VERSION QUOTEID
1 22824
Execution Plan
Plan hash value: 3559428808
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 545 | 1071K| 1030 (1)| 00:00:19 |
| 1 | SORT AGGREGATE | | 1 | 3022 | | |
|* 2 | TABLE ACCESS BY INDEX ROWID | SYS895336_TEST_WQI__PATH_TABLE | 1 | 3022 | 2 (0)| 00:00:01 |
|* 3 | INDEX RANGE SCAN | SYS895336_TEST_WQI__PIKEY_IX | 1 | | 1 (0)| 00:00:01 |
|* 4 | FILTER | | | | | |
| 5 | TABLE ACCESS FULL | TEST_WEB_QUOTE_INDX1 | 545 | 1071K| 4 (0)| 00:00:01 |
| 6 | SORT AGGREGATE | | 1 | 3022 | | |
|* 7 | TABLE ACCESS BY INDEX ROWID| SYS895336_TEST_WQI__PATH_TABLE | 1 | 3022 | 2 (0)| 00:00:01 |
|* 8 | INDEX RANGE SCAN | SYS895336_TEST_WQI__PIKEY_IX | 1 | | 1 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - filter(SYS_XMLI_LOC_ISTEXT("SYS_P0"."LOCATOR","SYS_P0"."PATHID")=1)
3 - access("SYS_P0"."RID"=:B1 AND "SYS_P0"."PATHID"=HEXTORAW('5E6C') )
4 - filter(CAST( (SELECT "SYS"."STRAGG"("SYS_P2"."VALUE") FROM
"WEB_STAGING"."SYS895336_TEST_WQI__PATH_TABLE" "SYS_P2" WHERE "SYS_P2"."PATHID"=HEXTORAW('5E6C') AND
"SYS_P2"."RID"=:B1 AND SYS_XMLI_LOC_ISTEXT("SYS_P2"."LOCATOR","SYS_P2"."PATHID")=1) AS number)=22824)
7 - filter(SYS_XMLI_LOC_ISTEXT("SYS_P2"."LOCATOR","SYS_P2"."PATHID")=1)
8 - access("SYS_P2"."RID"=:B1 AND "SYS_P2"."PATHID"=HEXTORAW('5E6C') )
Note
- dynamic sampling used for this statement (level=2)
- Unoptimized XML construct detected (enable XMLOptimizationCheck for more information)
However, I also need to add an additional field to this index to allow appropriate queries against the data in the table, version number. This field can be seen from the statement above (VERSION) which runs OK and returns the data I’d expect. However, when I attempt to add this index using the following statement I get an error returned and the index becomes corrupted:
alter index TEST_WQI_idx_1 rebuild
parameters ('PATHS (INCLUDE ADD
(/webPolicy/Sections/interopSection[1]/PolicyItems/item/Version))');
After some investigation, the issue seems to revolve around the use of the [1] condition in the statement /interopSection[1]. I can create the index by removing the [1] condition, but this does not return the expected result. In actual fact, as there are 2 interopSection elements in the xml file, both with a version number of 1, the statement returns 11, which would appear to be the two version numbers concatenated together. I need to be able to reference the version number from the first interopSection in the queries against the table, and I need to be able to index this column correctly for performance issues.
I'm unsure why this xpath statement is not working correctly in the alter index statement, but returns ok when used within the query against the table and was wondering if you would be able to help me to have a working index against this element.
Thanks in advance for any help you can provide in relation to this.Sorry, here is the error:
Error starting at line 20 in command:
alter index TEST_WQI_idx_1 rebuild
parameters ('PATHS (INCLUDE ADD
(/webPolicy/Sections/interopSection[1]/PolicyItems/item/Version))')
Error report:
SQL Error: ORA-29858: error occurred in the execution of ODCIINDEXALTER routine
ORA-64131: XMLIndex Metadata: failure during the looking up of the dictionary
ORA-30968: invalid XPATH or NAMESPACE option for XML Index
29858. 00000 - "error occurred in the execution of ODCIINDEXALTER routine"
*Cause: Failed to successfully execute the ODCIIndexAlter routine.
*Action: Check to see if the routine has been coded correctly.
Maybe you are looking for
-
Hello, everyone. I am having issues with running a DELETE statement on an Oracle 10g database. DELETE FROM tableA WHERE ID in (1,2,3) If there is only one ID for the IN clause, it works. But if more than one ID is supplied, I get an "SQL command not
-
Hello to all, I use a JTextPane to edit HTML text. Now I want to enter a link into it. I thought about entering the URL and the pressing a button to make a link out of it. Another way would be to add a button. After the button will be pressed I open
-
Browser-based PI sheet - Export parameters
Hi All, I'm working on browser based PI sheet. I have a custom function module with characteristic PPPI_FUNCTION_NAME linked to a Process message. I'm not able to add a new export parameter and table parameters (for repeated data request). Only an ex
-
JEE MP: Authoring JEE Application Availability Monitor
Hi experts, We've imported the JEE WebSphere MP's, completed discovery, enabled deep monitoring, and now have some issues authoring custom "JEE Application Availability Monitoring". In the wizard on the "MBean to Monitor" screen we use the MBean name
-
Keeping it as a vector, of course!