Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 9E0B59FB4C3 for ; Tue, 13 Mar 2007 11:28:16 -0300 (ADT) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 98247-07 for ; Tue, 13 Mar 2007 11:27:50 -0300 (ADT) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from lists.commandprompt.com (host-254.commandprompt.net [207.173.203.254]) by postgresql.org (Postfix) with ESMTP id 917F39FB4BB for ; Tue, 13 Mar 2007 11:27:56 -0300 (ADT) Received: from perhan.alvh.no-ip.org (201-221-201-67.bk11-dsl.surnet.cl [201.221.201.67]) (authenticated bits=0) by lists.commandprompt.com (8.13.7/8.13.6) with ESMTP id l2DERkUo022455; Tue, 13 Mar 2007 07:27:47 -0700 Received: by perhan.alvh.no-ip.org (Postfix, from userid 1000) id 2457832A15; Tue, 13 Mar 2007 10:27:44 -0400 (CLT) Date: Tue, 13 Mar 2007 10:27:44 -0400 From: Alvaro Herrera To: "Ezequias R. da Rocha" Cc: pgsql-sql@postgresql.org Subject: Re: For loop Message-ID: <20070313142744.GA7548@alvh.no-ip.org> Mail-Followup-To: "Ezequias R. da Rocha" , pgsql-sql@postgresql.org References: <45F69D7C.4070304@fastcon.com.br> <45F6B4EB.A3DD.0030.0@indicator.be> <45F6A793.1090904@fastcon.com.br> <200703130644.20870.aklaver@comcast.net> <45F6AF3B.4080706@fastcon.com.br> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <45F6AF3B.4080706@fastcon.com.br> User-Agent: Mutt/1.5.13 (2006-08-11) X-Virus-Scanned: ClamAV version 0.88.5, clamav-milter version 0.88.5 on projects.commandprompt.com X-Virus-Status: Clean X-Greylist: Sender succeded SMTP AUTH authentication, not delayed by milter-greylist-1.6 (lists.commandprompt.com [192.168.2.159]); Tue, 13 Mar 2007 07:27:48 -0700 (PDT) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200703/167 X-Sequence-Number: 27805 Ezequias R. da Rocha wrote: > Thank you all. The function from Jonah solves my problem. > > Just a simple question: > > One million of inserctions in *28,8* seconds with this kind of data > (timestamp|character varring (50)) is a good performance ? > > I let my questions to DBAs from PostgreSQL. I don't know, but Jonah's function can be better written using pure SQL, which should be faster. Something like this: create table whatever (a text, b int); insert into whatever select 'My text from iteration ' || a, a * 2 from generate_series(1, 1000000) a; I don't claim this works as is, but you should get the hang of it. -- Alvaro Herrera http://www.CommandPrompt.com/ PostgreSQL Replication, Consulting, Custom Development, 24x7 support