X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (neptune.hub.org [200.46.204.2]) by svr1.postgresql.org (Postfix) with ESMTP id 52364D1D1C4 for ; Mon, 26 Jan 2004 15:19:45 +0000 (GMT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (neptune.hub.org [200.46.204.2]) (amavisd-new, port 10024) with ESMTP id 96357-09 for ; Mon, 26 Jan 2004 11:19:18 -0400 (AST) Received: from internet.potentialtech.com (h-66-167-251-6.PHLAPAFG.covad.net [66.167.251.6]) by svr1.postgresql.org (Postfix) with ESMTP id 3E2CDD1D1CD for ; Mon, 26 Jan 2004 11:19:14 -0400 (AST) Received: from potentialtech.com (pa-plum-cmts1e-68-68-113-33.pittpa.adelphia.net [68.68.113.33]) by internet.potentialtech.com (Postfix) with ESMTP id 0E14069A63 for ; Mon, 26 Jan 2004 10:19:18 -0500 (EST) Message-ID: <40152FF2.8000007@potentialtech.com> Date: Mon, 26 Jan 2004 10:19:14 -0500 From: Bill Moran User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:1.4) Gecko/20031005 X-Accept-Language: en-us, en MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: On the performance of views Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200401/268 X-Sequence-Number: 5442 I have an application that I'm porting from MSSQL to PostgreSQL. Part of this application consists of hundreds of stored procedures that I need to convert to Postgres functions ... or views? At first I was going to just convert all MSSQL procedures to Postgres functions. But now that I'm looking at it, a lot of them may be candidates for views. A lot of them take on the format of: SELECT a.cola, b.colb, c.colc FROM a JOIN b JOIN c WHERE a.prikey=$1 (this is slightly oversimplified, but as a generalization of hundreds of functions, it's pretty accurate) Now, I know this questions is pretty generalized, and I intend to test before actually commiting to a particular course of action, but I'm very early in the conversion and I'm curious as to whether people with more experience than I think that views will provide better performance than functions containing SQL statements like the above. The client is _very_ interested in performance (just like anyone who needs to market things these days ... apparently, if you admit that something might take a few seconds in your advertising, you're sunk) Any opinions are welcome. Also, if this is a relatively unknown thing, I'd be curious to know that as well, because then it would be worthwhile for me to record and publish my experience. -- Bill Moran Potential Technologies http://www.potentialtech.com