LP1768022: Speed up ahopl user/jboyer/lp1768022_ahopl_speedup
authorJason Boyer <jboyer@library.in.gov>
Tue, 5 Jun 2018 17:57:35 +0000 (13:57 -0400)
committerJason Boyer <jboyer@library.in.gov>
Tue, 5 Jun 2018 17:57:35 +0000 (13:57 -0400)
In some cases the ahr.usr=ausp.usr join was causing
planning times to be many times the actual execution
times for this query. Changing to au.id=ausp.usr
has the same effect but vastly faster planning times.

Signed-off-by: Jason Boyer <jboyer@library.in.gov>
Open-ILS/examples/fm_IDL.xml

index b272b9f..d124ab7 100644 (file)
@@ -6163,7 +6163,7 @@ SELECT  usr,
                        FROM asset.copy_location
                ) acpl_ordered ON (acpl_ordered.id = acp.location)
                LEFT JOIN actor.usr_standing_penalty ausp 
-                       ON (ahr.usr = ausp.usr AND (ausp.stop_date IS NULL OR ausp.stop_date > NOW()))
+                       ON (au.id = ausp.usr AND (ausp.stop_date IS NULL OR ausp.stop_date > NOW()))
                LEFT JOIN config.standing_penalty csp
                        ON (
                                csp.id = ausp.standing_penalty AND