Skip to content

Commit d669bc3

Browse files
committed
vecstore: switch partition id generation to GenerateUniqueUnorderedID
Previously we used GenerateUniqueInt to generate vector index partition IDs. While functional, this method ensured that new partitions would generally have higher values than older partitions. This has the potential to create hot spots in the kv range, leading to poor scalability and performance. This patch switches the generation function to GenerateUniqueUnorderedID, which creates new partition ids scattered over the value space which should lead to fewer hot spots. Epic: CRDB-42943 Release note (backwards-incompatible change): Vector indexes created before 25.2 release (e.g. during the beta) will have to be rebuilt.
1 parent a382a18 commit d669bc3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/sql/vecindex/vecstore/store.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ func (s *Store) RunTransaction(ctx context.Context, fn func(txn cspann.Txn) erro
175175
// unique partition key.
176176
func (s *Store) MakePartitionKey() cspann.PartitionKey {
177177
instanceID := s.kv.Context().NodeID.SQLInstanceID()
178-
return cspann.PartitionKey(unique.GenerateUniqueInt(unique.ProcessUniqueID(instanceID)))
178+
return cspann.PartitionKey(unique.GenerateUniqueUnorderedID(unique.ProcessUniqueID(instanceID)))
179179
}
180180

181181
// EstimatePartitionCount is part of the cspann.Store interface. It returns an

0 commit comments

Comments
 (0)