G
George Potemkin
Guest
> The best solution would be to change all non-unique indexes and add the auto id field as last segment. What is an aim? To provide the exact sorting order of table's records and their copies in temp-tables? It's very specific (and rare) task. Why to "lame" all indexes for it? Non-unique indexes are compact - less disk IO. Records with non-unique keys are retrieved in the order of their physical location inside database if these keys are sorted by rowid - less seek time. For example, time to scan the whole table may vary by a few times (or ever a few tens times) depending of an index that is used to scan. Non-unique indexes are the winners in most cases. It's easy to add a temp-table's field with rowids of the original records to provide a sorting match. > This implies having such an auto id in the first place off course... Any index components after a field with the unique values are useless. If the order of index components does not matter for the queries then I'd recommend to use the fields with the less number of unique values as the leading components.
Continue reading...
Continue reading...