Jeff
Jeff

Reputation: 571

How do I set "options" parameter in a PostgreSQL connection string?

Using PG 9.5. Towards the bottom of the libpq-connect documentation page, just before application_name is the options parameter keyword, which I would like to use to set a specific work_mem value.

I'm just not sure how to use this keyword, along with a value. Here is my configuration file:

dbconnection host=localhost dbname=test user=xxx application_name=test options='work_mem=256MB' password=xxx

What is the correct syntax? Incidentally, I don't know how to check for work_mem value of an active socket. That would also help, thanks in advance!

Upvotes: 1

Views: 4927

Answers (1)

Laurenz Albe
Laurenz Albe

Reputation: 246208

After reading the documentation of the options connection option and connection strings in general, I'd write it like this:

dbname=test options='-c work_mem=256MB' application_name=test

To get the current setting for a connection, run the following SQL command:

SHOW work_mem;

Upvotes: 4

Related Questions