Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id A0E38B6048D for ; Wed, 1 Jun 2011 15:53:55 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 95617-02 for ; Wed, 1 Jun 2011 18:53:48 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from mail-pw0-f46.google.com (mail-pw0-f46.google.com [209.85.160.46]) by mail.postgresql.org (Postfix) with ESMTP id 5972CB5DC35 for ; Wed, 1 Jun 2011 15:53:48 -0300 (ADT) Received: by pwi15 with SMTP id 15so157085pwi.19 for ; Wed, 01 Jun 2011 11:53:47 -0700 (PDT) Received: by 10.68.1.165 with SMTP id 5mr3012344pbn.304.1306954427684; Wed, 01 Jun 2011 11:53:47 -0700 (PDT) Received: from [10.10.3.129] (71-6-94-66.static-ip.telepacific.net [71.6.94.66]) by mx.google.com with ESMTPS id p5sm1298088pbk.84.2011.06.01.11.53.46 (version=SSLv3 cipher=OTHER); Wed, 01 Jun 2011 11:53:46 -0700 (PDT) Subject: Re: Strange behavior of child table. From: Jeff Davis To: Jenish Cc: pgsql-performance@postgresql.org In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Date: Wed, 01 Jun 2011 11:53:42 -0700 Message-ID: <1306954422.4727.4.camel@jdavis-ux.asterdata.local> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Content-Transfer-Encoding: 8bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.9 tagged_above=-10 required=5 tests=BAYES_00=-1.9 X-Spam-Level: X-Archive-Number: 201106/4 X-Sequence-Number: 43937 On Tue, 2011-05-31 at 10:20 +0300, Jenish wrote: > Hi All, > > I have created partition on table Round_Action , which has 3 child > partition tables. > > > When I am firing a simple select query with limit on parent table it > is taking huge time to execute. But when I am firing this query > directly on child table it is taking few milliseconds. > > > EXP. > select * from Round_Action where action_id =50000 limit 100 → > execution time 80 sec > select * from Round_Action_CH1 action_id =50000 limit 100 → execution > time 0.1 sec > > Round_Action is the parent table and has no record in the tables, all > the records are lying in child tables. Run EXPLAIN ANALYZE on each of those queries, and post the results. See http://wiki.postgresql.org/wiki/SlowQueryQuestions for a guide on how to give the necessary information for others to help. Regards, Jeff Davis