Google Groups Home
Help | Sign in
How many people here rebuid index regularly?
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  Messages 26 - 33 of 33 - Collapse all < Older 
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
joel garry  
View profile
 More options 8 Oct 2007, 23:08
Newsgroups: comp.databases.oracle.server
From: joel garry <joel-ga...@home.com>
Date: Mon, 08 Oct 2007 15:08:21 -0700
Local: Mon 8 Oct 2007 23:08
Subject: Re: How many people here rebuid index regularly?
On Oct 8, 1:37 pm, "Jonathan Lewis" <jonat...@jlcomp.demon.co.uk>
wrote:

I have a situation where the production schema had a major delete at
the end of last year, and has slowly been adding since.  When I exp/
imp the schema in question to a test db,  the size is a good 20%
smaller.  I then look at the largest index that OEM tells me has
significantly fewer blocks with your program, and I see a much broader
distribution of number of rows per index blocks.

>From production:

[snippage]

ROWS_PER_BLOCK     BLOCKS
-------------- ----------
           113       1877
           114       4984
           115       3167
           116      28250
           117       2096
           118       4314
           119       2301
           120       5501
           121       2526
           122       9402
           123       1803

ROWS_PER_BLOCK     BLOCKS
-------------- ----------
           124       3403
           125       1255
           126       2421
           127        919
           128       2528
           129        985
           130       1775
           131        714
           132       2354
           133        727
           134       1589

[snippage of more rows like this]

ROWS_PER_BLOCK     BLOCKS
-------------- ----------
               ----------
sum                172843

176 rows selected.

SQL> select leaf_blocks from user_indexes where
index_name='IC_MOVEMENTS_2';

LEAF_BLOCKS
-----------
     172697

>From test:

ROWS_PER_BLOCK     BLOCKS
-------------- ----------
           113          1
           121          1
           131          1
           160          1
           165          1
           188        210
           189          2
           192          1
           193        697
           197          1
           198          2

ROWS_PER_BLOCK     BLOCKS
-------------- ----------
           199      52109
           200        230
           201        288
           202        468
           203        692
           204       2554
           205      10419
           206       8775
           207       3780
           208       1040
           209        463

ROWS_PER_BLOCK     BLOCKS
-------------- ----------
           210      32797
           211          3
           212          3
           213          5
           214          2
           215          5
           216          1
           217       3012
           218          1
           219          1
           220          1

ROWS_PER_BLOCK     BLOCKS
-------------- ----------
           223        358
           224          1
           225          1
           227          1
           228          1
           230          1
           231        222
           233          1
           235          1
               ----------
sum                118154

42 rows selected.

SQL> select leaf_blocks from user_indexes where
index_name='IC_MOVEMENTS_2';

LEAF_BLOCKS
-----------
     118334

Therefore, exp/imp must indeed be the answer to life, indices and
everything!  :-)

The question that is begged:  Can-or-should I just compare the
leaf_blocks on all indices between production and test and rebuild
those with the largest difference?   Seems too simple.   (Especially
since I know if I mention this to this customer they will just want me
to exp/imp the whole db, MS-think abounds).  I've never felt any need
to do anything to these indices, except due to the space issue -
between hardware upgrades and such, this is the first time they've
gone a couple of years with no maintenance.

jg
--
@home.com is bogus.
http://www.signonsandiego.com/uniontrib/20071006/news_1b6halo.html


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
hjr.pyth...@gmail.com  
View profile
 More options 9 Oct 2007, 04:15
Newsgroups: comp.databases.oracle.server
From: hjr.pyth...@gmail.com
Date: Mon, 08 Oct 2007 20:15:28 -0700
Local: Tues 9 Oct 2007 04:15
Subject: Re: How many people here rebuid index regularly?
On Oct 9, 5:56 am, MTNorman <mtnor...@duke-energy.com> wrote:
...

> So if the index avg row length is a fraction of the table avg row
> length and the index storage is still a multiple of the table storage
> (30 bytes on the index, 200 bytes on the table, 10g for the table, 20g
> for the index) - you may want consider reindexing.  The ratio does not
> necessarily mean rebuilding is needed - it's just a tool/method for
> identifying indexes to examine.  A better method may be segment
> activity - fragmented indexes that are causing performance problems in
> OLTP also tend to be among the most active segments.

