]> git.evergreen-ils.org Git - Evergreen.git/commit
LP#1738488 Optimize Flattener join logic
authorDan Wells <dbw2@calvin.edu>
Fri, 2 Mar 2018 17:54:46 +0000 (12:54 -0500)
committerGalen Charlton <gmc@equinoxinitiative.org>
Thu, 22 Mar 2018 18:09:04 +0000 (14:09 -0400)
commit698fbdc4211870d5dd547ec8a0e7302afccb9a50
tree142709645780c597906f5074266d5e02ebb7e564
parent870a7fa4cb080a7e4eac550694b4a656fc278a83
LP#1738488 Optimize Flattener join logic

The current Flattener.pm autogenerates necessary joins for sorting
and filtering, but in doing so, it gives every intermediate table a
unique alias, even if the path to that table is exactly the same as
another member in the map we are flattening.

Instead, let's reuse joins whenever the path is identical, even for
intermediate tables.  We do so by tracking every path to each core
type, then reusing as much of that join path as we can.  In cases
where we have different paths to the same type, we still necessarily
provide a new unique alias.

This problem was first noticed in the web staff billing history
interface, where the particular stacking of joins resulted (for one
specific library) in 17 joins and 44,575,740,147,225,592,344,870,912
potential rows.

Signed-off-by: Dan Wells <dbw2@calvin.edu>
Signed-off-by: Galen Charlton <gmc@equinoxinitiative.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Flattener.pm