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>
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