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

Optimize knowledge transfer volumes query #118

Open
mzur opened this issue Feb 1, 2023 · 0 comments
Open

Optimize knowledge transfer volumes query #118

mzur opened this issue Feb 1, 2023 · 0 comments

Comments

@mzur
Copy link
Member

mzur commented Feb 1, 2023

I found that this query is quite slow with our production database. I'm sure it can be optimized.

return Volume::accessibleBy($request->user())
->select('id', 'name')
->has('images.annotations')
->whereNotExists(function ($query) {
$query->select(DB::raw(1))
->from('images')
->whereRaw('images.volume_id = volumes.id')
->whereNull('attrs->metadata->distance_to_ground');
})
->with(['projects' => function ($query) {
$query->select('id', 'name');
}])
->get()
->each(function ($volume) {
$volume->setHidden(['doi']);
});

@mzur mzur moved this to Medium Priority in BIIGLE Roadmap Feb 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Medium Priority
Development

No branches or pull requests

1 participant