Some parameters in GBase 8a can be modified at the session level, affecting only the current connection. When using connection pools, it's a good practice to save the original value, apply the temporary change, and restore it afterwards to avoid impacting subsequent queries. Here's the safe workflow for a gbase database.
Steps
-
Save the current value – Use
SELECT @@parameter_nameand store it in a user variable. -
Change the parameter – Use
SET parameter_name = new_value. -
Restore the parameter – After the specific query completes,
SET parameter_name = @saved_variable.
Complete Example
-- 1. Inspect and save the current value
SELECT @@estimate_func_max_len;
-- Returns 0
SET @bak = @@estimate_func_max_len;
-- 2. Temporarily change the parameter
SET estimate_func_max_len = 32700;
SHOW VARIABLES LIKE 'esti%';
-- Shows Value = 32700
-- 3. Restore the original value
SET estimate_func_max_len = @bak;
SHOW VARIABLES LIKE 'esti%';
-- Shows Value = 0
This pattern lets you tune parameters for specific queries without permanently altering the session environment, keeping your gbase database connections clean and predictable.
Top comments (0)