Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id D19AA133616B for ; Mon, 25 Oct 2010 15:46:57 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.243]) (amavisd-maia, port 10024) with ESMTP id 40042-01 for ; Mon, 25 Oct 2010 18:46:50 +0000 (UTC) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from outbound.afilias.info (outbound.afilias.info [69.46.124.26]) by mail.postgresql.org (Postfix) with ESMTP id C8BC91337B4B for ; Mon, 25 Oct 2010 15:46:49 -0300 (ADT) Received: from ms6.yyz2.afilias-ops.info ([10.50.129.112] helo=smtp.afilias.info) by outbound.afilias.info with esmtp (Exim 4.69) (envelope-from ) id 1PAS4F-0007kO-5B; Mon, 25 Oct 2010 18:46:47 +0000 Received: from tor-gateway.afilias.info ([199.15.87.4] helo=[10.10.46.23]) by smtp.afilias.info with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.69) (envelope-from ) id 1PAS4F-0006YI-7y; Mon, 25 Oct 2010 18:46:47 +0000 Message-ID: <4CC5D096.5030406@ca.afilias.info> Date: Mon, 25 Oct 2010 14:46:46 -0400 From: Steve Singer User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.12) Gecko/20100915 Thunderbird/3.0.8 MIME-Version: 1.0 To: Divakar Singh CC: jd@commandprompt.com, pgsql-performance@postgresql.org Subject: Re: Postgres insert performance and storage requirement compared to Oracle References: <402913.53404.qm@web65405.mail.ac4.yahoo.com> <1288030833.8930.30.camel@jd-desktop> <772167.16310.qm@web65409.mail.ac4.yahoo.com> In-Reply-To: <772167.16310.qm@web65409.mail.ac4.yahoo.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-4.21 tagged_above=-10 required=5 tests=BAYES_00=-1.9, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/404 X-Sequence-Number: 40822 On 10-10-25 02:31 PM, Divakar Singh wrote: > > > My questions/scenarios are: > > > > 1. How does PostgreSQL perform when inserting data into an indexed > > (type: btree) > > table? Is it true that as you add the indexes on a table, the > > performance > > deteriorates significantly whereas Oracle does not show that much > > performance > > decrease. I have tried almost all postgreSQL performance tips > > available. I want > > to have very good "insert" performance (with indexes), "select" > > performance is > > not that important at this point of time. > > -- Did you test? > > Yes. the performance was comparable when using SQL procedure. However, > When I used libpq, PostgreSQL performed very bad. There was some > difference in environment also between these 2 tests, but I am assuming > libpq vs SQL was the real cause. Or it was something else? So your saying that when you load the data with psql it loads fine, but when you load it using libpq it takes much longer? How are you using libpq? -Are you opening and closing the database connection between each insert? -Are you doing all of your inserts as one big transaction or are you doing a transaction per insert -Are you using prepared statements for your inserts? -Are you using the COPY command to load your data or the INSERT command? -Are you running your libpq program on the same server as postgresql? -How is your libpq program connecting to postgresql, is it using ssl? > > Some 10-12 columns ( like 2 timestamp, 4 int and 4 varchar), with 5 > indexes on varchar and int fields including 1 implicit index coz of PK. If your run "VACUUM VERBOSE tablename" on the table, what does it say? You also don't mention which version of postgresql your using. > > > Joshua D. Drake > > > -- > PostgreSQL.org Major Contributor > Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579 > Consulting, Training, Support, Custom Development, Engineering > http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt > >