removes joins on avatar and banner in endpoint /notes/children #303

Manually merged
Johann150 merged 1 commit from puniko/FoundKey:fix/endpoint-children into main 2023-01-05 20:06:45 +00:00
Contributor

this simply removes the joins from user to avatar and banner in the /notes/children endpoint.

fixes #256

currently running on my fork on mab, seems to be not needed at all in this endpoint. avatars and banners still show up as normal while being able to load children in threads much quicker.

would like to have some other people test it out first before merge

this simply removes the joins from user to avatar and banner in the /notes/children endpoint. fixes https://akkoma.dev/FoundKeyGang/FoundKey/issues/256 currently running on my fork on mab, seems to be not needed at all in this endpoint. avatars and banners still show up as normal while being able to load children in threads much quicker. would like to have some other people test it out first before merge
puniko added 1 commit 2022-12-26 08:41:20 +00:00
removing joins to avatar and banners in children endpoint
Some checks failed
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline failed
ci/woodpecker/pr/lint-backend Pipeline failed
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/pr/lint-sw Pipeline failed
ci/woodpecker/pr/test Pipeline failed
e89c0135bd
Owner

I think removing it in the endpoint will just mean that it will fetch the necessary information when packing the note, i.e. in packages/backend/src/models/repositories/user.ts. Essentially making a join outside the database which doesnt really sound like a good idea? It makes me even more confused. Perhaps because of the database query cache in redis...

I noticed though that with this I think banner images will not be fetched any more. Did you by any chance try only removing the banner image join?

I think removing it in the endpoint will just mean that it will fetch the necessary information when packing the note, i.e. [in `packages/backend/src/models/repositories/user.ts`](https://akkoma.dev/FoundKeyGang/FoundKey/src/commit/eea2eb491953c8bd43ca4a325351e165f40b3585/packages/backend/src/models/repositories/user.ts#L308). Essentially making a join outside the database which doesnt really sound like a good idea? It makes me even more confused. Perhaps because of the database query cache in redis... I noticed though that with this I think banner images will not be fetched any more. Did you by any chance try only removing the banner image join?
Author
Contributor

I think removing it in the endpoint will just mean that it will fetch the necessary information when packing the note, i.e. in packages/backend/src/models/repositories/user.ts. Essentially making a join outside the database which doesnt really sound like a good idea? It makes me even more confused. Perhaps because of the database query cache in redis...

it seems tho that packing it outside is quicker than making the joins. (and yes, i noticed it still having the avatar links in the response json

I noticed though that with this I think banner images will not be fetched any more. Did you by any chance try only removing the banner image join?

i haven't tried it on the endpoint alone, but (as stated in the issue) removing either avatar or banner doesn't improve the speed of the query. only when i remove both, its being quicker again.

mmmh, might have to digg a bit deeper into this. you proposed a subquery? how would i go about it with this model implementation? (i think you might have more expr with this than me)

> I think removing it in the endpoint will just mean that it will fetch the necessary information when packing the note, i.e. [in `packages/backend/src/models/repositories/user.ts`](https://akkoma.dev/FoundKeyGang/FoundKey/src/commit/eea2eb491953c8bd43ca4a325351e165f40b3585/packages/backend/src/models/repositories/user.ts#L308). Essentially making a join outside the database which doesnt really sound like a good idea? It makes me even more confused. Perhaps because of the database query cache in redis... it seems tho that packing it outside is quicker than making the joins. (and yes, i noticed it still having the avatar links in the response json > I noticed though that with this I think banner images will not be fetched any more. Did you by any chance try only removing the banner image join? i haven't tried it on the endpoint alone, but (as stated in the issue) removing either avatar or banner doesn't improve the speed of the query. only when i remove both, its being quicker again. mmmh, might have to digg a bit deeper into this. you proposed a subquery? how would i go about it with this model implementation? (i think you might have more expr with this than me)
Johann150 approved these changes 2023-01-05 20:03:05 +00:00
Johann150 left a comment
Owner

While I would still like to know why this is so slow it still seems okay to merge to me.

While I would still like to know why this is so slow it still seems okay to merge to me.
Johann150 manually merged commit cdba5447e6 into main 2023-01-05 20:06:45 +00:00
Sign in to join this conversation.
No reviewers
No labels
feature
fix
upkeep
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: FoundKeyGang/FoundKey#303
No description provided.