Skip to content

Swap navigation queries from exists()->first() to just first()#182

Draft
haydngreatnews wants to merge 3 commits intomainfrom
fix/nav-query-reduction
Draft

Swap navigation queries from exists()->first() to just first()#182
haydngreatnews wants to merge 3 commits intomainfrom
fix/nav-query-reduction

Conversation

@haydngreatnews
Copy link
Copy Markdown
Collaborator

@haydngreatnews haydngreatnews commented Apr 22, 2025

This should reduce the number of queries we make on two fronts -- first, the
exists does a select 1 ..., which doesn't contribute to the cache, and so the
.first() call then makes a second query to get actual data. There were also a
bunch of places where we were repeatedly calling first to get a related item,
which might have been doing multiple queries -- but this way is also a but more
readable

This should reduce the number of queries we make on two fronts -- first, the
exists does a `select 1 ...`, which doesn't contribute to the cache, and so the
`.first()` call then makes a second query to get actual data. There were also a
bunch of places where we were repeatedly calling `first` to get a related item,
which might have been doing multiple queries -- but this way is also a but more
readable
@haydngreatnews haydngreatnews changed the title Fix/nav query reduction Swap navigation queries from exists()->first() to just first() Apr 22, 2025
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.

1 participant