nimgwfc
nimgwfc

Reputation: 1509

Save PSQL run time parameter as a variable

I am trying to set max_parallel_workers_per_gather to be equal to the run time parameter max_parallel_workers in the current session only.

I want this to be applicable across numerous different machines so instead of hard-coding a value I want it to be directly relational to this other run time parameter.

Is there a way I can do this? I don't seem to be able to create a variable and set it to be the value of max_parallel_workers like such:

\set test_var max_parallel_workers;

Upvotes: 0

Views: 210

Answers (1)

user330315
user330315

Reputation:

You don't need a variable:

select set_config('max_parallel_workers_per_gather', 
                   current_setting('max_parallel_workers'), false);

Upvotes: 1

Related Questions