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

Reduce query count #119

Merged
merged 3 commits into from
Sep 12, 2018
Merged

Reduce query count #119

merged 3 commits into from
Sep 12, 2018

Conversation

raoulsullivan
Copy link
Contributor

Hi,

I was optimising site performance when I noticed that flask-blogging emits a lot of database queries, particularly on the index and sitemap views.

The following PR attempts to remedy that by joining the post, tag_posts, tag and user_posts table in both the get_posts and get_post_by_id methods. This results in moving the responsibility for joining posts to tags from the database to the Python.

The PR also changes from Flask-Cache to flask-caching to overcome this issue.

Enjoy!

@gouthambs
Copy link
Owner

Thanks @raoulsullivan . I will take a look later today and merge.

@gouthambs gouthambs merged commit 5a666f4 into gouthambs:master Sep 12, 2018
@gouthambs
Copy link
Owner

@raoulsullivan I merged your changes to master and noticed that the MySQL test fails. Do you have any thoughts?

https://travis-ci.org/gouthambs/Flask-Blogging/jobs/427514097

@raoulsullivan
Copy link
Contributor Author

Yeah, my thought is that I need to do a bit more work! The problem is almost certainly with the ordering of the results when joining the data together, which I remedied for my setup (postgres).

Will spin up a mysql database now and update here.

@raoulsullivan
Copy link
Contributor Author

Addressed in #120

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.

2 participants