Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f683nga54551 for ; Sat, 7 Jul 2001 23:49:42 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f683nbJ05835; Sat, 7 Jul 2001 23:49:37 -0400 (EDT) To: "Josh Berkus" cc: pgsql-sql@postgresql.org Subject: Re: creating variable views In-reply-to: References: Comments: In-reply-to "Josh Berkus" message dated "Sat, 07 Jul 2001 16:12:49 -0700" Date: Sat, 07 Jul 2001 23:49:36 -0400 Message-ID: <5832.994564176@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200107/89 X-Sequence-Number: 3873 "Josh Berkus" writes: >> I don't understand the distinction you're trying to make here. In >> general, a view column that is implemented as a function will give >> the >> optimizer headaches if you refer to it in WHERE --- the simplicity or >> complexity of the function has got nothing to do with that AFAICS. > OK. I thought that I noticed a difference between simple SQL functions > and PL/pgSQL functions in this respect, but I could easily be mistaken. AFAIR, the optimizer doesn't pay any attention at all to the implementation language of a function. The only thing that comes to mind here is that some care has been taken to mark all the built-in functions as "iscachable" (or not, as appropriate); but user-created functions may not be so marked when they should be, leading to loss of performance in some cases. regards, tom lane