Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jh6IK-00074H-8J for pgsql-general@arkaria.postgresql.org; Fri, 05 Jun 2020 06:57:36 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jh6II-0001Qc-QT for pgsql-general@arkaria.postgresql.org; Fri, 05 Jun 2020 06:57:34 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jh6II-0001QV-Ia for pgsql-general@lists.postgresql.org; Fri, 05 Jun 2020 06:57:34 +0000 Received: from smtpout.aon.at ([195.3.96.113]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jh6IF-0006dq-E8 for pgsql-general@postgresql.org; Fri, 05 Jun 2020 06:57:33 +0000 Received: (qmail 10603 invoked from network); 5 Jun 2020 06:57:29 -0000 X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on WARSBL603.highway.telekom.at X-Spam-Level: Received: from mobiledyn-185-69-244-26.mrsn.at (HELO localhost.localdomain) ([185.69.244.26]) (envelope-sender ) by smarthub87.res.a1.net (qmail-ldap-1.03) with DHE-RSA-AES256-GCM-SHA384 encrypted SMTP; 5 Jun 2020 06:57:26 -0000 X-A1Mail-Track-Id: 1591340234:9787:smarthub87:185.69.244.26:1 Message-ID: <9b9017a4e3ca9aaadd2cf379ecf336e2296ad08a.camel@cybertec.at> Subject: Re: Multitenent architecture From: Laurenz Albe To: Vasu Madhineni , pgsql-general@postgresql.org In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Fri, 05 Jun 2020 08:57:09 +0200 User-Agent: Evolution 3.32.5 (3.32.5-1.fc30) Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, 2020-06-04 at 23:52 +0800, Vasu Madhineni wrote: > We are planning a POC on multitenant architecture in Postgres, Could you please > help us with steps for multitenant using schema for each application model. For few tenants, you can keep identical tables in several schemas and set "search_path" to select a tenant. With many tenants, you are better off with one table that holds the data for all clients. You can use Row Level Security to have each tenant see only his or her data, and it might be a good idea to use list partitioning on the tenant ID. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com