Received: from localhost (unknown [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 859AB65003C for ; Thu, 10 Jul 2008 13:21:56 -0300 (ADT) Received: from postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 41263-07 for ; Thu, 10 Jul 2008 13:21:51 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 25F2F64FD42 for ; Thu, 10 Jul 2008 13:21:52 -0300 (ADT) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.2/8.14.2) with ESMTP id m6AGLixc009896; Thu, 10 Jul 2008 12:21:44 -0400 (EDT) To: s.borse@direction.biz, "Julius Tuskenis" , pgsql-admin@postgresql.org Subject: Re: query optimization In-reply-to: References: <1215680493.2113.26.camel@dss-052.dsslp.com> <4875D589.1030107@nsoft.lt> <1215683144.2113.35.camel@dss-052.dsslp.com> Comments: In-reply-to "Scott Marlowe" message dated "Thu, 10 Jul 2008 09:47:29 -0600" Date: Thu, 10 Jul 2008 12:21:44 -0400 Message-ID: <9895.1215706904@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200807/106 X-Sequence-Number: 29716 On Thu, Jul 10, 2008 at 3:45 AM, Suresh Borse wrote: >> The view executes very faster for the first time. >> When I execute the view again and again suddenly it gets slow or it gets >> hang. >> The view contains multi-table joins. Uh, how many joins? If you're exceeding geqo_threshold then you would get plans with a random component to them. You might want to increase the threshold, although planning time would probably go up. Also, what PG version is this? regards, tom lane