What does queue_target and queue interval exactly mean in DBConnection?

I read the definition in the docs
https://hexdocs.pm/db_connection/DBConnection.html#start_link/2-queue-config

But I am confused as to what they mean and how do they work. The example given is confusing. Can someone explain me this?

This answer I wrote a while ago might help you.

This is an extremely late reply but would like to provide my own answer in case someone visits.

  • A database connection has a limited number of pool connections.
  • If we set queue interval to be 1s and queue target to 50ms then for every 1s (queue interval) it will check if all connections take longer than 50ms (queue target) to checkout or become available to accept a query. If yes, then it will double the target to 100ms.
  • If again for the next interval it sees that connections take longer than 100ms to checkout then that is the time the connection will drop queries to prevent further burden to the database
1 Like