I need to find which chunks occupied by a particular table in a informix database.
My current method is get the result from oncheck -pe dbspace
command. But this task is very time consuming when that db-space has many chunks . I need to know is there any single query or quick way to list down the occupied chunks by extends for a particular table
The systabextents within the sysmaster database can be used to determine the chunks associated with a table. An example query:
select distinct te_chunk
from sysmaster:systabextents
where te_partnum != 0 and te_partnum in
(select partnum from systables where tabname = "<table>"
union
select partn from sysfragments f, systables t
where f.tabid = t.tabid and tabname = "<table>"
);
The first part of the union subquery will deal with tables that are not fragmented whilst the second part deals with index partitions and fragmented tables.
To get the chunk path name instead of number this query can be used:
select distinct c.fname
from sysmaster:systabextents te, sysmaster:syschunks c
where te.te_chunk = c.chknum
and te_partnum != 0 and te_partnum in
(select partnum from systables where tabname = "<table>"
union
select partn from sysfragments f, systables t
where f.tabid = t.tabid and tabname = "<table>"
);