Skip to content

Use sequences instead of auto increment keys for user facing identifiers #19650

@bx80

Description

@bx80

Several unique identifiers in the Matomo UI are based on auto incrementing database primary keys, such as the site id or goal id.

When using an alternative database which uses random or UUID primary keys these values will become long, random and unfriendly to use. In order to support databases with primary key types other than auto increment these identifiers should be migrated to sequences rather than primary keys.

Suggested Approach

  • Identify all incremental primary keys which are shown in the Matomo UI.
  • Disable auto_increment for the identified primary keys.
  • For each key, rework new record insertion to generate the primary key using the sequence table and then specify it explicitly on insert.

Keys that are shown in the UI
idSite, idCustomDimension, idCustomReport, idGoal, idForm, the keys for most sub-categories under Administration > Measurables.
There may be others.

Metadata

Metadata

Assignees

No one assigned

    Labels

    EnhancementFor new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions