dss icon indicating copy to clipboard operation
dss copied to clipboard

[dss] sort cell ids in queries

Open Shastick opened this issue 1 year ago • 0 comments

Sorts cell identifiers (usually stored in the cells column of various entities) in CRDB queries.

This is expected to reduce contention in two ways:

  • similar queries will be guaranteed to access data in a similar order, helping with distributed locking
  • sorted arrays may be easier to compare with the && operator

All queries that contain a condition of the form cells && <some_int64_array> depend on sql.CellUnionToCellIds() or sql.CellUnionToCellIdsWithValidation(), so this PR simply added slices.Sort() step to both of these methods.

First step of #814

Shastick avatar Sep 12 '24 13:09 Shastick