Unix Technical Forum

Index Size

This is a discussion on Index Size within the Informix forums, part of the Database Server Software category; --> Is there a convenient way to find out the actual size -- the size in (k|m|g)bytes of indexes? I ...


Go Back   Unix Technical Forum > Database Server Software > Informix

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-20-2008, 04:21 PM
Thomas Ronayne
 
Posts: n/a
Default Index Size

Is there a convenient way to find out the actual size -- the size in
(k|m|g)bytes of indexes? I mean without doing checking or rebuilding,
just show me the name of the index and how big it is?

This is in IDS 7.31.FS6 if that matters.

Thanks.

--
Jus' livin' in the Dilbert Zone...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-20-2008, 04:21 PM
Murray Wood
 
Posts: n/a
Default RE: Index Size

Number of rows * index size ?
If the index is in its own tablespace (will be if created using in
dbspace or by version 9 and 10) then oncheck -pt database:table wil
show you.

MW

(Thanks Version matters here)

-----Original Message-----
From: informix-list-bounces@iiug.org
[mailto:informix-list-bounces@iiug.org] On Behalf Of Thomas Ronayne
Sent: Tuesday, 20 March 2007 8:36 a.m.
To: informix-list@iiug.org
Subject: Index Size

Is there a convenient way to find out the actual size -- the size in
(k|m|g)bytes of indexes? I mean without doing checking or rebuilding,
just show me the name of the index and how big it is?

This is in IDS 7.31.FS6 if that matters.

Thanks.

--
Jus' livin' in the Dilbert Zone...
_______________________________________________
Informix-list mailing list
Informix-list@iiug.org
http://www.iiug.org/mailman/listinfo/informix-list
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-20-2008, 04:21 PM
Thomas Ronayne
 
Posts: n/a
Default Re: Index Size

Murray Wood wrote:
> Number of rows * index size ?
> If the index is in its own tablespace (will be if created using in
> dbspace or by version 9 and 10) then oncheck -pt database:table wil
>

Yeah, I kind of knew about that one but I was thinking of another way
(that I can't remember and can't find in the manuals) that shows the
actual size of indexes in pages or bytes or whatever for all the indexes
(especially the ones in a separate dbspaces).

But, this'll do, and thank you.
> show you.
>
> MW
>
> (Thanks Version matters here)
>
> -----Original Message-----
> From: informix-list-bounces@iiug.org
> [mailto:informix-list-bounces@iiug.org] On Behalf Of Thomas Ronayne
> Sent: Tuesday, 20 March 2007 8:36 a.m.
> To: informix-list@iiug.org
> Subject: Index Size
>
> Is there a convenient way to find out the actual size -- the size in
> (k|m|g)bytes of indexes? I mean without doing checking or rebuilding,
> just show me the name of the index and how big it is?
>
> This is in IDS 7.31.FS6 if that matters.
>
> Thanks.
>
>


--
Jus' livin' in the Dilbert Zone...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-20-2008, 04:21 PM
Zachi
 
Posts: n/a
Default Re: Index Size

On Mar 19, 4:36 pm, Thomas Ronayne <t...@REMOVETHISameritech.net>
wrote:
> Is there a convenient way to find out the actual size -- the size in
> (k|m|g)bytes of indexes? I mean without doing checking or rebuilding,
> just show me the name of the index and how big it is?
>
> This is in IDS 7.31.FS6 if that matters.
>
> Thanks.
>
> --
> Jus' livin' in the Dilbert Zone...


Most convenient way: use ServerStudio (I don't recall which of the
packages has it, as I use the full suite). It will not only show you
the size of the index, but also a list of all the index' extents and
how much is used of the allocated size. Now, if they would also match
the extents to the partitions (and do a better job with partitions in
general) that would be great.

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-20-2008, 04:21 PM
Art S. Kagel
 
Posts: n/a
Default Re: Index Size

Thomas Ronayne wrote:
> Is there a convenient way to find out the actual size -- the size in
> (k|m|g)bytes of indexes? I mean without doing checking or rebuilding,
> just show me the name of the index and how big it is?
>
> This is in IDS 7.31.FS6 if that matters.
>
> Thanks.
>

SELECT st.tabname, sp.npused as indexpages, (sp.npused * sd.pagesize / 1024)
as indexKB
FROM sysmaster:systabnames st,
sysmaster:systabnames st2,
sysmaster:sysptnhdr sp,
sysmaster:sysdbspaces sd
WHERE st2.dbsname = 'mydatabase' AND st2.tabname = 'mytable'
AND st2.partnum = st.lockid
AND st.partnum = sp.partnum
AND sd.dbsnum = (sp.partnum /1048576)
;

This will show you space for all of the tables partitions including
fragments and detached indexes. To see ONLY index space add the following
filter:

