Skip to content

Add database indexes to the experiment-variant entity #1223

Description

@RUKAYAT-CODER

Overview

src/ab-testing/entities/experiment-variant.entity.ts declares no @Index. Columns that are used for lookups, filtering, sorting, or as foreign keys are therefore unindexed, forcing sequential scans as the table grows. Add appropriate indexes (and a migration that creates them) so the common query paths for this entity stay performant.

Specifications

Features:

  • Frequently-queried columns and foreign keys on this entity are indexed.
  • The indexes are created by a reviewable migration rather than only synchronize.

Tasks:

  • Review the query paths that hit experiment-variant and identify the columns used in WHERE / ORDER BY / JOIN / foreign-key lookups.
  • Add @Index decorators (single-column or composite as appropriate) to src/ab-testing/entities/experiment-variant.entity.ts.
  • Add a migration that creates the same indexes so existing databases are updated.

Impacted Files:

  • src/ab-testing/entities/experiment-variant.entity.ts
  • src/migrations/-add-experiment-variant-indexes.ts

Acceptance Criteria

  • The entity carries indexes covering its common lookup/foreign-key columns.
  • A migration creates the indexes and runs cleanly on an existing database.
  • No duplicate/redundant indexes are introduced.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave program

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions