Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VGlKg-0006hM-90 for pgsql-performance@arkaria.postgresql.org; Tue, 03 Sep 2013 07:47:26 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1VGlKf-000427-Om for pgsql-performance@arkaria.postgresql.org; Tue, 03 Sep 2013 07:47:25 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VGlKd-00041y-JG for pgsql-performance@postgresql.org; Tue, 03 Sep 2013 07:47:23 +0000 Received: from outmail148096.authsmtp.net ([62.13.148.96]) by makus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1VGlKa-0003Ft-9m for pgsql-performance@postgresql.org; Tue, 03 Sep 2013 07:47:22 +0000 Received: from mail-c235.authsmtp.com (mail-c235.authsmtp.com [62.13.128.235]) by punt9.authsmtp.com (8.14.2/8.14.2) with ESMTP id r837lHdQ013280; Tue, 3 Sep 2013 08:47:17 +0100 (BST) Received: from ayaki.localdomain (124-148-193-181.dyn.iinet.net.au [124.148.193.181]) (authenticated bits=0) by mail.authsmtp.com (8.14.2/8.14.2/) with ESMTP id r837l9jh075772 (version=TLSv1/SSLv3 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Tue, 3 Sep 2013 08:47:12 +0100 (BST) Message-ID: <522593FC.3010302@2ndquadrant.com> Date: Tue, 03 Sep 2013 15:47:08 +0800 From: Craig Ringer Organization: 2nd Quadrant User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: jesper@krogh.cc, "pgsql-performance@postgresql.org" Subject: Re: Slow query-plan generation (fast query) PG 9.2 References: In-Reply-To: X-Enigmail-Version: 1.5.2 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Server-Quench: 0be09f4d-146d-11e3-b802-002590a15da7 X-AuthReport-Spam: If SPAM / abuse - report it at: http://www.authsmtp.com/abuse X-AuthRoute: OCdxZQATClZeVg0b BQteCiNZVAwpPBRK HVkIKg5MJUcNSQVJ NksadBtFaAZbflxB HGQLWldEUFV7XWR/ agkfbAdZfEtKVxtr WUtXQ1pTCwdtAxke B1BcWhp1KwwcIH53 YEFlXD5YW0J4O0Yv F05dQ2lSeGZkbjQC UUENdB4GeANIYx9F aFV2VCIMZDFWYTQC El17DAgcBxt4EgFg CjoJKk1aWFsGBC95 XxQLG30gEEsIXSwv LhsgYh4SFV0Nelwv PEEwGBogHFdDTFc2 X-Authentic-SMTP: 61633235383639.1023:706 X-AuthFastPath: 0 (Was 255) X-AuthSMTP-Origin: 124.148.193.181/2525 X-AuthVirus-Status: No virus detected - but ensure you scan with your own anti-virus system. X-Pg-Spam-Score: -2.6 (--) 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 On 09/03/2013 03:46 PM, jesper@krogh.cc wrote: > Hi. > > I have a strange situation where generating the query plan takes 6s+ and > executing it takes very little time. How do you determine that it's planning time at fault here? Please take separate timing for: PREPARE testq AS select table.id from db.table left join db.tablepro on db.id = tablepro.table_id where table.fts @@ to_tsquery('english','q12345') ; and then: EXPLAIN ANALYZE EXECUTE testq; -- Craig Ringer http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-performance mailing list (pgsql-performance@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-performance