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 1n9ee2-0002FS-BP for pgsql-admin@arkaria.postgresql.org; Tue, 18 Jan 2022 02:54:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1n9ee1-0002N7-8S for pgsql-admin@arkaria.postgresql.org; Tue, 18 Jan 2022 02:54:49 +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 1n9ee0-0002Mw-Ju for pgsql-admin@lists.postgresql.org; Tue, 18 Jan 2022 02:54:48 +0000 Received: from admin.sibptus.ru ([2001:19f0:5001:21dc::10]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1n9edx-0005b7-Pe for pgsql-admin@lists.postgresql.org; Tue, 18 Jan 2022 02:54:47 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sibptus.ru; s=20181118; h=In-Reply-To:Message-ID:Subject:To:From:Date; bh=bJvGsyBESTRZ5gyhBA4XfRkHgtMXmS4lLTuNPn1UrA4=; b=PO4ongSuDIVU8Mipho8zsc2M8W pRc4Z9AZ/10vZ/RJp6yZUf9kHTFeJEWhgJinwTOcNc+65zdzBHiT0yabQQcD4faf+mBXI+T2M8NJO 0xDHZ7eBP0FjzwrFwoPZWfRP3v9OjW1z2i66O6eJC5Q84612P0mz4Zt2aO1/TDbCwfFw=; Received: from vas by admin.sibptus.ru with local (Exim 4.95 (FreeBSD)) (envelope-from ) id 1n9edv-000AA7-Mx; Tue, 18 Jan 2022 02:54:43 +0000 Date: Tue, 18 Jan 2022 02:54:43 +0000 From: Victor Sudakov To: pgsql-admin@lists.postgresql.org Cc: Ron Subject: Re: Large number of partitions of a table Message-ID: References: <3919502.1642393668@sss.pgh.pa.us> <671340a5-1960-e5dc-1d09-4b7f36cda2c8@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <671340a5-1960-e5dc-1d09-4b7f36cda2c8@gmail.com> X-PGP-Key: http://admin.sibptus.ru/~vas/ X-PGP-Fingerprint: 10E3 1171 1273 E007 C2E9 3532 0DA4 F259 9B5E C634 List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Ron wrote: > On 1/16/22 11:38 PM, Victor Sudakov wrote: > > Tom Lane wrote: > > [dd] > > > >> The specific point that depesz was responding to in that blog > >> was the 64K-ish limit on rangetable entries in a query. That is > >> a thing, as he could have shown by using queries that weren't > >> amenable to plan-time pruning. (It's also an ex-thing, having > >> been fixed for v15 [1]; but that doesn't help you today.) > >> Now, if you use no queries that can't be pruned to a few > >> partitions, then it's academic for you. > > The table will be partitioned `BY LIST (customer_id)` which is a unique > > index. All queries will be using this index > > Good. > > > so no query should ever have to use more than 1 partition. > > I find it hard to believe that you'll *never* run a report against more > customers than are in a single partition. Thank you for raising this question, it can be of great interest. What's the worst thing to happen if someone runs "SELECT COUNT(*) FROM t" where t has 10000 partitions? 1. The backend will crash? 2. The whole cluster will crash? 3. Only this particular query (spanning multiple partitions) will be very slow? 4. ? Also, what if it is not a SELECT but an UPDATE query spanning multiple partitions? Does it make any difference? -- Victor Sudakov VAS4-RIPE http://vas.tomsk.ru/ 2:5005/49@fidonet