Menu

Saving and Restoring Session-Level Variables in GBase 8a
📰

Saving and Restoring Session-Level Variables in GBase 8a

DEV Community: sql·Michael·about 18 hours ago
#4VN00QV8
#devtosql#devto#dev#gbase#value
Long article (262 words) — no AI summary yet.
Reading 0:00
15s threshold

Some parameters of the China-domestically developed GBase 8a MPP database from GBASE can be set at session level, so they affect only the current connection. Because connection pools reuse connections, a changed value can leak into later SQL, so the safe pattern is to save the current value first, change it, then restore the saved value when done.

Saving the current value

Read the parameter with @@ and store it in a backup variable with set :

gbase> select @@estimate_func_max_len; +-------------------------+ | @@estimate_func_max_len | +-------------------------+ | 0 | +-------------------------+ 1 row in set (Elapsed: 00:00:00.00)

gbase> set @bak=@@estimate_func_max_len; Query OK, 0 rows affected (Elapsed: 00:00:00.00)

Enter fullscreen mode

Exit fullscreen mode

Changing the value

Set the new value and confirm it with show variables :

gbase> set estimate_func_max_len=32700; Query OK, 0 rows affected (Elapsed: 00:00:00.00)

gbase> show variables like 'esti%'; +-----------------------+-------+ |…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.