Skip to content

Optimize count query in MarketingActivityRepository#5

Open
d3f3kt wants to merge 1 commit intooroinc:masterfrom
d3f3kt:feature/optimize-count-query
Open

Optimize count query in MarketingActivityRepository#5
d3f3kt wants to merge 1 commit intooroinc:masterfrom
d3f3kt:feature/optimize-count-query

Conversation

@d3f3kt
Copy link
Copy Markdown

@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