I quite like that advice. It's not simplistic ("If index is lots
bigger than table, then it needs further investigation") and it asks
for cross-checking with other metrics (in this case, segment activity,
but I wouldn't rule out throwing in the del_lf_rows/lf_rows measure,
too). Much, much better than "if some ratio=20%, rebuild"!!

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alberto Frosi  
View profile
 More options 9 Oct 2007, 07:58
Newsgroups: comp.databases.oracle.server
From: Alberto Frosi <alberto.fr...@gmail.com>
Date: Mon, 08 Oct 2007 23:58:33 -0700
Local: Tues 9 Oct 2007 07:58
Subject: Re: How many people here rebuid index regularly?
On 9 Ott, 00:08, joel garry <joel-ga...@home.com> wrote:

Hi joel,
i'm very surprised for this approach.
i'm sorry but do you make these operation for know if your indexes
must be rebuild?
Tell more please.
Regards
Alberto

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
joel garry  
View profile
 More options 9 Oct 2007, 15:01
Newsgroups: comp.databases.oracle.server
From: joel garry <joel-ga...@home.com>
Date: Tue, 09 Oct 2007 07:01:48 -0700
Local: Tues 9 Oct 2007 15:01
Subject: Re: How many people here rebuid index regularly?
On Oct 8, 11:58 pm, Alberto Frosi <alberto.fr...@gmail.com> wrote:

No,  I've never rebuilt any indexes on this db.  I'm thinking about it
now, for space reasons, not performance - I don't think there are any
fast full index scans on this index, for instance.  There's just a
number of gigabytes of wasted space in this schema.

> Tell more please.

Jonathan is the expert :-)

http://en.wikipedia.org/wiki/Answer_to_Life%2C_the_Universe%2C_and_Ev...


jg
--
@home.com is bogus.
I'd like to see nominations for the sysadmin from hell.
http://www.sysadminoftheyear.com/

    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hasta  
View profile
 More options 10 Oct 2007, 06:45
Newsgroups: comp.databases.oracle.server
From: Hasta <hasta...@hotmail.com>
Date: Wed, 10 Oct 2007 07:45:03 +0200
Local: Wed 10 Oct 2007 06:45
Subject: Re: How many people here rebuid index regularly?
In article <R4ednSBlRM2OCJfaRVny...@bt.com>, jonat...@jlcomp.demon.co.uk
says...

Nice, Jonathan.

Allow me a few days, OK ?

Best Regards

--- Raoul


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Jonathan Lewis  
View profile
(1 user)  More options 12 Oct 2007, 16:08
Newsgroups: comp.databases.oracle.server
From: "Jonathan Lewis" <jonat...@jlcomp.demon.co.uk>
Date: Fri, 12 Oct 2007 16:08:34 +0100
Local: Fri 12 Oct 2007 16:08
Subject: Re: How many people here rebuid index regularly?

"joel garry" <joel-ga...@home.com> wrote in message

news:1191881301.346940.212200@v3g2000hsg.googlegroups.com...

Joel,

Sorry for taking so long to get back on this - I've been
a bit busy for the last week.

Simple solutions are desirable - and there's no such thing as
"too simple", although there is "too simple-minded".

It's an interesting set of figures on the rebuild - especially
with those little spikes.  I'm guessing that there's been a little
bit of activity that would explain why you've got a few blocks
with about 113 rows in - those look like the result of a few
leaf block splits.

Could I guess that the leading column of this index has a few
(perhaps just 3) values which are particularly popular - perhaps
it's a single column index with a lot of skew, or a multi-column index
with a skew on the first column.  That might explain the spikes at
199, 205, and 210 rows per block.  If that's the case, then compressing
on that column would be sensible at any time.

Since you've got 176 rows reported before the rebuild that suggests
you've got some blocks with 290 rows per block -  which is odd
because that doesn't show up after the rebuild.  (At a default 10%
free on a rebuild that 290 peak ought to drop to about 261, and
your figures are way below that - do the counts start to taper
off at about 230 rows per block so that blocks with more rows
are just the odd one or two ?)

The post-rebuild figures would encourage me to look closely at
the index because it isn't a "boring, random" index; but (if I hadn't
seen the post-rebuild) I would have looked at the pre-rebuild
figures and decided that I wasn't really going to see a DIRECT
performance improvement from the rebuild - so I would only
consider rebuilding it if
    a) It was extremely popular
and I was fairly confident that
    b) the 60,000 (call it 40,000 after initial degeneration) drop
        in the block count meant I would get a constant saving in
        the buffer cache that paid for the work and time spent in
        rebuilding.
