[MISC] Add performance indexes on page_usage table for Superset dashboard optimization#1778
Open
chandrasekharan-zipstack wants to merge 1 commit intomainfrom
Open
[MISC] Add performance indexes on page_usage table for Superset dashboard optimization#1778chandrasekharan-zipstack wants to merge 1 commit intomainfrom
chandrasekharan-zipstack wants to merge 1 commit intomainfrom
Conversation
…oard optimization - Add idx_page_usage_created_org covering index for date-range filtering - Add idx_page_usage_run_id index for JOIN optimization - Fixes 60s+ timeouts in multi-org usage dashboards Migration uses CONCURRENTLY to avoid blocking queries. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Contributor
WalkthroughIntroduces a new Django migration that adds two performance indexes to the Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Contributor
Test ResultsSummary
Runner Tests - Full Report
SDK1 Tests - Full Report
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



What
page_usagetable to optimize Superset dashboard queriesidx_page_usage_created_org(created_at, organization_id) INCLUDE (pages_processed, run_id)- covering index for date-range filteringidx_page_usage_run_id(run_id)- for JOIN withworkflow_file_executionWhy
page_usagetable has ~225k+ rows with no index oncreated_atHow
0003_add_performance_indexes.pywith:RunSQLfor covering index (Django does not supportINCLUDEclause)AddIndexConcurrentlyfor run_id index (Django ORM)CONCURRENTLYto avoid locking table during creationCan this PR break any existing features. If yes, please list possible items. If no, please explain why.
CONCURRENTLYso no table locks during creationDatabase Migrations
backend/account_usage/migrations/0003_add_performance_indexes.pyatomic = False(required forCREATE INDEX CONCURRENTLY)IF NOT EXISTSEnv Config
Relevant Docs
Related Issues or PRs
Dependencies Versions
Notes on Testing
python manage.py migrate account_usageSELECT indexname, indexdef FROM pg_indexes WHERE tablename = page_usage;Screenshots
N/A - Backend/database changes only
Checklist
I have read and understood the Contribution Guidelines.