index on nulls
Posted in 2006
Topics: General Discussion
If we create an index on a field that is mostly containing null values ( 90% nulls ), will the index still use the same amount of space whether the field is null or if it has data ? Thanks ======================== -<<Floyd Wellershaus>>- Database Administrator Unix Administrator email: fwellers@yahoo.com Home: 703-430-0805 Cell: 703-477-6045 ======================== http://www.one.org/
Not the greatest indexing strategy to index on a field that is mostly one value even if it isn't null. You will get some benefit in space because Informix indexes have a repeat count for keys that are repeated often. I don't know the internal format enough to know if it is limited to 255 repeats or not. If it is then you will have multiple entries of 255 null, 255 null, 255 null etc, where 255 is the count and null is the key. Nulls are stored as a special value in each data type. integer null is really the highest negative int that can be represented in 32 bits. Note on the range it isn't the typical 2147483647 to -2147483648 as is usual but 2147483647 to -2147483647. Similarly a string is a certain odd combination which I don't actually know. But it will have some length.