However, given that blocks seem to start splitting soon after the
rebuild I might then take a little care to balance the frequency of
rebuilds against the pctfree I set so that I managed to rebuild
before any serious amount of block splits started to occur.

Bottom line - if you see a performance issue related to db file
sequential reads, and if the segment statistics (v$segstat) highlights
a particular index as being a major culprit, and if the query shows
the index blocks to be thinly populated  (spread like yours, or with
a very long near-empty tail that you think is being scanned) then
consider rebuilding a thinly populated index, and coalescing an index
with a long tail.

Remember: a B-tree index on randomly arriving data will spread
to an average 70% utilisation.  A rebuild index will (by default) run
at 90% utilisation.  Therefore rebuilding indexes which show a 20%
drop between prod and test is too simple-minded.  An index that
shows an interesting pattern before or after rebuild may be worthy
of special consideration.

--
Regards

Jonathan Lewis
http://jonathanlewis.wordpress.com

Author: Cost Based Oracle: Fundamentals
http://www.jlcomp.demon.co.uk/cbo_book/ind_book.html

The Co-operative Oracle Users' FAQ
http://www.jlcomp.demon.co.uk/faq/ind_faq.html


    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message, you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
joel garry  
View profile
 More options 12 Oct 2007, 19:49
Newsgroups: comp.databases.oracle.server
From: joel garry <joel-ga...@home.com>
Date: Fri, 12 Oct 2007 11:49:57 -0700
Local: Fri 12 Oct 2007 19:49
Subject: Re: How many people here rebuid index regularly?
On Oct 12, 8:08 am, "Jonathan Lewis" <jonat...@jlcomp.demon.co.uk>
wrote:

No problem!

> Simple solutions are desirable - and there's no such thing as
> "too simple", although there is "too simple-minded".

I run into that a lot.

> It's an interesting set of figures on the rebuild - especially
> with those little spikes.  I'm guessing that there's been a little
> bit of activity that would explain why you've got a few blocks
> with about 113 rows in - those look like the result of a few
> leaf block splits.

Guessing?  What would Alex say!  :-)

> Could I guess that the leading column of this index has a few
> (perhaps just 3) values which are particularly popular - perhaps
> it's a single column index with a lot of skew, or a multi-column index
> with a skew on the first column.  That might explain the spikes at
> 199, 205, and 210 rows per block.  If that's the case, then compressing
> on that column would be sensible at any time.

All indices on this table have lots of columns - Primary has 10
columns, another has 5, the one in question 6.  Being a generalized
ERP inventory system, they all start with a company code (just one in
each instance, so far, 1 character), and something else with few
values next.  So that's a spot-on guess.  The first 5 columns in this
index are limited in value range, the last is a document number which
comes from several systems with several definitions, some of which are
steadily increasing.

> Since you've got 176 rows reported before the rebuild that suggests
> you've got some blocks with 290 rows per block -  which is odd
> because that doesn't show up after the rebuild.  (At a default 10%
> free on a rebuild that 290 peak ought to drop to about 261, and
> your figures are way below that - do the counts start to taper
> off at about 230 rows per block so that blocks with more rows
> are just the odd one or two ?)

Yes, sorry I didn't post the whole list, I didn't think it would be
that interesting :-)

...
ROWS_PER_BLOCK     BLOCKS
-------------- ----------
           223        153
           224        603
           225        137
           226        427
           227        143
           228        554
           229        141
           230        210
           231        118
           232        125
           233        134

ROWS_PER_BLOCK     BLOCKS
-------------- ----------
           234        122
           235         11
           236         12
           237         24
           238         12
           239         15
           240         15
           241         15
           244          2
           245          1
           249          1

> The post-rebuild figures would encourage me to look closely at
> the index because it isn't a "boring, random" index; but (if I hadn't
> seen the post-rebuild) I would have looked at the pre-rebuild
> figures and decided that I wasn't really going to see a DIRECT
> performance improvement from the rebuild - so I would only
> consider rebuilding it if
>     a) It was extremely popular

No evidence one way or the other, but no one complains...

> and I was fairly confident that
>     b) the 60,000 (call it 40,000 after initial degeneration) drop
>         in the block count meant I would get a constant saving in
>         the buffer cache that paid for the work and time spent in
>         rebuilding.

I have no such confidence.  But I do have a routine from the dark ages
that imp/exp the whole schema on a weekend night.  I'm trying to
figure out if I can justify to management anything less simple-
minded.  So far I haven't.

> However, given that blocks seem to start splitting soon after