Skip to Main Content

Breadcrumb

Question and Answer

Tom Kyte

Thanks for the question, Doug.

Asked: May 02, 2004 - 6:39 pm UTC

Last updated: May 03, 2004 - 3:45 pm UTC

Version: 8170

Viewed 1000+ times

You Asked

Tom - I'm dropping and rebuliding some indexes on a 150 million row table. The indexes are generally 4-7 standard columns. By standard I mean varchar2's and numbers of fairly typical width. I know you prefer online rebuilds but we don't have enough room. (Different issue). Anyhow, these index rebuilds on the hardware I am on take about 1 1/2 - 2 hours a piece. So, the index build can sometimes be like watching paint dry because I'm rarely sure how much progess is being made. Generally, I notice that the used_blocks in v$sort_segment generally increases for an hour to a plateau. Occassionaly, this bumps up or down a bit but generally it's fairly steady after a certain point. Then, it looks like it finishes very suddenly - the index is built and ends up taking space in the index tablespace. Up until that point, the index tablespace segments don't really budge. Questions are - do these observations seem accurate? Is there anything I can observe after the temp space seems to have "maxed".. to check for progress?

Thanks.


and Tom said...

I use this script:

select count(*) from v$session_longops where time_remaining > 0;
exec print_table( 'select * from v$session_longops where time_remaining > 0')


to monitor long running things. Now, on a 150 million row table, 1.5/2 hours seems long - are you:

a) using parallel
b) nologging
c) with a large sort area size (can be set for that session doing the index build)

Rating

  (2 ratings)

Is this answer out of date? If it is, please let us know via a Comment

Comments

just what I was looking for

A reader, May 03, 2004 - 10:40 am UTC

The actual command to create a index I had gotten out of the DDL and was like -
CREATE INDEX ...table, columns REVERSE PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL
100M NEXT 100M FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "PSIIDX" NOLOGGING
PARALLEL ( DEGREE 5 INSTANCES 1) ;
So I think the answer is yes to parallel and nologging, but I didn't raise the sort_area_size on the session level. Most of my sort area would peak out I think 600 thousand to 800 thousand and then stop.

Tom's right - increase sort area size

Mark Coleman, May 03, 2004 - 3:45 pm UTC

Tom's absolutely correct. If I move indexes I always alter session set sort_area_size = some big number, like 100M or 256M in bytes (if you have the resources). It makes an index build go a lot faster.