-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add the data index #461
Add the data index #461
Conversation
✔️ Deploy Preview for frontend-sb ready! 🔨 Explore the source changes: 5415f72 🔍 Inspect the deploy log: https://app.netlify.com/sites/frontend-sb/deploys/61a8a6a27737a90007b515c9 😎 Browse the preview: https://deploy-preview-461--frontend-sb.netlify.app |
@@ -18,6 +18,10 @@ class RcaData(PkModel): | |||
created_at = Column(db.DateTime, nullable=False, | |||
default=dt.datetime.utcnow) | |||
|
|||
__table_args__ = ( | |||
Index('rca_data_query_idx', kpi_id, end_date, data_type), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be more useful as we will always query on kpi_id
and data_type
first, and then if needed query on end_date
Index('rca_data_query_idx', kpi_id, end_date, data_type), | |
Index('rca_data_query_idx', kpi_id, data_type, end_date), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we come up with this sequence after looking all the queries. Could you confirm the sequence once?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(RcaData.kpi_id == kpi_id)
& (RcaData.data_type == "line")
& (RcaData.end_date <= end_date)
This is the general query we do, replacing data_type
with other values
No description provided.