Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 2E8E49FBC25 for ; Thu, 29 Mar 2007 12:26:42 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-maia, port 10024) with ESMTP id 17211-10 for ; Thu, 29 Mar 2007 12:26:27 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from rootabega.88thstreet.com (dsl254-071-237.nyc1.dsl.speakeasy.net [216.254.71.237]) by postgresql.org (Postfix) with ESMTP id D28609FBC15 for ; Thu, 29 Mar 2007 12:26:27 -0300 (ADT) Received: from www.88thstreet.com (localhost [IPv6:::1]) by rootabega.88thstreet.com (8.13.3/8.13.3) with ESMTP id l2TFQNC7018500 for ; Thu, 29 Mar 2007 11:26:25 -0400 (EDT) Received: from 63.118.86.10 (SquirrelMail authenticated user radhika) by www.88thstreet.com with HTTP; Thu, 29 Mar 2007 11:26:25 -0400 (EDT) Message-ID: <60666.63.118.86.10.1175181985.squirrel@www.88thstreet.com> Date: Thu, 29 Mar 2007 11:26:25 -0400 (EDT) Subject: Temp tbl Vs. View From: "Radhika Sambamurti" To: pgsql-sql@postgresql.org Reply-To: radhika@88thstreet.com User-Agent: SquirrelMail/1.4.5 MIME-Version: 1.0 Content-Type: text/plain;charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Priority: 3 (Normal) Importance: Normal X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.136 tagged_above=0 required=5 tests=BAYES_50=0.001, FORGED_RCVD_HELO=0.135 X-Spam-Level: X-Archive-Number: 200703/346 X-Sequence-Number: 27984 Hello, I have an interesing problem relating to sql and performance issues and am looking at ways I can increase the performace from postgres. Currently I have a view created from two tables. All the selects are being done on the view - which normally does not take a lot of time, but because my web app uses filtering on such as symbol ~ '^.*$', side, date etc, the select from the view is taking a lot of time (7000 ms) as per explain analyze. Both the primary and secondary tables have about 400,000 rows. I noticed that it is doing a sequential scan on the primary table which is joined to the secondary table in the view query. I just read when I use filters that postgres will do a seq scan on the table. My question is how can I fix this? Would it be better to create a temporary table for just daily data and have the view for more extended queries? Any other design ideas? Thanks, Radhika -- It is all a matter of perspective. You choose your view by choosing where to stand. Larry Wall ---