-
-
Notifications
You must be signed in to change notification settings - Fork 883
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
Remove left joins and use only one call to select method in post_view.rs #3865
Conversation
I will try to get rid of the other left joins Left join is only useful if there's a possibility of a row on the left side being joined with more than one row on the right |
This is great imo. I was just looking at those queries for #3872 and all those left joins are pretty hard to understand and reason about. This is much easier to read. It will need a bit of testing though to see if the query plans are still the same or better. I think they should be and could even be better because with left joins sometimes postgresql estimates multiple rows being retrieved from the left join. |
it would be great if you could also make it so all those person_id_join things aren't actually called when person_id is null (logged out) instead of calling it with a fake -1 value |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good to me 👍 |
nutomic has some comments above too tho. |
This makes the code cleaner and might also improve build time because now there's only one call to
select
.I will probably make this change to other views in separate pull requests in the future.