Subject Re: [ib-support] Index on Boolean-Col
Author Helen Borrie
At 12:24 PM 19-08-01 +0200, you wrote:
>I have a col, that represents boolean-values (0=false, 1=true). Is it a
>good idea to create a index on this col, I would use this index index
>only for ordering ?

No! this index would have the lowest possible selectivity, rendering it a Trojan Horse for performance.

Are you saying you want to ORDER BY this Boolean-style column (i.e. all the FALSE ones first?) Or do you want to combine it with another column? If the latter is true, you might improve on a natural sort by combining your Boolean-style column with the other column in the sort into an index...but not if that second column also has very few possible values...in that case you would still be better off with NATURAL sort order and no index.

rgds,
Helen

All for Open and Open for All
InterBase Developer Initiative ยท http://www.interbase2000.org
_______________________________________________________