ctdbSetIndexDistinctKeyCountFlag
Set the status of the distinct count flag for an index. To optimize some SQL queries, a better estimation of the duplicate index selectivity is required, which implies determining how many distinct keys there are in an index that allows duplicates. The CTDBINDEX_DUPCNTFLAG index status value indicates that the index has distinct key count capability.
Declaration
CTDBRET ctdbSetIndexDistinctKeyCountFlag(CTHANDLE Handle, CTBOOL Flag);
Description
ctdbSetIndexDistinctKeyCountFlag() sets the distinct count flag for an index. Use ctdbGetIndexDistinctKeyCountFlag() to retrieve the setting of this flag.
It is possible to "promote" a duplicate index to a duplicate index with a distinct count by opening the table, calling ctdbSetIndexDistinctKeyCountFlag() for the index and finally calling ctdbAlterTable() to execute the changes.
A c-treeDB API utility, ctdbdistinct, is available to enable the distinct key count feature for existing index files. This utility is created from mtmake by default.
See also