Skip to content

feat(dashboards): add concurrent indexes for dashboard widget tiles (5/11)#60493

Merged
MattPua merged 4 commits into
masterfrom
05-28-chore_dashboards_add_concurrent_indexes_for_dashboard_widget_tiles
May 29, 2026
Merged

feat(dashboards): add concurrent indexes for dashboard widget tiles (5/11)#60493
MattPua merged 4 commits into
masterfrom
05-28-chore_dashboards_add_concurrent_indexes_for_dashboard_widget_tiles

Conversation

@MattPua
Copy link
Copy Markdown
Member

@MattPua MattPua commented May 28, 2026

Problem

Widget tiles will be queried by widget_id; the index must be built concurrently to avoid blocking writes on posthog_dashboardtile.

This PR is 5/10 in the dashboard widgets Graphite stack.

Depends on: PR 4 (validated constraints)

Changes

  • Migration 0011_dashboardtile_widget_id_idx — concurrent index on widget_id plus partial unique (dashboard, widget) constraint
  • Final DashboardTile Meta constraints including unique_dashboard_widget

How did you test this code?

  • Agent: did not run manual migrations locally
  • Uses CREATE INDEX CONCURRENTLY pattern from PostHog migration conventions

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Publish to changelog?

no

Docs update

skip-inkeep-docs

🤖 Agent context

  • Index migration is its own PR because concurrent index builds are long-running and should be monitored independently
  • Completes the schema foundation; feature code begins in PR 6

@tests-posthog
Copy link
Copy Markdown
Contributor

tests-posthog Bot commented May 28, 2026

⏭️ Skipped snapshot commit because branch advanced to 753582f while workflow was testing e509ef4.

The new commit will trigger its own snapshot update workflow.

If you expected this workflow to succeed: This can happen due to concurrent commits. To get a fresh workflow run, either:

  • Merge master into your branch, or
  • Push an empty commit: git commit --allow-empty -m 'trigger CI' && git push

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

Migration SQL Changes

Hey 👋, we've detected some migrations on this PR. Here's the SQL output for each migration, make sure they make sense:

products/dashboards/backend/migrations/0011_dashboardtile_widget_id_idx.py

--
-- Custom state/database change combination
--
-- (no-op)
--
-- Raw SQL operation
--
CREATE INDEX CONCURRENTLY IF NOT EXISTS "posthog_dashboardtile_widget_id_idx" ON "posthog_dashboardtile" ("widget_id") WHERE "widget_id" IS NOT NULL;
--
-- Raw SQL operation
--
CREATE UNIQUE INDEX CONCURRENTLY IF NOT EXISTS "unique_dashboard_widget" ON "posthog_dashboardtile" ("dashboard_id", "widget_id") WHERE "widget_id" IS NOT NULL;

Last updated: 2026-05-29 20:32 UTC (184fdda)

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 28, 2026

🔍 Migration Risk Analysis

We've analyzed your migrations for potential risks.

Summary: 1 Safe | 0 Needs Review | 0 Blocked

✅ Safe

Brief or no lock, backwards compatible

dashboards.0011_dashboardtile_widget_id_idx
  └─ #1 ✅ SeparateDatabaseAndState: Only state operations (no database changes)
  └─ #2 ✅ RunSQL: CREATE INDEX CONCURRENTLY is safe (non-blocking)
  └─ #3 ✅ RunSQL: CREATE INDEX CONCURRENTLY is safe (non-blocking)

Last updated: 2026-05-29 20:32 UTC (184fdda)

@tests-posthog
Copy link
Copy Markdown
Contributor

tests-posthog Bot commented May 28, 2026

Query snapshots: Backend query snapshots updated

Changes: 3 snapshots (3 modified, 0 added, 0 deleted)

What this means:

  • Query snapshots have been automatically updated to match current output
  • These changes reflect modifications to database queries or schema

Next steps:

  • Review the query changes to ensure they're intentional
  • If unexpected, investigate what caused the query to change

Review snapshot changes →

@MattPua MattPua changed the title chore(dashboards): add concurrent indexes for dashboard widget tiles feat(dashboards): add concurrent indexes for dashboard widget tiles (5/10) May 28, 2026
@MattPua MattPua marked this pull request as ready for review May 28, 2026 18:26
@assign-reviewers-posthog assign-reviewers-posthog Bot requested review from a team May 28, 2026 18:26
@posthog-project-board-bot posthog-project-board-bot Bot moved this to In Review in Feature Flags May 28, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 28, 2026

Reviews (1): Last reviewed commit: "test(backend): update query snapshots" | Re-trigger Greptile

@MattPua MattPua force-pushed the 05-28-chore_dashboards_add_concurrent_indexes_for_dashboard_widget_tiles branch from 11ac017 to f34895a Compare May 28, 2026 18:51
@MattPua MattPua force-pushed the 05-28-chore_dashboards_validate_dashboard_tile_widget_constraints branch from 8fac007 to 9dbbd45 Compare May 28, 2026 18:51
@tests-posthog
Copy link
Copy Markdown
Contributor

