Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dtwXu-0006cc-LC for pgsql-performance@arkaria.postgresql.org; Mon, 18 Sep 2017 13:57:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1dtwXu-0000tM-81 for pgsql-performance@arkaria.postgresql.org; Mon, 18 Sep 2017 13:57:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dtwW6-0002dl-Cj for pgsql-performance@postgresql.org; Mon, 18 Sep 2017 13:55:18 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dtwVy-0007EU-NU for pgsql-performance@postgresql.org; Mon, 18 Sep 2017 13:55:17 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id v8IDt84V009919; Mon, 18 Sep 2017 09:55:08 -0400 From: Tom Lane To: Rick Otten cc: "pgsql-performa." Subject: Re: max partitions behind a view? In-reply-to: References: Comments: In-reply-to Rick Otten message dated "Mon, 18 Sep 2017 07:25:14 -0400" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9917.1505742908.1@sss.pgh.pa.us> Date: Mon, 18 Sep 2017 09:55:08 -0400 Message-ID: <9918.1505742908@sss.pgh.pa.us> List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-performance Precedence: bulk Sender: pgsql-performance-owner@postgresql.org Rick Otten writes: > The challenge is that because of an exponential rate of data growth, I > might have to significantly increase the number of partitions I'm working > with - to several hundred at a minimum and potentially more than 1000... > This leads me to the question how many 'union all' statements can I have in > one view? I don't think there's a hard limit short of INT32_MAX or so, but I'd be worried about whether there are any O(N^2) algorithms that would start to be noticeable at the O(1000) level. > Should I create a hierarchy of views to gradually roll the data > up instead of putting them all in one top-level view? That would likely make things worse not better; the planner would flatten them anyway and would expend extra cycles doing so. You could perhaps stop the flattening with optimization fences (OFFSET 0) but I really doubt you want the side-effects of that. regards, tom lane -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance