Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1XAUhS-0000tH-5R for pgsql-performance@arkaria.postgresql.org; Fri, 25 Jul 2014 01:53:34 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1XAUhR-000485-HH for pgsql-performance@arkaria.postgresql.org; Fri, 25 Jul 2014 01:53:33 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XAUhQ-00047x-CE for pgsql-performance@postgresql.org; Fri, 25 Jul 2014 01:53:32 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1XAUhJ-00010T-A5 for pgsql-performance@postgresql.org; Fri, 25 Jul 2014 01:53:30 +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 s6P1rNl0025011; Thu, 24 Jul 2014 21:53:23 -0400 From: Tom Lane To: Rural Hunter cc: pgsql-performance@postgresql.org Subject: Re: Very slow planning performance on partition table In-reply-to: <53CFB6BC.4050606@gmail.com> References: <53CFB6BC.4050606@gmail.com> Comments: In-reply-to Rural Hunter message dated "Wed, 23 Jul 2014 21:21:00 +0800" Date: Thu, 24 Jul 2014 21:53:23 -0400 Message-ID: <25010.1406253203@sss.pgh.pa.us> X-Pg-Spam-Score: -1.9 (-) 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 Rural Hunter writes: > I have a table partitioned with about 60 children tables. Now I found > the planning time of simple query with partition key are very slow. > ... > You can see the timing output that the actual run time of the 'explain > analyze' is 30 seconds while the select sql itself takes only 3 ms. My > partition key is on article.pid and the constraint is simple like this: > CONSTRAINT article_88_pid_check CHECK (pid = 88). What's wrong and how > can I improve the planning performance? [ shrug... ] Insufficient data. When I try a simple test case based on what you've told us, I get planning times of a couple of milliseconds. I can think of contributing factors that would increase that, but not by four orders of magnitude. So there's something very significant that you've left out. Can you construct a self-contained test case that's this slow? 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