Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id 4E9B39FBBDE for ; Fri, 9 Mar 2007 11:48:44 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 51743-05 for ; Fri, 9 Mar 2007 11:48:34 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id EB64B9FBB1E for ; Fri, 9 Mar 2007 11:48:40 -0400 (AST) Received: (qmail 5576 invoked by uid 500); 9 Mar 2007 15:01:35 -0000 Date: Fri, 9 Mar 2007 09:01:35 -0600 From: Bruno Wolff III To: radhika@88thstreet.com Cc: pgsql-sql@postgresql.org Subject: Re: View Vs. Table Message-ID: <20070309150135.GB23704@wolff.to> Mail-Followup-To: Bruno Wolff III , radhika@88thstreet.com, pgsql-sql@postgresql.org References: <13619.63.118.86.10.1173191539.squirrel@www.88thstreet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <13619.63.118.86.10.1173191539.squirrel@www.88thstreet.com> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=0.109 tagged_above=0 required=5 tests=AWL, BAYES_50 X-Spam-Level: X-Archive-Number: 200703/111 X-Sequence-Number: 27749 On Tue, Mar 06, 2007 at 09:32:19 -0500, Radhika Sambamurti wrote: > > From the application's perspective the View is much better as data is > being stored in one place, reducing errors and also storage. > But from the db point of view, is there a bigger performace hit when I > query a view Vs a table or is there no difference. In postgres, views are essentially macros and there shouldn't be a big performance hit for using them over issuing the equivalent query. It sounds like what you might be asking is comparing views to storing data in denormallized tables (esentially materialized views). You generally don't want to go there unless you need to, to get acceptible performance. (And note that denormallizing data doesn't always get you better performance.)