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

Addressing slow profile queries. #2777 #2830

Merged
merged 2 commits into from Apr 25, 2023
Merged

Addressing slow profile queries. #2777 #2830

merged 2 commits into from Apr 25, 2023

Conversation

dessalines
Copy link
Member

This is an attempt to work through a few of the issues dealing with slow profile queries. It doesn't solve all the issues, because the post_view and comment_view queries are unavoidably terrible... and I can't get them any better than ~60ms on average. They really need the eyes of a SQL expert to speed up past that.

I'll address the main changes in the comments.

@@ -122,6 +122,11 @@ fn update_banned_when_expired(conn: &mut PgConnection) {
sql_query(update_ban_expires_stmt)
.execute(conn)
.expect("update banned when expires");

let delete_community_ban_expires_stmt = "delete from community_person_ban where expires < now()";
Copy link
Member Author

Choose a reason for hiding this comment

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

Rather than checking the community_person_ban.expires column every time, I correctly delete the rows which are expired anyway in this scheduled job.

Copy link
Member

Choose a reason for hiding this comment

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

Makes sense, you can do the same for site bans. Btw why are queries in this file all written as plain strings and not using dsl?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, I fixed the ones that I could.

docker/Dockerfile Outdated Show resolved Hide resolved
@@ -3,4 +3,4 @@ set -e

mkdir -p volumes/pictrs
sudo chown -R 991:991 volumes/pictrs
sudo docker-compose up -d --build
sudo docker compose up -d --build
Copy link
Member

Choose a reason for hiding this comment

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

Looks like a mistake.

Copy link
Member Author

Choose a reason for hiding this comment

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

Docker is now bundling compose , and this is the new preferred way anyway.

@Nutomic Nutomic enabled auto-merge (squash) April 25, 2023 20:56
@Nutomic Nutomic merged commit 1b5437c into main Apr 25, 2023
1 check passed
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