From 978bd61d500c41995128ef0284ec630dcc6cd376 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Thu, 5 Dec 2019 15:12:57 -0500 Subject: [PATCH] LP#1855329: Hold shelf query speed problem In bug 1827250 I suggested Jason Stephenson look at an alternate SQL formulation to solve the original problem. He did, and deemed it faster, so went with that. Unfortunately, on PG 9.6, we're seeing some data sets that decide on a /very/ poor plan for the wide-hold query with the solution as implemented, but the original suggestion from Jason works fine. In the face of evidence controverting my thought that giving PG more options for planning is better in this case, this commit moves to his original query change. Signed-off-by: Mike Rylander Signed-off-by: Jason Stephenson Signed-off-by: Galen Charlton --- .../src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm index 213ed59e5a..2a5c87e9b4 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Storage/Publisher/action.pm @@ -2146,7 +2146,8 @@ sub wide_hold_data { SELECT id FROM action.hold_request recheck WHERE recheck.current_copy = cp.id - ORDER BY capture_time DESC NULLS LAST + AND recheck.capture_time IS NOT NULL + ORDER BY capture_time DESC LIMIT 1 ))) SQL -- 2.11.0