Setting parameters for particular groups of users
PostgreSQL supports a variety of ways of defining parameter settings for various user groups. This is very convenient, especially for managing user groups that have different requirements. For instance, some users would constantly require a higher value of work_mem to execute larger analytical queries.
How to do it…
Follow these steps to set parameters at various levels as per the requirements:
- For all users in the
saasdatabase, use the following commands:ALTER DATABASE saas SET configuration_parameter = value1; - For a user named
simonconnected to any database, use the following commands:ALTER ROLE simon SET configuration_parameter = value2; - Alternatively, you can set a parameter for a user only when they’re connected to a specific database, as follows:
ALTER ROLE simon IN DATABASE saas SET configuration_parameter = value3;
The...