also take a look at your UNDO tablespace size, make sure it has enough free space in it.
manually increase the tablespace size if needed, because letting it grow automatically will slow down the index creation process.
Main Topics
Browse All TopicsHi
I am working with Oracle 10g (64 bit) on a HP Dual processor machine (Opteron 64 bit).. (On Windows XP 64 bit)
I have a large table with 400 million rows.
I want to create an index on this table but it is taking hours. (After 8 hours I killed it). I changed a few parameters in the init.ora file, kicked off the CREATE INDEX again but it has been running for 5 hours now which is just way too slow. I realise that Oracle 10g 64 bit for Windows XP is pretty new on the block but I think I have some incorrect settings in the init.ora.
Could you advise me what basic settings I should be looking at, what other areas can be optimised, is there anything obvious I should be looking at?? ( I could send you the init.ora if you like??)
Any help would be much appreciated!!
Thanks
Aidan
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
I'm not sure you can really optimize this too much. 400 million rows is a lot of data to index.
Make sure the tablespace for the index (are you specifying which tablespace? Make sure it isn't defaulting to SYSTEM or something like that) is large enough. This is an intensive process, and you don't want to waste time with autoextending the space. Make the datafile large enough before creating the index.
Likewise, make sure you have enough TEMP tablespace. Increase the size of some of your rollback segments as well. Bump up your sort area size.
Make sure there are no updates to this table while indexing. Then, let it run overnight.
Thanks for those suggestions but I had tried all of them... :-(
(i.e NOLOGGING, naming my tablespace, large TEMP tablespace etc)
I ran something similiar on a 32 bit instance on Oracle 9i, on 120 million rows and it only took 1 hour 40 mins. 400 million rows shouldn't take 8 hours on a vastly superior machine (and supposedly superior database) - should it??
Here's my code...
CREATE INDEX big_index ON very_big_table (column_1, column_2) NOLOGGING
STORAGE (INITIAL 10M
NEXT 10M
PCTINCREASE 0)
TABLESPACE x_1
PARALLEL (DEGREE 2);
Thanks.
Aidan
in 10g, you don't need to specify INITIAL, NEXT, PCTINCREASE at all.
so try this first:
CREATE INDEX big_index ON very_big_table (column_1, column_2)
TABLESPACE x_1
NOLOGGING
/
if you want to use PARALLEL, you have to make sure you have enabled ORACLE parallel query capability.
namely:
PARALLEL_MIN_SERVERS = 2
PARALLEL_MAX_SERVERS = <4* number of CPU>
PARALLEL_AUTOMATIC_TUNING = TRUE
then try this query:
CREATE INDEX big_index ON very_big_table (column_1, column_2)
TABLESPACE x_1
NOLOGGING
PARALLEL (DEGREE 2);
/
you also want to make sure TABLESPACE x_1 has enough free space and also try to reduce user activity on the database.
400 million rows is a large table indeed.
Is the table partitioned over several disks? If not, you will only have limited disk IO, and if all the disk IO is being used autoextending tablespaces, it will run slow indeed.
If the table is partitioned, build parallel indexes (each partition), as 9i and above supports combined indexes (local only I think)
Dont forget, an index uses more tablespace than the table itself usually, so make sure its sized appropriateley.
If the table is not partitioned, I would seriously consider it, as an index scan on 400 million rows will still take a while. and you will get a huge performance increase by partitioning (as well as gain the ability to perform parallel updates and deletes which unpartitioned tables dont support!!)
All the best
What sort of hardware you got? How many CPU's? Speed? Memory? RAID Array? My guess is your just pushing the limits on your hardware and there's not much you can do. A few thing you can check within the database are:
1) Check your sort tablespace and make sure a tremendous number of extents aren't being created (SMON intensive)
2) Try increasing the sort_area_size at the session level before you start the index build.
3) If you disable logging, make sure you re-enable it and take a backup. Otherwise the index won't be recoverable.
4) Use the parallel option, but don't set it too high. Otherwise you will hit disk contention which will slow you down.
5) If the table is volitale, that will also slow you down. Try building the index in off hours.
If you're creating a bitmap index you can try adjusting the below mentioned in the init.ora file, but they are memory intensive.
1) create_bitmap_area_size = size in bytes
2) bitmap_merge_area_size = size in bytes (think this is for queries, not index builds)
I've got a 40m row table and creating a multi-column index on it takes a few hours (we don't have the fastest hardware by any means and are also RAID 5).
I do not believe that this is the right way.
You have a table with 400 milions records.
it is questionable that the CBO will try to use the index due the many levels
and too much entries there.
If you really would like to use the table try to partition it using range or hash partitioning
and partitioned indexes also.
Hi folks,
Thanks for all the advice. I have changed various init.ora parameters and in a test I can create an index on a 50 million row table in 13 minutes. However, the 400 million rows seem to be pushing the machine to its limits.
Alot of the parameters mentioned above are obsolete ?
Has anybody any insights on the paramter "pga_aggregate_target" and how the pga is used in index creation?
Regards
Aidan
Business Accounts
Answer for Membership
by: seazodiacPosted on 2004-08-17 at 09:49:59ID: 11822563
Creating index per se generates REDO logs.
you can speed up the process by appending KEYWORD "NOLOGGING"
create index <index-name> on <table_name> (col_name)
NOLOGGING;