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 1jbnFQ-0000R7-7a for pgsql-general@arkaria.postgresql.org; Thu, 21 May 2020 15:36:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jbnFO-0004h1-LA for pgsql-general@arkaria.postgresql.org; Thu, 21 May 2020 15:36:38 +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 1jbnFO-0004gu-DA for pgsql-general@lists.postgresql.org; Thu, 21 May 2020 15:36:38 +0000 Received: from wout2-smtp.messagingengine.com ([64.147.123.25]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jbnFG-0002a2-4A for pgsql-general@postgresql.org; Thu, 21 May 2020 15:36:37 +0000 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 4CDF0ECB; Thu, 21 May 2020 11:36:26 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 21 May 2020 11:36:26 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= subject:to:references:from:message-id:date:mime-version :in-reply-to:content-type:content-transfer-encoding; s=fm3; bh=c TDW3s2z+44eYOYM7pjevWZwXVyLe8uboy2LSKO/LDM=; b=ff7OKI8/eUl3KSYfL BxcD5I2gNiN+7+rBTzJomr3GEzD/mKAiorALHfeuYxHhXm3ETs8dDPzFsPGKuJlp a0UkzYADy3PA+uZyFpXz5K/Ph+g9rHAGA6M91nmuxxcLOgp/HROZYef5rmVMXd/n 6L8b2jLSA+guNy4p1tOOARXZnR7KXhTo5PaqwzsIu+B8fXQPm+j14MiSAKLJtNH3 zDFw+F7mNO2rc/0ipTEDNYDI68QM9fbcF0KBU9za5olQrXqq//xh2due183/OYcs EtP+fg59rAgBSaGh/yK4qXLpLb5KbV8U8AUHW+wxBUQF34qEpUl4X4YRsvhWTg8B 56jbg== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=cTDW3s2z+44eYOYM7pjevWZwXVyLe8uboy2LSKO/L DM=; b=lV4Hgd8avOpGvnptZjR2MZ6h5jLpXOLxIhxqnU+F2lSWF8MLq86vMqShy MjxpKbQSprbYcDuW0MOalABO+o4w4fbsuKoXL8eNNYzM0pMlf4Bn8EsPO+5GRbVe KijtBKAGbldK0Slz0+moRqFxppW7StjPXZrClpx6YN9OVEY2+IBUgma+mB1WX3nl DxVSuyPNj/qyi936Wd2j1yI2UwGWgaVQXfzSYrtXFhP9SXEz8I+Lgqd06/nhN5ts Bp9sMIU1cc2SqKx8uz0sJxYMOidFalNSfH8MjbzaGrz8NBgWMObIx5p70xd8o4hT DDwlS12PQKkaymfWT+IkSnDZaGldw== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrudduuddgkeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepuffvfhfhkffffgggjggtgfesthekredttdefjeenucfhrhhomheptegurhhi rghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtoh hmqeenucggtffrrghtthgvrhhnpeevfeffgedvudeuteduieegfeegfeekkefftdekteev keehgedtteevheetieelhfenucffohhmrghinhepsghrvgifshhtvghrshhofhhtrdgtoh hmnecukfhppeejhedrudejvddrhedrvdefudenucevlhhushhtvghrufhiiigvpedtnecu rfgrrhgrmhepmhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvg hrrdgtohhm X-ME-Proxy: Received: from [192.168.1.3] (75-172-5-231.tukw.qwest.net [75.172.5.231]) by mail.messagingengine.com (Postfix) with ESMTPA id 264C33066493; Thu, 21 May 2020 11:36:25 -0400 (EDT) Subject: Re: Table partitioning for cloud service? To: Israel Brewster , pgsql-general@postgresql.org References: <29ACFF1C-FF57-4A36-B3B4-F92C817D3AE8@brewstersoft.com> From: Adrian Klaver Message-ID: Date: Thu, 21 May 2020 08:36:24 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.8.0 MIME-Version: 1.0 In-Reply-To: <29ACFF1C-FF57-4A36-B3B4-F92C817D3AE8@brewstersoft.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 5/21/20 8:29 AM, Israel Brewster wrote: > I’m 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’m wondering what is “typical” in terms of > designing the DB structure to make sure that one customer doesn’t > “accidentally" 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 “hard” separation for the data, ^^^^^^^^^^^^ I think that is called a schema:) Or set up a separate database for each in the cluster. > 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’s data. > > How is this typically done? > > --- > Israel Brewster > BrewsterSoft Development > http://www.brewstersoft.com > Home of EZPunch and Lyrics Presenter > > > -- Adrian Klaver adrian.klaver@aklaver.com