On 8/15/2016 1:30 PM, Edmundo Robles wrote:
> I want find a software to 'enqueue' the client connections to
> database, so if i reach the max limit the query must be holding in a
> queue until one connection is released.
>
pgbouncer is the correct answer, you may need to play about with the
configuration a bit. there's a few modes that might work, ideally,
write your apps to connect to postgres, do a transaction, and
disconnect, and limit the pool size so only so many connections can be
active at a time. the other mode is to allow the clients to stay
connected to the pool, but have a limited number of actual database
connections that you allocate on a transaction basis.
> I have many devices (100+) saving their state to a database, each
> minute, but the table is too large more than 13,000,000 of records
> and many indexes, so, insert one record takes 3 or more minutes.
that sounds terrible. single row inserts shouldn't *ever* take 3
minutes, if you have clients inserting a row a minute. you may need
faster disk storage, you may need to improve postgres tuning.
'many indexes' ? how many ? too many indexes would definitely slow
inserts down.
--
john r pierce, recycling bits in santa cruz