AND st.tabname != st2.tabname

Art S. Kagel
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-20-2008, 04:21 PM
Keith Simmons
 
Posts: n/a
Default Re: Index Size

On 20/03/07, Art S. Kagel <kagel@bloomberg.net> wrote:
> Thomas Ronayne wrote:
> > Is there a convenient way to find out the actual size -- the size in
> > (k|m|g)bytes of indexes? I mean without doing checking or rebuilding,
> > just show me the name of the index and how big it is?
> >
> > This is in IDS 7.31.FS6 if that matters.
> >
> > Thanks.
> >

> SELECT st.tabname, sp.npused as indexpages, (sp.npused * sd.pagesize / 1024)
> as indexKB
> FROM sysmaster:systabnames st,
> sysmaster:systabnames st2,
> sysmaster:sysptnhdr sp,
> sysmaster:sysdbspaces sd
> WHERE st2.dbsname = 'mydatabase' AND st2.tabname = 'mytable'
> AND st2.partnum = st.lockid
> AND st.partnum = sp.partnum
> AND sd.dbsnum = (sp.partnum /1048576)
> ;
>
> This will show you space for all of the tables partitions including
> fragments and detached indexes. To see ONLY index space add the following
> filter:
>
> AND st.tabname != st2.tabname
>
> Art S. Kagel
> _______________________________________________
> Informix-list mailing list
> Informix-list@iiug.org
> http://www.iiug.org/mailman/listinfo/informix-list
>

