Oh, also, if you have myschema, it will print out attached indexes with the storage clause "IN TABLE" when you report on its parent table:
CREATE UNIQUE INDEX "informix".tabname ON "informix".systables (
tabname ASC,
owner ASC
) USING btree IN TABLE;
------------------------------
Art S. Kagel, President and Principal Consultant
ASK Database Management Corp.
www.askdbmgt.com------------------------------
Original Message:
Sent: Thu March 10, 2022 12:53 PM
From: Art Kagel
Subject: How to detect if table has old-fashioned attached indexes (index pages in non-fragmented table partition)
Milan:
No problem. If the index has an entry in sysmaster:systabnames then it is detached. An attached index will be stored within the parent table's partition and not have an entry there. That's the easiest way. Example, the attached index on the systables table on tabid:
> select * from systabnames where dbsname='art' and tabname = 'tabid';
No rows found.
Versus a detached index:
> select * from systabnames where dbsname='sysmaster' and tabname = 'flags_text_ix1';
partnum 1049505
dbsname sysmaster
owner informix
tabname flags_text_ix1
collate en_US.819
dbsnum 1
1 row(s) retrieved.
Within the database's catalog you can figure this out as well. If you query sysfragments for the parent table's tabid and a fragtype = 'I' and indexname = 'name-of-the-index' there will be no rows for an attached index while a detached index will have at least one sysfragments entry. Example, the attached index on the systables table on tabid:
> select * from sysfragments where tabid = 1 and fragtype = 'I' and indexname = 'tabid';
No rows found.
Versus a detached index:
> select *
> from sysfragments
> where tabid = 245 and fragtype = 'I' and indexname = 'flags_text_ix1';
fragtype I
tabid 245
indexname flags_text_ix1
colno 0
partn 1049505
strategy I
location L
servername
evalpos 0
exprtext
exprbin <BYTE value>
exprarr <BYTE value>
flags 0
dbspace rootdbs
levels 3
npused 42.00000000000
nrows 17.00000000000
clust 27.00000000000
partition rootdbs
version 1
nupdates 0.00
ndeletes 0.00
ninserts 343.0000000000
1 row(s) retrieved.
------------------------------
Art S. Kagel, President and Principal Consultant
ASK Database Management Corp.
www.askdbmgt.com
Original Message:
Sent: Thu March 10, 2022 11:17 AM
From: Milan Rafaj
Subject: How to detect if table has old-fashioned attached indexes (index pages in non-fragmented table partition)
Hello,
does any one knows, if there is a way how to detect tables with attached indexes (in old meaning – index pages are together with data pages in one partition).
Curently system catalogs have such indexes, but we can configure such indexes for user tables via DEFAULT_ATTACH environment variables.
Thank you.
#Informix