tests-posthog Bot commented May 28, 2026

Query snapshots: Backend query snapshots updated

Changes: 1 snapshots (1 modified, 0 added, 0 deleted)

What this means:

  • Query snapshots have been automatically updated to match current output
  • These changes reflect modifications to database queries or schema

Next steps:

  • Review the query changes to ensure they're intentional
  • If unexpected, investigate what caused the query to change

Review snapshot changes →

@MattPua MattPua force-pushed the 05-28-chore_dashboards_add_concurrent_indexes_for_dashboard_widget_tiles branch from 8cd5862 to f34895a Compare May 28, 2026 19:32
@MattPua MattPua removed the request for review from a team May 28, 2026 19:41
@MattPua MattPua force-pushed the 05-28-chore_dashboards_add_concurrent_indexes_for_dashboard_widget_tiles branch from af3c711 to a780498 Compare May 29, 2026 15:47
@MattPua MattPua force-pushed the 05-28-chore_dashboards_validate_dashboard_tile_widget_constraints branch 2 times, most recently from 8244047 to 9ea68bc Compare May 29, 2026 15:51
@MattPua MattPua force-pushed the 05-28-chore_dashboards_add_concurrent_indexes_for_dashboard_widget_tiles branch from a780498 to 90d6ce0 Compare May 29, 2026 15:51
@MattPua MattPua force-pushed the 05-28-chore_dashboards_validate_dashboard_tile_widget_constraints branch 2 times, most recently from 73ccb70 to 72160a0 Compare May 29, 2026 17:43
@MattPua MattPua force-pushed the 05-28-chore_dashboards_add_concurrent_indexes_for_dashboard_widget_tiles branch from 90d6ce0 to 72ba19b Compare May 29, 2026 17:43
@MattPua MattPua force-pushed the 05-28-chore_dashboards_validate_dashboard_tile_widget_constraints branch from 72160a0 to bd01c79 Compare May 29, 2026 17:48
@MattPua MattPua force-pushed the 05-28-chore_dashboards_add_concurrent_indexes_for_dashboard_widget_tiles branch from 72ba19b to 7a9a082 Compare May 29, 2026 17:48
@MattPua MattPua changed the base branch from 05-28-chore_dashboards_validate_dashboard_tile_widget_constraints to graphite-base/60493 May 29, 2026 18:33
@MattPua MattPua force-pushed the graphite-base/60493 branch from bd01c79 to 97caf5c Compare May 29, 2026 18:33
@MattPua MattPua force-pushed the 05-28-chore_dashboards_add_concurrent_indexes_for_dashboard_widget_tiles branch from 7a9a082 to 6079f69 Compare May 29, 2026 18:33
@graphite-app graphite-app Bot changed the base branch from graphite-base/60493 to master May 29, 2026 18:34
@MattPua MattPua force-pushed the 05-28-chore_dashboards_add_concurrent_indexes_for_dashboard_widget_tiles branch 2 times, most recently from b70602c to e98450b Compare May 29, 2026 18:34
@tests-posthog
Copy link
Copy Markdown
Contributor

tests-posthog Bot commented May 29, 2026

Query snapshots: Backend query snapshots updated

Changes: 1 snapshots (1 modified, 0 added, 0 deleted)

What this means:

  • Query snapshots have been automatically updated to match current output
  • These changes reflect modifications to database queries or schema

Next steps:

  • Review the query changes to ensure they're intentional
  • If unexpected, investigate what caused the query to change

Review snapshot changes →

@MattPua MattPua force-pushed the 05-28-chore_dashboards_add_concurrent_indexes_for_dashboard_widget_tiles branch from a934f69 to 767092b Compare May 29, 2026 19:24
@tests-posthog
Copy link
Copy Markdown
Contributor

tests-posthog Bot commented May 29, 2026

Query snapshots: Backend query snapshots updated

Changes: 1 snapshots (1 modified, 0 added, 0 deleted)

What this means:

  • Query snapshots have been automatically updated to match current output
  • These changes reflect modifications to database queries or schema

Next steps:

  • Review the query changes to ensure they're intentional
  • If unexpected, investigate what caused the query to change

Review snapshot changes →

@MattPua MattPua merged commit 335f51b into master May 29, 2026
196 checks passed
Copy link
Copy Markdown
Member Author

MattPua commented May 29, 2026

Merge activity

@MattPua MattPua deleted the 05-28-chore_dashboards_add_concurrent_indexes_for_dashboard_widget_tiles branch May 29, 2026 20:41
@github-project-automation github-project-automation Bot moved this from Approved to Done in Feature Flags May 29, 2026
@deployment-status-posthog
Copy link
Copy Markdown

deployment-status-posthog Bot commented May 29, 2026

Deploy status

Environment Status Deployed At Workflow
dev ✅ Deployed 2026-05-29 21:17 UTC Run
prod-us ✅ Deployed 2026-05-29 21:37 UTC Run
prod-eu ✅ Deployed 2026-05-29 21:44 UTC Run

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants