postgresqlpgbouncerpg-trgm

Set GUC parameter or use PGOPTIONS environment variable with PgBouncer


Can I make PgBouncer preserve the PGOPTIONS environment variable in transaction pooling to configure GUC parameters? Or is there another way to configure these parameters in PgBouncer so that it applies to all connections?

I specifically need to set some pg_trgm parameters


Solution

  • You can use the connect_query option in database definitions, like

    mydb = host=myhost dbname=mydb connect_query='set pg_trgm.similarity_threshold=0.5'
    

    connect_query can be any SQL statement.