Skip to content
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

Merged
merged 3 commits into from
Dec 2, 2021
Merged

Add the data index #461

merged 3 commits into from
Dec 2, 2021

Conversation

manassolanki
Copy link
Member

No description provided.

@netlify
Copy link

netlify bot commented Dec 2, 2021

✔️ 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),
Copy link
Contributor

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

Suggested change
Index('rca_data_query_idx', kpi_id, end_date, data_type),
Index('rca_data_query_idx', kpi_id, data_type, end_date),

Copy link
Member Author

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?

Copy link
Contributor

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

@manassolanki manassolanki merged commit 812da97 into main Dec 2, 2021
@Samyak2 Samyak2 deleted the data-index branch February 14, 2022 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants