Unix Technical Forum

Checking indexes after large deletes

This is a discussion on Checking indexes after large deletes within the Informix forums, part of the Database Server Software category; --> Is there a way to determine how "messed up" an index is after a large number of deletes have ...


Go Back   Unix Technical Forum > Database Server Software > Informix

Register FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2008, 11:17 AM
bozon
 
Posts: n/a
Default Checking indexes after large deletes

Is there a way to determine how "messed up" an index is after a large
number of deletes have been done to a table? I searched here and didn't
see anything. Is there an oncheck command or sysmaster table to look
at? If so what values should I look for? I have to make a case for
rebuilding indexes and having hard data would make my case stronger.

Thanks.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-20-2008, 11:17 AM
Adam Tauno Williams
 
Posts: n/a
Default Re: Checking indexes after large deletes

On Tue, 2006-06-06 at 08:26 -0700, bozon wrote:
> Is there a way to determine how "messed up" an index is after a large
> number of deletes have been done to a table? I searched here and didn't
> see anything. Is there an oncheck command or sysmaster table to look
> at? If so what values should I look for? I have to make a case for
> rebuilding indexes and having hard data would make my case stronger.



I don't know if it is what you are looking for but I use these three
queries to look at index effectiveness:

Index key uniqueness:
select tabname, idxname, nrows, nunique from systables t, sysindexes i
where t.tabid = i.tabid and t.tabid > 99 and nrows > 0 and nunique >0;

Index depth:
select idxname, levels from sysindexes order by 2 desc;

How many times the engine has resorted to a sequential scan:
select tabname, sum(seqscans) tot_scans from sysmaster:sysptprof where
seqscans > 0 and dbsname not like "sys%" group by 1;

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-20-2008, 11:17 AM
Marco Greco
 
Posts: n/a
Default Re: Checking indexes after large deletes

bozon wrote:
> Is there a way to determine how "messed up" an index is after a large
> number of deletes have been done to a table? I searched here and didn't
> see anything. Is there an oncheck command or sysmaster table to look
> at? If so what values should I look for? I have to make a case for
> rebuilding indexes and having hard data would make my case stronger.
>
> Thanks.
>
> _______________________________________________
> Informix-list mailing list
> Informix-list@iiug.org
> http://www.iiug.org/mailman/listinfo/informix-list
>


Why rebuild the index after you have gone through the effort of marking all
those keys as deleted? drop the index first.
Caveat: if you are using the index to drive the delete, that might not be a
good idea...

--
Ciao,
Marco
__________________________________________________ ____________________________
Marco Greco /UK /IBM Standard disclaimers apply!

Structured Query Scripting Language http://www.4glworks.com/sqsl.htm
4glworks http://www.4glworks.com
Informix on Linux http://www.4glworks.com/ifmxlinux.htm

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-20-2008, 11:17 AM
bozon
 
Posts: n/a
Default Re: Checking indexes after large deletes

Good idea to drop the index first. In general this is what I do, but
this process is part of a job that removes customer data for customers
that no longer use our product. It is part of a monthly cleanup and it
happens while the instance is on line.

