Re: Slow index builds
Posted in 1998
Also sprach Stephen Walmsley <newc0571@sable.ox.ac.uk> : :Something strange happens when I try to build two indices on table foo :using Online 4.10.UD2 on SCO 3.2.4.2. The first, on column bar1 of type :CHAR(8) takes around 15 minutes. The second, on column bar2 of type :CHAR(10) takes around 24 hours. Why is there such a *huge* difference? How many unique values are there in column bar2? 4.10 uses the old, slow way of building indexes (top down), so having a lot of duplicate values will slow things down a LOT. For duplicate keys, what gets stored in the btree is one occurance of the key value followed by a list of all the rowids for rows that have that key value. The rowid list must be maintained in sorted order, so every new row that turns out to map to an existing key in the index needs to get its rowid inserted into the proper place in the list. V 5 or so addressed this during index build through the "fast indexing" feature, wherein indexes are built from the bottom up (sort the key/rowid values, build the leaf nodes first, then build the rest of the btree above it). I remember seeing indexes that used to take hours to build finish in less than an hour. Dave Dave (posting from home, speaking as a representative of nobody but himself) ********** "Everybody plays the fool, sometimes."