Question

Creating an index on Oracle 10g?? Sounds simple...

Asked by: aidan_c

Hi

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.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2004-08-17 at 09:41:24ID21096921
Tags

10g

,

oracle

,

slow

Topic

Oracle Database

Participating Experts
6
Points
500
Comments
16

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

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.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

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.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

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.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. Changing INIT.ORA
    Hi , i need to change the number of processes in the INIT.ORA . Does this have any major affect on anything in Oracle.I need to change it because we keep getting thew error that we've exceeded the processes. Any Oracle Expert out there ?
  2. ORACLE not available after change in init.ora
    Hi, I have done some changes in init.ora file and then restarted the database.After that I am getting ERROR: ORA-01034: ORACLE not available ORA-27101: shared memory realm does not exist. I reverted all the changes done in init.ora, still I am getting the same error. Any s...
  3. Oracle and Indexes
    Hello I am a bit lost concerning the different ways of indexing on Oracle 9i. I am developing a data cartridge for text data and I don't know which index implementation I must choose. I red a lot about BTrees, Hash, GiST... but which one suits my needs best ? The indexing is ...
  4. init.ora parameters
    can anyone explain me parameters of init.ora file?
  5. minimum parameters of init.ora
    what are minimum parameters of init.ora (oracle 9i on unix)
  6. init.ora
    can you please explain creation of init.ora while creation of database in oracle 10g?

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

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.

Join the Community

Answers

 

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;

 

by: seazodiacPosted on 2004-08-17 at 09:51:57ID: 11822590

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.

 

by: bvanderveenPosted on 2004-08-17 at 09:53:02ID: 11822606

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.

 

by: aidan_cPosted on 2004-08-17 at 10:05:14ID: 11822749

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

 

by: seazodiacPosted on 2004-08-17 at 10:11:11ID: 11822810

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.

 

by: seazodiacPosted on 2004-08-17 at 10:14:47ID: 11822869

aidan:

you can also enable the PARALLEL query on the table level considering the table is monstrously large.

alter table very_big_table  PARALLEL (degree 8);

I don't remember the syntax exactly, but that's what you should do

 

by: aidan_cPosted on 2004-08-17 at 10:26:34ID: 11822986

Thanks Seazodiac,

I'm going to try those PARALLEL settings (they weren't set in my init.ora).

I'll post an update soon.

Thanks
Aidan

 

by: seazodiacPosted on 2004-08-17 at 10:38:16ID: 11823111

make sure you make changes in the SPFILE, because most likely you are starting up your server in SPFILE , not PFILE as you are in 10g.

 

by: morphmanPosted on 2004-08-17 at 14:16:24ID: 11825507

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

 

by: ImageryPosted on 2004-08-17 at 15:45:10ID: 11826167

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).

 

by: seazodiacPosted on 2004-08-17 at 16:42:24ID: 11826458

aidin:

in 10g, all the above Parameters are obsolete, they exist solely for backward compatibility.

so don't bother with these.

 

by: riazpkPosted on 2004-08-18 at 02:37:19ID: 11828765

Also use some big sort_area_size before building index. i ussally use 500M or so .

SQL> alter session set sort_area_size=524288000
SQL> create index <In_Name>
on ......

parallel
nologging;

 

by: schwertnerPosted on 2004-08-18 at 04:26:09ID: 11829351

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.

 

by: aidan_cPosted on 2004-08-18 at 07:02:14ID: 11830540

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

 

by: seazodiacPosted on 2004-08-18 at 08:21:11ID: 11831459

Alot of the parameters mentioned above are obsolete ?

Yes, in 10g, pga_aggregate_target prevails


in my production, I adjust pga_aggregate_target to 512MB.


of course, you have also to set WORKAREA_SIZE_POLICY=AUTO to make pga work.

 

by: aidan_cPosted on 2004-08-19 at 05:33:37ID: 11840483

ok. I think this can be closed off. I managed to create the index in 6 hours... it's very unsatisfactory but it will do!

Regards
Aidan

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...