If some set command in procedure, that will be valid only in session to primary node, but not valid for sessions to standby node.
example as below:
- create PROCEDURE will be executed on primary node.
CREATE OR REPLACE PROCEDURE sub_proc1()
LANGUAGE plpgsql
AS $$
BEGIN
set enable_indexscan=off;
END;
$$;
- call procedure will be executed on primary node, enable_indexscan is set to off on session to primary node.
call sub_proc1();
-
show command will be executed on standby node. the result of enable_indexscan is still default value(on), not changed;
enable_indexscan;
(1 row)
- so subsequent select query will be routed to standby node, that means for those query enable_indexscan is still on .
is any solution for this?