Index on Varchar(255) Column
Posted in 2003
Topics: Data Types & Schema Design
Hi, All Informix manual says if you are going to create an index on a varchar column, the max length would be 254 instead of 255. I'm just wondering why there is such a limitation and what will happen if I create an index on varchar(255) column. I used to create an index on varchar(255), it didn't give me any error or warning at all. Thanks. Xin
Time to upgrade either your server or your manuals. The limit arose when the maximum data length for an index key was 255 bytes. A VARCHAR consists of a 1 byte length and that left only 254 bytes available for the data. More recent versions of the server lift the limit on the key length to 390 bytes (give or take - I haven't formally verified the number this morning) so you would be able create a longer index. Hmmm - I see you're complaining that you successfully created the index. Well, as so often, we can't help because you've not identified the platform or (more importantly) the server version. You should check that you have the correct version of the manuals for your server - electronic copies available from the IBM Informix web site. If you have the correct version of the manuals, please file a report with docinf@us.ibm.com citing the PDF file name and page number and the problem. If you didn't have the correct version of the manuals previously, then you do now - read and enjoy. And, don't forget to include your version information when you ask in the future - it often matters! -- Jonathan Leffler (jleffler@us.ibm.com) STSM, Informix Database Engineering, IBM Data Management 4100 Bohannon Drive, Menlo Park, CA 94025 Tel: +1 650-926-6921 Tie-Line: 630-6921 "I don't suffer from insanity; I enjoy every minute of it!" |---------+----------------------------> | | "Li, Xin" | | | <xli@atg.com> | | | Sent by: | | | forum.subscriber@| | | iiug.org | | | | | | | | | 06/23/2003 07:44 | | | AM | | | | |---------+----------------------------> >------------------------------------------------------------------------------- --------------------------------------------------------------| | | | To: ids@iiug.org | | cc: | | Subject: Index on Varchar(255) Column [1411] | | | >------------------------------------------------------------------------------- --------------------------------------------------------------| Hi, All Informix manual says if you are going to create an index on a varchar column, the max length would be 254 instead of 255. I'm just wondering why there is such a limitation and what will happen if I create an index on varchar(255) column. I used to create an index on varchar(255), it didn't give me any error or warning at all. Thanks. Xin