https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=42602

--- Comment #1 from Pedro Amorim <[email protected]> ---
Created attachment 199149
  -->
https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=199149&action=edit
Bug 42602: REST API search performance improvements

belongs_to prefetch is now skipped when related table not referenced in filter
or sort

A belongs_to embed adds a LEFT JOIN to the main SELECT.
MySQL can normally satisfy ORDER BY + LIMIT 20 by walking the sort index and
stopping early, but a LEFT JOIN forces a filesort across all matching
rows first. On large datasets (e.g. 250k+ patrons) this is significant.

When a belongs_to relation is not referenced in the filter or sort
parameters, it is now skipped from prefetch.

In other words, a LEFT JOIN is only added to the query if a filter or
sort on that table exists. Otherwise, the LEFT JOIN is not added.

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
[email protected]
https://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to