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

Optimize count query in MarketingActivityRepository #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

d3f3kt
Copy link

@d3f3kt d3f3kt commented Jan 14, 2022

In some cases the count query can take a lot of time and need an optimization.

For example if the the marketing activity list contains a lot of items (~1M) but only a ~10 different campaigns, postgres will ignore the index generation for campaign_id. This leads to query time above 30 seconds.

This fix will not count the items but will query for the first marketing activity item for the given campaign.

…mization.

For example if the the marketing activity list contains a lot of items (~1M) but only a ~10 different campaigns, postgres will ignore the index generation for campaign_id. This leads to query time above 30 seconds.

This fix will not count the items but will query for the first marketing activity item for the given campaign.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant