# Too many connections to DB, how to optimize

**URL:** <https://meta.discourse.org/t/too-many-connections-to-db-how-to-optimize/66395>\
**Category:** Support\
**Created:** [July 18, 2017, 3:40pm UTC](https://meta.discourse.org/t/too-many-connections-to-db-how-to-optimize/66395 "2017-07-18T15:40:01Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)\
**Post date:** [July 18, 2017, 4:47pm UTC](https://meta.discourse.org/t/too-many-connections-to-db-how-to-optimize/66395/9 "2017-07-18T16:47:32Z")

</div>

> [@TomekB](#):
>
> It seems like there are some issues with sidekiq connections.

Interesting. We are usually internally totally shielded from this bug cause we use pg bouncer, but we will have a look internally to see if we see similar leaks. 👨🏽‍🌾

Can you debug into the “connections” hanging there, do you have any info on what the last query is these stalled connections ran? how long are they stuck without running anything?

@tgxworld where is our official pg image with bouncer? we need a howto explaining how to use it.

---

_[View the full topic](https://meta.discourse.org/t/too-many-connections-to-db-how-to-optimize/66395)._
