Issue Task Resolved

#110515Prevent duplicate dashboard identifiers and improve owner lookups

Wouter Wolters 08/21/26, 20:57 updated 10/12/26, 18:20

Description

Dashboard identifiers are currently generated from the preset identifier and the current timestamp with one-second precision. Creating the same preset more than once within a
second can therefore produce duplicate identifiers.

Additionally, dashboards are loaded by cruser_id, but be_dashboards has no corresponding index. This causes full table scans as the table grows.

The change:

- Generates opaque identifiers using random_bytes().
- Adds a unique database constraint for identifier.
- Adds an index for cruser_id.
- Provides an upgrade wizard that replaces existing duplicate identifiers before the unique constraint is created.

A synthetic SQLite benchmark for owner lookups measured:

- 100,000 rows: 3.069 ms → 0.012 ms (approximately 256× faster)
- 10,000 rows: 0.192 ms → 0.010 ms (approximately 19× faster)

Focused tests cover repeated dashboard creation, schema indexes, and migration of existing duplicates.

Reviews 1

History 24

  1. Wouter Wolters commented and changed status Under Review Resolved done 0 % 100 % <span data-processor="relativetime" data-value="2026-10-12T18:20:13+00:00" > 10/12/26, 18:20 </span>

    Applied in changeset commit:519a56f586f8a8750b9420629850b1f90cf69cab.