X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 0C665D6800 for ; Wed, 2 Nov 2005 11:34:52 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97352-02 for ; Wed, 2 Nov 2005 15:34:46 +0000 (GMT) Received: from mail.clickdiario.com (mail.clickdiario.com [70.85.167.114]) by svr1.postgresql.org (Postfix) with ESMTP id 92A95D680E for ; Wed, 2 Nov 2005 11:34:48 -0400 (AST) Received: from localhost (localhost [127.0.0.1]) by mail.clickdiario.com (Postfix) with ESMTP id B515610009 for ; Wed, 2 Nov 2005 09:41:10 -0600 (CST) Received: from mail.clickdiario.com ([127.0.0.1]) by localhost (mail.clickdiario.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 01342-07 for ; Wed, 2 Nov 2005 09:41:10 -0600 (CST) Received: by mail.clickdiario.com (Postfix, from userid 5001) id 9DECE1000C; Wed, 2 Nov 2005 09:41:10 -0600 (CST) Received: from cristian1 (unknown [216.230.158.50]) by mail.clickdiario.com (Postfix) with ESMTP id 01F9510009 for ; Wed, 2 Nov 2005 09:41:09 -0600 (CST) From: "Cristian Prieto" To: Subject: Performance difference between sql and pgsql function... Date: Wed, 2 Nov 2005 09:32:19 -0600 Message-ID: <007401c5dfc2$9d2c41e0$6500a8c0@gt.ClickDiario.local> MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable X-Mailer: Microsoft Office Outlook 11 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.2180 Thread-Index: AcXfwpw0gKVGX6nfQS+raXrBjfMWuw== X-Virus-Scanned: by amavisd-new-20030616-p10 (Debian) at example.com X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.047 required=5 tests=[AWL=0.047] X-Spam-Score: 0.047 X-Spam-Level: X-Archive-Number: 200511/32 X-Sequence-Number: 15289 There any performance differences between a SQL function written in SQL language or PL/psSQL language? For example: Create or replace function sp_getfreq( Var1 integer ) returns Boolean as $$ Declare Myval Boolean; Begin Select var1 in (select var3 from table1) into myval; Return myval; End; $$ Language =91plpgsql=92 stable;=A0 And with: Create or replace function sp_getfreq( Var1 integer ) returns boolean as $$ Select $1 in (select var3 from table1); $$ Language =91sql=92 stable; I know the function is really simple, but in theory which of the three = would run faster?