size overhead to creating an opaque type.
Posted in 2003
Topics: Data Types & Schema Design
I have an opaque type as follows: create opaque type AsnOctetString384( internallength = variable, maxlen = 386, alignment = 4 ); I am unable to create an index on a field of this type and get -517. I am dicerning that this has been stored in the database as size 392 (too big to create an index!). Since the total for my row is 906 and I have the following: varchar(255) varchar(255) integer i.e. 4 AsnOctetString384 must be 392. Total 906 I didn't write this opaque type, but my understanding was that this and other types had been specifically written to cater for indexes, upto a maximum size, does it look like this one is just done wrong, or might there be another reason ? Is it right that there is an overhead of 6 bytes above the maxlen size to the creation of an opaque type ? The Programmers Guide 10-6 suggests the max len is the maximum that will ever be stored in the field, I would therefore have assumed that an index would be needed only for this size, i.e. <390, i.e. Ok. Can any one help ? Andrew H. sending to informix-list
"Andrew Hardy" <Andrew.Hardy@marconi.com> wrote in message news:<bp0c6l$dss$1@terabinaries.xmission.com>... > I have an opaque type as follows: > > create opaque type AsnOctetString384( > internallength = variable, > maxlen = 386, > alignment = 4 > ); > > I am unable to create an index on a field of this type and get -517. [ snip ] > Can any one help ? Given the size of this object, and the fact that you want to create an index on it, and (if I assume correctly) the maximum size is rarely filled out, then you want to use a multi-representational type to deal with with situation. There are several books that explain how to do this. Check out Jacques Roy's books, or my book. Also, there are lots of examples at: http://www-106.ibm.com/developerworks/db2/zones/informix/db_datatypes.html KR Pb