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 1jbt4q-00030w-Hn for pgsql-general@arkaria.postgresql.org; Thu, 21 May 2020 21:50:08 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jbt4p-0000iu-5Q for pgsql-general@arkaria.postgresql.org; Thu, 21 May 2020 21:50:07 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbt4o-0000in-FA for pgsql-general@lists.postgresql.org; Thu, 21 May 2020 21:50:06 +0000 Received: from resqmta-ch2-03v.sys.comcast.net ([2001:558:fe21:29:69:252:207:35]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbt4l-00044J-U5 for pgsql-general@postgresql.org; Thu, 21 May 2020 21:50:05 +0000 Received: from resomta-ch2-18v.sys.comcast.net ([69.252.207.114]) by resqmta-ch2-03v.sys.comcast.net with ESMTP id bt1ZjOTOQhufYbt4jj1Q9d; Thu, 21 May 2020 21:50:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcast.net; s=20190202a; t=1590097801; bh=wU2MxVJz4M+a25ktWKcUSDl7uvBCaeeUtcBz1iebwXM=; h=Received:Received:From:Content-Type:Mime-Version:Subject:Date: Message-Id; b=t2lY2aExNyFG2Ax1vwuxOA/NqJJ2ip5UYXwlYRHnzrM/9ZQtY5CvXRS1KAtwlO6Nx JqVxIW5OaAGfvDI3pd+ny/TTJYJvFxgQdjZ/H2Uw/dbWY1cyLrE+AFosX8KEiwMwDv MMt/wE3SqlBFdzBW1LbiJdJ4ercxnIElSIzMKlzoKUQDrxyOG8P60LaobC0zIp/p8m BSE9uhCIIkbr+QNf36GLMTkgfR/qOo5uyzpH5kefPrRJirwu0Ure/BE91byBVu66e9 m86oFIcZZwd1vqxTO8urU0IIygNlm6VuijT+54dtHbflDbW/B8lQ3T+Ak5Gd04+1xs 7Sb+vgCYwSgFg== Received: from [192.168.0.67] ([69.248.135.247]) by resomta-ch2-18v.sys.comcast.net with ESMTPA id bt4MjcryORmvDbt4ijAnCz; Thu, 21 May 2020 21:50:01 +0000 X-Xfinity-VAAS: gggruggvucftvghtrhhoucdtuddrgeduhedrudduvddgtdduucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuvehomhgtrghsthdqtfgvshhipdfqfgfvpdfpqffurfetoffkrfenuceurghilhhouhhtmecufedttdenuchmihhsshhinhhgucfvqfcufhhivghlugculdeftddmnecujfgurhephfgtgfggufffjghfkffosehtqhhmtdhhtddvnecuhfhrohhmpeftrghvihcumfhrihhshhhnrgcuoehsrhhkrhhishhhnhgrudestghomhgtrghsthdrnhgvtheqnecuggftrfgrthhtvghrnhepudevfedtuddvgeduuefgvdehkeejvdfhudfhudfhvdekgeefudeghfehhefhteehnecukfhppeeiledrvdegkedrudefhedrvdegjeenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhephhgvlhhopegludelvddrudeikedrtddrieejngdpihhnvghtpeeiledrvdegkedrudefhedrvdegjedpmhgrihhlfhhrohhmpehsrhhkrhhishhhnhgrudestghomhgtrghsthdrnhgvthdprhgtphhtthhopehpghhsqhhlqdhgvghnvghrrghlsehpohhsthhgrhgvshhqlhdrohhrgh X-Xfinity-VMeta: sc=30.00;st=legit From: Ravi Krishna Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.80.23.2.2\)) Subject: Re: Table partitioning for cloud service? Date: Thu, 21 May 2020 17:49:37 -0400 In-Reply-To: Cc: PostgreSQL Mailing Lists References: <29ACFF1C-FF57-4A36-B3B4-F92C817D3AE8@brewstersoft.com> <4F4DEDE2-7ABD-4652-99FE-70C435518AC3@brewstersoft.com> Message-Id: X-Mailer: Apple Mail (2.3608.80.23.2.2) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk >=20 > The database/schema per tenant solution can be tedious when you want = to modify something on the structure and you have numerous tenants. > Therefore I used the "tables with tenant_id" version in a similar = situation but with a slight twist. One of the biggest issue of this = solution is that if you forget to add the tenant_id to the where clause = you are going to reveal one tenant's data to another. > I came up with the solution that the database user have no privileges = for accessing the base tables. Instead of that I generate views for each = tenant and they can access their own data in the underlying table = through these views. Now if forget to address the right tenant in my = client code(it still happens sometimes) and try to directly access the = base tables I get a strongly worded reminder from the server. 1. If you have 50 tables and say 100 tenants, we are talking about 5,000 = views. I am not sure=20 whether it is any more elegant than having 100 schemas. 2. In your approach you can do any phased DDL upgrade. It is typical to = do rolling upgrades in a multi tenant databases, starting with least risky tenant.