So is there a way to know if the cleaner is keeping up and
restructuring the indexes (by removing the keys that are marked deleted
and then reorganizing the nodes to rebalance the B-Tree?

Marco Greco wrote:
> bozon wrote:
> > Is there a way to determine how "messed up" an index is after a large
> > number of deletes have been done to a table? I searched here and didn't
> > see anything. Is there an oncheck command or sysmaster table to look
> > at? If so what values should I look for? I have to make a case for
> > rebuilding indexes and having hard data would make my case stronger.
> >
> > Thanks.
> >
> > _______________________________________________
> > Informix-list mailing list
> > Informix-list@iiug.org
> > http://www.iiug.org/mailman/listinfo/informix-list
> >

>
> Why rebuild the index after you have gone through the effort of marking all
> those keys as deleted? drop the index first.
> Caveat: if you are using the index to drive the delete, that might not be a
> good idea...
>
> --
> Ciao,
> Marco
> __________________________________________________ ____________________________
> Marco Greco /UK /IBM Standard disclaimers apply!
>
> Structured Query Scripting Language http://www.4glworks.com/sqsl.htm
> 4glworks http://www.4glworks.com
> Informix on Linux http://www.4glworks.com/ifmxlinux.htm


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-20-2008, 11:17 AM
Art S. Kagel
 
Posts: n/a
Default Re: Checking indexes after large deletes

bozon wrote:
> Good idea to drop the index first. In general this is what I do, but
> this process is part of a job that removes customer data for customers
> that no longer use our product. It is part of a monthly cleanup and it
> happens while the instance is on line.
>
> So is there a way to know if the cleaner is keeping up and
> restructuring the indexes (by removing the keys that are marked deleted
> and then reorganizing the nodes to rebalance the B-Tree?


onstat -g btc

Will show you what index pages have been marked for cleaning. If you see a
preponderence of pages for a single partnum (index or index fragment) that
would be a candidate for a rebuild if you cannot wait for the Btree Cleaners
to catch up.

Art S. Kagel

> Marco Greco wrote:
>
>>bozon wrote:
>>
>>>Is there a way to determine how "messed up" an index is after a large
>>>number of deletes have been done to a table? I searched here and didn't
>>>see anything. Is there an oncheck command or sysmaster table to look
>>>at? If so what values should I look for? I have to make a case for
>>>rebuilding indexes and having hard data would make my case stronger.
>>>
>>>Thanks.
>>>
>>>_____________________________________________ __
>>>Informix-list mailing list
>>>Informix-list@iiug.org
>>>http://www.iiug.org/mailman/listinfo/informix-list
>>>

>>
>>Why rebuild the index after you have gone through the effort of marking all
>>those keys as deleted? drop the index first.
>>Caveat: if you are using the index to drive the delete, that might not be a
>>good idea...
>>
>>--
>>Ciao,
>>Marco
>>________________________________________________ ______________________________
>>Marco Greco /UK /IBM Standard disclaimers apply!
>>
>>Structured Query Scripting Language http://www.4glworks.com/sqsl.htm
>>4glworks http://www.4glworks.com
>>Informix on Linux http://www.4glworks.com/ifmxlinux.htm

>
>

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-20-2008, 11:18 AM
bozon
 
Posts: n/a
Default Re: Checking indexes after large deletes

I can't seem to get "onstat -g btc" to return anything in 9.21 FC4 or
10.0 FC4.

Art S. Kagel wrote:
> bozon wrote:
> > Good idea to drop the index first. In general this is what I do, but
> > this process is part of a job that removes customer data for customers
> > that no longer use our product. It is part of a monthly cleanup and it
> > happens while the instance is on line.
> >
> > So is there a way to know if the cleaner is keeping up and
> > restructuring the indexes (by removing the keys that are marked deleted
> > and then reorganizing the nodes to rebalance the B-Tree?

>
> onstat -g btc
>
> Will show you what index pages have been marked for cleaning. If you see a
> preponderence of pages for a single partnum (index or index fragment) that
> would be a candidate for a rebuild if you cannot wait for the Btree Cleaners
> to catch up.
>
> Art S. Kagel
>
> > Marco Greco wrote:
> >
> >>bozon wrote:
> >>
> >>>Is there a way to determine how "messed up" an index is after a large
> >>>number of deletes have been done to a table? I searched here and didn't
> >>>see anything. Is there an oncheck command or sysmaster table to look
> >>>at? If so what values should I look for? I have to make a case for
> >>>rebuilding indexes and having hard data would make my case stronger.
> >>>
> >>>Thanks.
> >>>
> >>>_____________________________________________ __
> >>>Informix-list mailing list
> >>>Informix-list@iiug.org
> >>>http://www.iiug.org/mailman/listinfo/informix-list
> >>>
> >>
> >>Why rebuild the index after you have gone through the effort of marking all
> >>those keys as deleted? drop the index first.
> >>Caveat: if you are using the index to drive the delete, that might not be a
> >>good idea...
> >>
> >>--
> >>Ciao,
> >>Marco
> >>________________________________________________ ______________________________
> >>Marco Greco /UK /IBM Standard disclaimers apply!
> >>
> >>Structured Query Scripting Language http://www.4glworks.com/sqsl.htm
> >>4glworks http://www.4glworks.com
> >>Informix on Linux http://www.4glworks.com/ifmxlinux.htm

> >
> >


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-20-2008, 11:18 AM
Adam Tauno Williams
 
Posts: n/a
Default Re: Checking indexes after large deletes

> I can't seem to get "onstat -g btc" to return anything in 9.21 FC4 or
> 10.0 FC4.


It doesn't do anything on my "10.00.UC4" box.

There is "btree cleaner info", with "onstat -C". Is that the same
thing?

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-20-2008, 11:18 AM
Doug McAllister@Fidelity Investments
 
Posts: n/a
Default Re: Checking indexes after large deletes

hmmm, btc is not a valid option in my 10.00.FC4 instance and when I try
it onstat gives me the help listing. When I try it on my 9.40
instances, I get nothing at all.

Art S. Kagel wrote:
> bozon wrote:
> > Good idea to drop the index first. In general this is what I do, but
> > this process is part of a job that removes customer data for customers
> > that no longer use our product. It is part of a monthly cleanup and it
> > happens while the instance is on line.
> >
> > So is there a way to know if the cleaner is keeping up and
> > restructuring the indexes (by removing the keys that are marked deleted
> > and then reorganizing the nodes to rebalance the B-Tree?

>
> onstat -g btc
>
> Will show you what index pages have been marked for cleaning. If you see a
> preponderence of pages for a single partnum (index or index fragment) that
> would be a candidate for a rebuild if you cannot wait for the Btree Cleaners
> to catch up.
>
> Art S. Kagel
>
> > Marco Greco wrote:
> >
> >>bozon wrote:
> >>
> >>>Is there a way to determine how "messed up" an index is after a large
> >>>number of deletes have been done to a table? I searched here and didn't
> >>>see anything. Is there an oncheck command or sysmaster table to look
> >>>at? If so what values should I look for? I have to make a case for
> >>>rebuilding indexes and having hard data would make my case stronger.
> >>>
> >>>Thanks.
> >>>
> >>>_____________________________________________ __
> >>>Informix-list mailing list
> >>>Informix-list@iiug.org
> >>>http://www.iiug.org/mailman/listinfo/informix-list
> >>>
> >>
> >>Why rebuild the index after you have gone through the effort of marking all
> >>those keys as deleted? drop the index first.
> >>Caveat: if you are using the index to drive the delete, that might not be a
> >>good idea...
> >>
> >>--
> >>Ciao,
> >>Marco
> >>________________________________________________ ______________________________
> >>Marco Greco /UK /IBM Standard disclaimers apply!
> >>
> >>Structured Query Scripting Language http://www.4glworks.com/sqsl.htm
> >>4glworks http://www.4glworks.com
> >>Informix on Linux http://www.4glworks.com/ifmxlinux.htm

> >
> >


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-20-2008, 11:18 AM
TBP
 
Posts: n/a
Default Re: Checking indexes after large deletes

Adam Tauno Williams wrote:
>> I can't seem to get "onstat -g btc" to return anything in 9.21 FC4 or
>> 10.0 FC4.

>
> It doesn't do anything on my "10.00.UC4" box.
>
> There is "btree cleaner info", with "onstat -C". Is that the same
> thing?
>

Yes ...

onstat -C

Use the -C option to print the file information about the B-tree scanner
subsystem and each B-tree scanner thread. The following options are
available with the onstat -C command:

prof
Prints the profile information for the system and each B-tree
scanner thread
hot
Prints the hot list index key in the order to be cleaned
part
Prints all partitions with index statistics
clean
Prints information about all the partitions that were cleaned or
need to be cleaned.
range
Prints the savings in pages processes by using index range scanning
all
Prints all onstat -C options
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-20-2008, 11:18 AM
Neil Truby
 
Posts: n/a
Default Re: Checking indexes after large deletes

"Doug McAllister@Fidelity Investments" <dougmc001@gmail.com> wrote in
message news:1149703655.779384.151690@u72g2000cwu.googlegr oups.com...
> hmmm, btc is not a valid option in my 10.00.FC4 instance and when I try
> it onstat gives me the help listing. When I try it on my 9.40
> instances, I get nothing at all.


Nor on my 10.0FC5 one ...
[informix@orbistest01 ~]$ onstat -g btc

IBM Informix Dynamic Server Version 10.00.UC5 -- On-Line -- Up
04:56:48 -- 28048 Kbytes
usage: onstat [ -abcdfghklmpstuxzBCDFRX ] [ -i ] [ -r [<seconds>] ]
[ -o [<outfile>] ] [ <infile> ]
-a Print all info
-b Print buffers
-c Print configuration file
-d [update]
Print spaces and chunks
.....


Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 12:29 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com