Fixes problem where use of this function by the tagging circs in search
results feature can result in sequential scans of asset.call_number.
Thanks to Mike Rylander for the suggestion.
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
CREATE OR REPLACE FUNCTION action.usr_visible_circ_copies( INTEGER ) RETURNS SETOF BIGINT AS $$
SELECT DISTINCT(target_copy) FROM action.usr_visible_circs($1)
-$$ LANGUAGE SQL;
+$$ LANGUAGE SQL ROWS 10;
CREATE OR REPLACE FUNCTION action.usr_visible_holds (usr_id INT) RETURNS SETOF action.hold_request AS $func$
DECLARE
--- /dev/null
+BEGIN;
+
+-- set expected row count to low value to avoid problem
+-- where use of this function by the circ tagging feature
+-- results in full scans of asset.call_number
+CREATE OR REPLACE FUNCTION action.usr_visible_circ_copies( INTEGER ) RETURNS SETOF BIGINT AS $$
+ SELECT DISTINCT(target_copy) FROM action.usr_visible_circs($1)
+$$ LANGUAGE SQL ROWS 10;
+
+COMMIT;