If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Informix > getting functional index info from sysindices.indexkeys

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-17-04, 04:23
jason@monitorso jason@monitorso is offline
Registered User
 
Join Date: Dec 2004
Posts: 2
getting functional index info from sysindices.indexkeys

I am trying to write some SQL to retrieve index information from sysindices so that I can re-create the schema of a table. Normal indexes are OK, I can just use the sysindexes view, and link to the syscolumns table, which will give me the columns that the index is on.

The problem comes with functional indexes. I appreciate that the procid exists in the indexkeys columns, but how can I extract this ??? is there an equivalent to ikeyextractcolno for the procid ???

Thanks in advance

Jason
Reply With Quote
  #2 (permalink)  
Old 12-17-04, 06:05
nitin_math nitin_math is offline
Registered User
 
Join Date: Nov 2004
Posts: 143
Hi,

You can extract the complete schema of the table using dbschema which will include the indexes on the table also.

dbschema -d db_name -t table_name

I hope it helps.
Reply With Quote
  #3 (permalink)  
Old 12-17-04, 06:40
jason@monitorso jason@monitorso is offline
Registered User
 
Join Date: Dec 2004
Posts: 2
Yes, I appreciate you can do this with DBSchema, but I have written an app that goes throught all stored procs, views, and tabls, and extracts them to individual files in relevant directories (e.g. c:\DBSchema\Tables c:\DBSChema\Views etc). It all works fine for all exept functional indexes.

Thanks Anyway

Jason
Reply With Quote
  #4 (permalink)  
Old 12-19-04, 20:05
hecremat hecremat is offline
Registered User
 
Join Date: Apr 2004
Location: Malang, Indonesia
Posts: 15
Question the new user of informix

I am want to try informix. but I do not have the informix sortware. can you send me that software,please ?
Reply With Quote
  #5 (permalink)  
Old 02-11-05, 07:15
valle.banciu valle.banciu is offline
Registered User
 
Join Date: Feb 2005
Posts: 6
hi
if you are still interested, this might be an answer:

select ikeyextractcolno(indexkeys,<nr>) from sysindices
where nr is a contor from 1 to ncols
Reply With Quote
  #6 (permalink)  
Old 02-15-05, 09:47
ifx ifx is offline
Registered User
 
Join Date: Feb 2005
Posts: 33
Hi Jason,

to extract the id of the function you could select
indexkeyarray_out(indexkeys) as allparts from sysindices
Then you will get something like "-3 [1], <526>(5) [1], 4 [1]".

The "<526>" is the ID of the function (procid in sysprocedures).

The "[1]" seems to be the operator class (opclassid in sysopclasses)
which you only have to specify in your create statement when its not the default value
(e.g. btree_ops for default access method btree).

The "-3", "5" and "4" are the column numbers (colno in syscolumns),
when less than zero then in DESC order.

So this Index would be something like "(colno3 DESC, ud_function(colno5), colno4)".

If you have one or more user defined functions in your index,
all 16 parts in sysindexes are 0.

I just checked out these things by trying. So no guarantee.
When somebody has exact information, please let me know.

Last edited by ifx; 02-17-05 at 12:43.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On