@Gargron We tried setting the statement_timeout via the database.yml config. It did not work with pg_bouncer. I looked into the rails code (https://github.com/rails/rails/blob/v5.2.4.2/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb#L733), and that seems to call SET SESSION ..
Reading the feature map on https://www.pgbouncer.org/features.html, that will not work when using transaction pooling mode.