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 1jbnVi-0000s8-LG for pgsql-general@arkaria.postgresql.org; Thu, 21 May 2020 15:53:30 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jbnVg-00034v-08 for pgsql-general@arkaria.postgresql.org; Thu, 21 May 2020 15:53:28 +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 1jbnVf-00034i-NF for pgsql-general@lists.postgresql.org; Thu, 21 May 2020 15:53:27 +0000 Received: from bonobo.birch.relay.mailchannels.net ([23.83.209.22]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbnVX-0002pP-1e for pgsql-general@postgresql.org; Thu, 21 May 2020 15:53:26 +0000 X-Sender-Id: dreamhost|x-authsender|israel@brewstersoft.com Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 0938648149B; Thu, 21 May 2020 15:53:15 +0000 (UTC) Received: from pdx1-sub0-mail-a73.g.dreamhost.com (100-96-7-20.trex.outbound.svc.cluster.local [100.96.7.20]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id E501C481436; Thu, 21 May 2020 15:53:13 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|israel@brewstersoft.com Received: from pdx1-sub0-mail-a73.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.18.8); Thu, 21 May 2020 15:53:14 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|israel@brewstersoft.com X-MailChannels-Auth-Id: dreamhost X-Whistle-Spicy: 5d30a8aa4af4c52d_1590076394687_250215722 X-MC-Loop-Signature: 1590076394687:2001634957 X-MC-Ingress-Time: 1590076394687 Received: from pdx1-sub0-mail-a73.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a73.g.dreamhost.com (Postfix) with ESMTP id 9FE4A81B7C; Thu, 21 May 2020 08:53:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=brewstersoft.com; h=from :message-id:content-type:mime-version:subject:date:in-reply-to :cc:to:references; s=brewstersoft.com; bh=mMSQzmuDNFe9ZKQXsuhrRf bwHQw=; b=TLKC0CJTq417RXgH839KkYc/KtatPAiTHVhbyfdoqQmxjb1zDxXMh5 CLpm+qHK9tDxxXaGXhQIbBvw7JlVhGDyulMUjZvYNEg1b2Ld9ejz9w8zFn3Xj/wj /s7TfVUvkJnd/GM8177sA1OMeY09P0GxozqIy5NOCqCaFTIteOC7Y= Received: from [10.27.81.2] (71-80-178-69.gci.net [69.178.80.71]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: israel@brewstersoft.com) by pdx1-sub0-mail-a73.g.dreamhost.com (Postfix) with ESMTPSA id BD8E981B1B; Thu, 21 May 2020 08:53:12 -0700 (PDT) X-DH-BACKEND: pdx1-sub0-mail-a73 From: Israel Brewster Message-Id: <4F4DEDE2-7ABD-4652-99FE-70C435518AC3@brewstersoft.com> Content-Type: multipart/alternative; boundary="Apple-Mail=_7295987D-9A62-4786-901E-75C10E861A29" 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 07:53:11 -0800 In-Reply-To: Cc: pgsql-general@postgresql.org To: Adrian Klaver References: <29ACFF1C-FF57-4A36-B3B4-F92C817D3AE8@brewstersoft.com> X-Mailer: Apple Mail (2.3608.80.23.2.2) X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: -100 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgeduhedrudduuddgledtucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujfgurhephffktgggufffjgfvfhfosegrtdhmrehhtdejnecuhfhrohhmpefkshhrrggvlhcuuehrvgifshhtvghruceoihhsrhgrvghlsegsrhgvfihsthgvrhhsohhfthdrtghomheqnecuggftrfgrthhtvghrnhepveejkeetheekleevkeeiheetgfefheeuudelgffgvdejtdffveetgfetgeduueelnecuffhomhgrihhnpegsrhgvfihsthgvrhhsohhfthdrtghomhenucfkphepieelrddujeekrdektddrjedunecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmohguvgepshhmthhppdhhvghloheplgdutddrvdejrdekuddrvdgnpdhinhgvthepieelrddujeekrdektddrjedupdhrvghtuhhrnhdqphgrthhhpefkshhrrggvlhcuuehrvgifshhtvghruceoihhsrhgrvghlsegsrhgvfihsthgvrhhsohhfthdrtghomheqpdhmrghilhhfrhhomhepihhsrhgrvghlsegsrhgvfihsthgvrhhsohhfthdrtghomhdpnhhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlhesphhoshhtghhrvghsqhhlrdhorhhg List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --Apple-Mail=_7295987D-9A62-4786-901E-75C10E861A29 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=utf-8 > On May 21, 2020, at 7:36 AM, Adrian Klaver = wrote: >=20 > On 5/21/20 8:29 AM, Israel Brewster wrote: >> I=E2=80=99m working on my first cloud service, which will be backed = by a postgresql database. Currently I only have a single customer, but = of course I want to design with the possibility of multiple customers in = mind. In that vein, I=E2=80=99m wondering what is =E2=80=9Ctypical=E2=80=9D= in terms of designing the DB structure to make sure that one customer = doesn=E2=80=99t =E2=80=9Caccidentally" get data for another customer? At = the moment I am leaning towards giving each customer their own set of = tables, with a unique prefix for each. This would provide a =E2=80=9Chard=E2= =80=9D separation for the data,=20 > ^^^^^^^^^^^^ I think that is called a schema:) Ok. That=E2=80=99s probably an option. Although it looks from a cursory = perusal that for that to work, I would have to have separate DB users = with different permissions. Which would be fine, except that I don=E2=80=99= t have permissions to create users. > Or set up a separate database for each in the cluster. Same as above - no permissions. At the moment, I am running on Heroku, which gives me a postgresql = database, but not full control over the cluster. I may need to move to = something more robust, if having completely separate databases is the = best option. I was hoping to avoid SysAdmin stuff as much as possible, = and focus on the software side, but obviously some sys admin is = required. --- Israel Brewster BrewsterSoft Development http://www.brewstersoft.com Home of EZPunch and Lyrics Presenter >=20 >> but would also increase maintenance efforts, as if I needed to add a = field I would have to add it to every table. On the other hand, keeping = everything in the same set of tables would mean having to be VERY = careful with my SQL to make sure no customer could access another=E2=80=99= s data. >> How is this typically done? >> --- >> Israel Brewster >> BrewsterSoft Development >> http://www.brewstersoft.com >> Home of EZPunch and Lyrics Presenter >=20 >=20 > --=20 > Adrian Klaver > adrian.klaver@aklaver.com >=20 --Apple-Mail=_7295987D-9A62-4786-901E-75C10E861A29 Content-Transfer-Encoding: quoted-printable Content-Type: text/html; charset=utf-8
On = May 21, 2020, at 7:36 AM, Adrian Klaver <adrian.klaver@aklaver.com> wrote:

On = 5/21/20 8:29 AM, Israel Brewster wrote:
I=E2=80=99m working on my first cloud service, = which will be backed by a postgresql database. Currently I only have a = single customer, but of course I want to design with the possibility of = multiple customers in mind. In that vein, I=E2=80=99m wondering what is = =E2=80=9Ctypical=E2=80=9D in terms of designing the DB structure to make = sure that one customer doesn=E2=80=99t =E2=80=9Caccidentally" get data = for another customer? At the moment I am leaning towards giving each = customer their own set of tables, with a unique prefix for each. This = would provide a =E2=80=9Chard=E2=80=9D separation for the data,
^^^^^^^^^^^^ I think that is called a = schema:)

Ok. That=E2=80=99s probably an option. Although it = looks from a cursory perusal that for that to work, I would have to have = separate DB users with different permissions. Which would be fine, = except that I don=E2=80=99t have permissions to create = users.

Or set up a separate database for each in the = cluster.

Same as above - no permissions.

At the moment, I am running on Heroku, which gives = me a postgresql database, but not full control over the cluster. I may = need to move to something more robust, if having completely separate = databases is the best option. I was hoping to avoid SysAdmin stuff as = much as possible, and focus on the software side, but obviously some sys = admin is required.

---
Israel Brewster
BrewsterSoft Development
Home of = EZPunch and Lyrics Presenter


but would also increase = maintenance efforts, as if I needed to add a field I would have to add = it to every table. On the other hand, keeping everything in the same set = of tables would mean having to be VERY careful with my SQL to make sure = no customer could access another=E2=80=99s data.
How is = this typically done?
---
Israel Brewster
BrewsterSoft Development
http://www.brewstersoft.com <http://www.brewstersoft.com/>
Home of = EZPunch and Lyrics Presenter

--
Adrian Klaver
adrian.klaver@aklaver.com


= --Apple-Mail=_7295987D-9A62-4786-901E-75C10E861A29--