Received: from localhost (maia-4.hub.org [200.46.204.183]) by postgresql.org (Postfix) with ESMTP id 0C25C9FBB1E for ; Wed, 30 May 2007 14:31:03 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 58118-03 for ; Wed, 30 May 2007 14:30:58 -0300 (ADT) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.4 Received: from web52709.mail.re2.yahoo.com (web52709.mail.re2.yahoo.com [206.190.48.232]) by postgresql.org (Postfix) with SMTP id 349769FB7DB for ; Wed, 30 May 2007 14:30:57 -0300 (ADT) Received: (qmail 52115 invoked by uid 60001); 30 May 2007 17:30:56 -0000 DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Mailer:Date:From:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding:Message-ID; b=IwqgMqCR7LhhodZakDwNXKyo0yB1xtbFTefVKG9AN27IDHpRWBe8sNu2mHgYB9VYvSMqHZZkVR2q49kuMW65vRtX0zBUVs3eL+BNn1B13s5D8Vh2FacftZ7D3n3jU530Qun097mClIdxNmLuDrkrx2hcMGYme/eQHwDqrg7uksc=; X-YMail-OSG: FAhIyv4VM1nMDlQiTV1BdfzDRzHIil4P9UXv5AEc8cp_vLnE8GRyguTPudjCHJ.BGg-- Received: from [195.168.227.227] by web52709.mail.re2.yahoo.com via HTTP; Wed, 30 May 2007 10:30:56 PDT X-Mailer: YahooMailRC/651.23.1 YahooMailWebService/0.7.41.14 Date: Wed, 30 May 2007 10:30:56 -0700 (PDT) From: Trigve Siver Subject: Re: slow query execution To: =?iso-8859-1?Q?Rodrigo_De_Le=F3n?= , pgsql-sql@postgresql.org MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: quoted-printable Message-ID: <247379.39180.qm@web52709.mail.re2.yahoo.com> X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=2.862 tagged_above=0 required=5 tests=AWL=0.247, BAYES_20=-0.74, DNS_FROM_RFC_ABUSE=0.2, DNS_FROM_RFC_POST=1.708, DNS_FROM_RFC_WHOIS=1.447, UPPERCASE_25_50=0 X-Spam-Level: ** X-Archive-Number: 200705/196 X-Sequence-Number: 28476 Thanks a lot=0A=0ATrigve=0A=0A----- Original Message ----=0AFrom: Rodrigo D= e Le=F3n =0ATo: pgsql-sql@postgresql.org; Trigve Siver = =0ASent: Wednesday, May 30, 2007 7:28:47 PM=0ASubject: R= e: [SQL] slow query execution=0A=0AOn 5/30/07, Trigve Siver wrote:=0A> Can you point me to some sources=0A> or give me some exampl= es, please?=0A=0ACREATE OR REPLACE FUNCTION ROWNUM() RETURNS BIGINT AS=0A$$= =0A BEGIN=0A RETURN NEXTVAL('ROWNUM_SEQ');=0A EXCEPTION WHEN O= THERS THEN=0A CREATE TEMP SEQUENCE ROWNUM_SEQ;=0A RETURN NEXT= VAL('ROWNUM_SEQ');=0A END;=0A$$=0ALANGUAGE 'PLPGSQL';=0A=0ASELECT ROWNUM= (), S.X=0AFROM GENERATE_SERIES(5,1,-1) S(X);=0A=0ARemember to reset the seq= uence value if you use this more than once in=0Athe same session.=0A=0A=0A= =0A=0A=0A =0A________________________________________________________= ____________________________Take the Internet to Go: Yahoo!Go puts the Inte= rnet in your pocket: mail, news, photos & more. =0Ahttp://mobile.yahoo.com/= go?refer=3D1GNXIC