Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-7653

Inconsistent update performance on unique indexes

    • Storage Engines
    • 5
    • Nick - 2024-04-30

      This is being split off from SERVER-56509, which made a change that improved a performance regression on unique indexes, however, update performance is still an order of magnitude worse on unique indexes than non-unique indexes. This is reproducible back to 4.2.

      Quoting myself:

      I wrote a reproducer (attached as "SERVER-56509.js") for the multi-update problem, and the "prefix_key" change does not appear to have completely resolved the regression related to updates on unique indexes. Locally, a multi-update on a non-unique index field for 10K docs took about 250ms. The same update on a unique field took about 15s without the "prefix_key" change and about 8s with the "prefix_key" change.

      I also discovered that the regression only exists if a unique field is updated to a value that sorts before the original key. For example, updating an index field from "ZZZ" to "AAA" triggers the regression, but updating the same field from "AAA" to "ZZZ" does not. I assume this is because of the way MongoDB constructs KeyStrings for seeking when calling _keyExists.

            chenhao.qu@mongodb.com Chenhao Qu
            louis.williams@mongodb.com Louis Williams
            0 Vote for this issue
            14 Start watching this issue