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

perf(sql): optimize post search query on the join with messages #3877

Merged
merged 2 commits into from
Mar 16, 2020

Conversation

tuxpiper
Copy link
Member

@tuxpiper tuxpiper commented Mar 11, 2020

This pull request makes the following changes:

  • speeds up sql query for post search , on the way that the messages table is joined
  • in a specific case, I've seen the query time go from 16000+ ms to ~150 ms (100x speed-up achievement unlocked!)

Test checklist:

  • Posts are still displayed on map view, data view, etc
  • Perform a CSV export
  • I certify that I ran my checklist

Fixes ushahidi/platform# .

Ping @ushahidi/platform

@tuxpiper tuxpiper requested a review from rowasc March 11, 2020 15:43
@coveralls
Copy link

coveralls commented Mar 11, 2020

Coverage Status

Coverage decreased (-0.009%) to 20.5% when pulling 256e25f on optimize-posts-messages-join into b1b8157 on develop.

Copy link
Contributor

@rowasc rowasc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes total sense in the context of low posts to messages, lets test in steve. I'd suggest adding a note to test exports too, but other than that, not very worried.
amazing perf unlock 🙌 I

);

/*
* The above join is optimized by the (post_id,type) index on messages.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the most useful comment block I've seen in a while, you rock

@tuxpiper
Copy link
Member Author

Thanks @rowasc !

Tagging @Angamanga for consideration to add to next release

@Angamanga Angamanga merged commit b8e701d into develop Mar 16, 2020
@tuxpiper tuxpiper deleted the optimize-posts-messages-join branch March 24, 2021 20:38
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.

4 participants