Unfortunately this won't show the space taken up by attached indexes
(which are default on 7.31, the original poster's platform).

Keith
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #7 (permalink)  
Old 04-20-2008, 04:22 PM
Christian Knappke
 
Posts: n/a
Default Re: Index Size

From the keyboard of "Keith Simmons" <smiley73@googlemail.com>:

> On 20/03/07, Art S. Kagel <kagel@bloomberg.net> wrote:
>> Thomas Ronayne wrote:
>> > Is there a convenient way to find out the actual size -- the
>> > size in (k|m|g)bytes of indexes? I mean without doing
>> > checking or rebuilding, just show me the name of the index
>> > and how big it is?
>> >
>> > This is in IDS 7.31.FS6 if that matters.
>> >
>> > Thanks.
>> >

>> SELECT st.tabname, sp.npused as indexpages, (sp.npused *
>> sd.pagesize / 1024) as indexKB
>> FROM sysmaster:systabnames st,
>> sysmaster:systabnames st2,
>> sysmaster:sysptnhdr sp,
>> sysmaster:sysdbspaces sd
>> WHERE st2.dbsname = 'mydatabase' AND st2.tabname = 'mytable'
>> AND st2.partnum = st.lockid
>> AND st.partnum = sp.partnum
>> AND sd.dbsnum = (sp.partnum /1048576)
>> ;
>>
>> This will show you space for all of the tables partitions
>> including fragments and detached indexes. To see ONLY index
>> space add the following filter:
>>
>> AND st.tabname != st2.tabname
>>
>> Art S. Kagel
>>

> Unfortunately this won't show the space taken up by attached
> indexes (which are default on 7.31, the original poster's
> platform).


That info you get from

select count(*), a.tp_type
from sysmaster:systabpagtypes a
where a.tp_partnum = <partnum> group by a.tp_type

Where

tp_type=0: Free pages
tp_type=4: Data pages with room for another row
tp_type=12: Data pages without room for another row
tp_type=8: Index and bitmap pages
tp_type=2: Empty BLOBs pages
tp_type=6: Semi-Full BLOBLs pages
tp_type=10: Full BLOBs pages
tp_type=14: Very-Full BLOBs pages

That is, tp_type=8 counts the pages of attached indices.

HTH and best regards
Christian
--
#include <std_disclaimer.h>
/* The opinions stated above are my own and not
necessarily those of my employer. */
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #8 (permalink)  
Old 04-20-2008, 04:22 PM
Art S. Kagel
 
Posts: n/a
Default Re: Index Size

Keith Simmons wrote:
> On 20/03/07, Art S. Kagel <kagel@bloomberg.net> wrote:
>
>> Thomas Ronayne wrote:
>> > Is there a convenient way to find out the actual size -- the size in
>> > (k|m|g)bytes of indexes? I mean without doing checking or rebuilding,
>> > just show me the name of the index and how big it is?
>> >
>> > This is in IDS 7.31.FS6 if that matters.
>> >
>> > Thanks.
>> >

>> SELECT st.tabname, sp.npused as indexpages, (sp.npused * sd.pagesize /
>> 1024)
>> as indexKB
>> FROM sysmaster:systabnames st,
>> sysmaster:systabnames st2,
>> sysmaster:sysptnhdr sp,
>> sysmaster:sysdbspaces sd
>> WHERE st2.dbsname = 'mydatabase' AND st2.tabname = 'mytable'
>> AND st2.partnum = st.lockid
>> AND st.partnum = sp.partnum
>> AND sd.dbsnum = (sp.partnum /1048576)
>> ;
>>
>> This will show you space for all of the tables partitions including
>> fragments and detached indexes. To see ONLY index space add the
>> following
>> filter:
>>
>> AND st.tabname != st2.tabname
>>
>> Art S. Kagel
>> _______________________________________________
>> Informix-list mailing list
>> Informix-list@iiug.org
>> http://www.iiug.org/mailman/listinfo/informix-list
>>

> Unfortunately this won't show the space taken up by attached indexes
> (which are default on 7.31, the original poster's platform).


Arg! Missed the version info in the original post. For attached indexes,
and to adjust the above for 7.31:

SELECT st.tabname, sp.npused as indexpages,
(sp.npused * 2) as indexKB
FROM sysmaster:systabnames st,
sysmaster:systabnames st2,
sysmaster:sysptnhdr sp,
sysmaster:sysdbspaces sd
WHERE st2.dbsname = 'mydatabase' AND st2.tabname = 'mytable'
AND st2.partnum = st.lockid
AND st.partnum = sp.partnum
AND sd.dbsnum = (sp.partnum /1048576)
AND st.tabname != st2.tabname
UNION ALL
SELECT st.tabname, sp.npused as indexpages,
((sp.npused - npdata) * 2) as indexKB
FROM sysmaster:systabnames st,
sysmaster:systabnames st2,
sysmaster:sysptnhdr sp,
sysmaster:sysdbspaces sd
WHERE st2.dbsname = 'mydatabase' AND st2.tabname = 'mytable'
AND st2.partnum = st.lockid
AND st.partnum = sp.partnum
AND sd.dbsnum = (sp.partnum /1048576)
AND st.tabname = st2.tabname
;

Art S. Kagel
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #9 (permalink)  
Old 04-20-2008, 04:22 PM
Art S. Kagel
 
Posts: n/a
Default Re: Index Size

Art S. Kagel wrote:
> <SNIP>


Typo in both queries. st.lockid should be sp.lockid.

Art S. Kagel

> Should mention that the '* 2' below in each query should be changed to
> '* 4' on Windows and AIX where the pagesize is 4K rather than 2K. This
> works for 9.xx also and the 10/11 example in my original post doesn't
> need the pagesize adjustment by platform, it's built in.
>
> Art S. Kagel
>
>>> Unfortunately this won't show the space taken up by attached indexes
>>> (which are default on 7.31, the original poster's platform).

>>
>>
>>
>> Arg! Missed the version info in the original post. For attached
>> indexes, and to adjust the above for 7.31:
>>
>> SELECT st.tabname, sp.npused as indexpages,
>> (sp.npused * 2) as indexKB
>> FROM sysmaster:systabnames st,
>> sysmaster:systabnames st2,
>> sysmaster:sysptnhdr sp,
>> sysmaster:sysdbspaces sd
>> WHERE st2.dbsname = 'mydatabase' AND st2.tabname = 'mytable'
>> AND st2.partnum = st.lockid
>> AND st.partnum = sp.partnum
>> AND sd.dbsnum = (sp.partnum /1048576)
>> AND st.tabname != st2.tabname
>> UNION ALL
>> SELECT st.tabname, sp.npused as indexpages,
>> ((sp.npused - npdata) * 2) as indexKB
>> FROM sysmaster:systabnames st,
>> sysmaster:systabnames st2,
>> sysmaster:sysptnhdr sp,
>> sysmaster:sysdbspaces sd
>> WHERE st2.dbsname = 'mydatabase' AND st2.tabname = 'mytable'
>> AND st2.partnum = st.lockid
>> AND st.partnum = sp.partnum
>> AND sd.dbsnum = (sp.partnum /1048576)
>> AND st.tabname = st2.tabname
>> ;
>>
>> Art S. Kagel

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #10 (permalink)  
Old 04-20-2008, 04:22 PM
Thomas Ronayne
 
Posts: n/a
Default Re: Index Size

Thomas Ronayne wrote:
> Is there a convenient way to find out the actual size -- the size in
> (k|m|g)bytes of indexes? I mean without doing checking or rebuilding,
> just show me the name of the index and how big it is?
>
> This is in IDS 7.31.FS6 if that matters.
>
> Thanks.
>

Thanks to all for the advice and code (Art, the 7.x version runs for 15
minutes before I killed it; I'll see if I can figure out why).

--
Jus' livin' in the Dilbert Zone...
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 09:17 AM.


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