pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Rory Campbell-Lange <rory@campbell-lange.net>
To: Avinash Kumar <avinash.vallarapu@gmail.com>
Cc: David G. Johnston <david.g.johnston@gmail.com>
Cc: samhitha g <samhithagarudadri@gmail.com>
Cc: pgsql-performance@lists.postgresql.org
Subject: Re: pg_attribute, pg_class, pg_depend grow huge in count and size with multiple tenants.
Date: Thu, 7 May 2020 22:08:46 +0100
Message-ID: <20200507210846.GA17040@campbell-lange.net> (raw)
In-Reply-To: <CAN0TujdCgR5TA4JW6T5Di6nL5RVShbUAfY+G-7Fc-ABH4U=--g@mail.gmail.com>
References: <CAG5FJBVFp4TtEde-xn2hpYQKByFxPQChXitrLorwyiN71+cPyA@mail.gmail.com>
	<CAKFQuwafqFBr+jJ9fGie19CCDoBiGarJejhcwiYHaYyM+kY_kQ@mail.gmail.com>
	<CAN0TujdCgR5TA4JW6T5Di6nL5RVShbUAfY+G-7Fc-ABH4U=--g@mail.gmail.com>

On 07/05/20, Avinash Kumar (avinash.vallarapu@gmail.com) wrote:
> >> Our application serves multiple tenants. Each tenant has the schema
> >> with a few hundreds of tables and few functions.
> >> We have 2000 clients so we have to create 2000 schemas in a single
> >> database.

> > That is one option but I wouldn't say you must.  If you cannot get
> > individual tables to be multi-tenant you are probably better off having one
> > database per client on a shared cluster - at least given the size of the
> > schema and number of clients.
> >
> I am working on a similar problem.
> 1 database per each client may be a killer when you have a connection
> pooler that creates a pool for a unique combination of (user,database).

One of our clusters has well over 500 databases fronted by pg_bouncer.

We get excellent connection "flattening" using pg_bouncer with
per-database connection spikes dealt with through a reserve pool.

The nice thing about separate databases is that it is easy to scale
horizontally.

Rory





view thread (12+ messages)  latest in thread

Message-ID: <20200507210846.GA17040@campbell-lange.net>
Permalink:  ../20200507210846.GA17040@campbell-lange.net/
Also on:    postgresql.org/message-id/20200507210846.GA17040@campbell-lange.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: rory@campbell-lange.net, avinash.vallarapu@gmail.com, david.g.johnston@gmail.com, samhithagarudadri@gmail.com, pgsql-performance@lists.postgresql.org
  Subject: Re: pg_attribute, pg_class, pg_depend grow huge in count and size with multiple tenants.
  In-Reply-To: <20200507210846.GA17040@campbell-lange.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox