Received: from maia.hub.org (maia-3.hub.org [200.46.204.243]) by mail.postgresql.org (Postfix) with ESMTP id 48A7C1337B63 for ; Wed, 27 Oct 2010 13:12:39 -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 99024-07 for ; Wed, 27 Oct 2010 16:12:26 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from nm24.bullet.mail.ac4.yahoo.com (nm24.bullet.mail.ac4.yahoo.com [98.139.52.221]) by mail.postgresql.org (Postfix) with SMTP id 5CB49133798F for ; Wed, 27 Oct 2010 13:12:26 -0300 (ADT) Received: from [98.139.52.195] by nm24.bullet.mail.ac4.yahoo.com with NNFMP; 27 Oct 2010 16:12:25 -0000 Received: from [98.139.52.161] by tm8.bullet.mail.ac4.yahoo.com with NNFMP; 27 Oct 2010 16:12:25 -0000 Received: from [127.0.0.1] by omp1044.mail.ac4.yahoo.com with NNFMP; 27 Oct 2010 16:12:25 -0000 X-Yahoo-Newman-Property: ymail-3 X-Yahoo-Newman-Id: 762762.12643.bm@omp1044.mail.ac4.yahoo.com Received: (qmail 44605 invoked by uid 60001); 27 Oct 2010 16:12:25 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1288195945; bh=ehKRGrBAhaI73csX09tA2/G0+MR0CPt7RiWqQxlWH9E=; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=y9OV76+0UQUXpBKd+q4Rd9pqkjSlRu+CneeJZSbO4DenkcMuelRd8d6B4ZdL4mnWzyjs3yMBD5ueGtt2vx1tbkQatg18RqsZEpJJCCoItmBbxcP+YxolsgAGetqGVr93V5nlRVTUV4VGiqRb4yvSxVAmW+S1XzhKxhmTGmnMEE4= DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=Message-ID:X-YMail-OSG:Received:X-Mailer:References:Date:From:Subject:To:Cc:In-Reply-To:MIME-Version:Content-Type; b=Kws67uy54TMZFlQ58S9Jo+5cfHDfGSZ695jAKQ2k/uLMgdjCmFEyhYnlj4XPtpHmwzoF+7yOeq+HhdDNiG/6b+h5xq+jBkcnnTkNogYJufXXnjFAOlKiQ0AhK+lBbTsMtW9phr9DeT+oXZQVxbqNQ1yYyDdrJ3RgI7OCj9L5CWY=; Message-ID: <25247.43880.qm@web65408.mail.ac4.yahoo.com> X-YMail-OSG: iwNroCUVM1mpMGw32R.Hd9XKT5JTwvxz84cErSqvOi1sNMT pIYE- Received: from [27.60.175.214] by web65408.mail.ac4.yahoo.com via HTTP; Wed, 27 Oct 2010 09:12:24 PDT X-Mailer: YahooMailRC/504.5 YahooMailWebService/0.8.107.284920 References: <132275.30531.qm@web65411.mail.ac4.yahoo.com> Date: Wed, 27 Oct 2010 09:12:24 -0700 (PDT) From: Divakar Singh Subject: Re: Postgres insert performance and storage requirement compared to Oracle To: David Wilson Cc: Steve Singer , jd@commandprompt.com, pgsql-performance@postgresql.org In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="0-573496202-1288195944=:43880" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.909 tagged_above=-10 required=5 tests=BAYES_00=-1.9, HTML_MESSAGE=0.001, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201010/478 X-Sequence-Number: 40896 --0-573496202-1288195944=:43880 Content-Type: text/plain; charset=us-ascii > for (; i { > > sprintf (query, "INSERT INTO aaaa(a, b, c, d, e, f, g, h, j, k, l, m, n, p) >VALUES (67, 'ABRAKADABRA', 'ABRAKADABRA', 'ABRAKADABRA', '1-Dec-2010', >'ABRAKADABRA', 'ABRAKADABRA', 'ABRAKADABRA', '1-Dec-2010', 99999, 99999, %d, >9999, >'ABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRA')", > i); > > res = PQexec(conn, query); > > if (PQresultStatus(res) != PGRES_COMMAND_OK) > { > cout<<"error at iteration "< PQclear(res); > break; > } > //PQclear(res); > > > } > >Why is that PQclear(res) commented out? You're leaking result status for every >insert. I did that purposely to see if cleanup part is contributing to any performance loss. Right now in my test, memory leak is not a concern for me but performance is. Though I understand that memory leak can also result in performance loss if leak is too much. However, in this case, commenting or uncommenting this statement did not cause any change in performance. --0-573496202-1288195944=:43880 Content-Type: text/html; charset=us-ascii




    for (; i<howmany;i++ )
    {

    sprintf (query, "INSERT INTO aaaa(a, b, c, d, e, f, g, h, j, k, l, m, n, p) VALUES (67, 'ABRAKADABRA', 'ABRAKADABRA', 'ABRAKADABRA', '1-Dec-2010', 'ABRAKADABRA', 'ABRAKADABRA',  'ABRAKADABRA', '1-Dec-2010', 99999, 99999, %d, 9999, 'ABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRAABRAKADABRA')", i);

    res = PQexec(conn, query);

      if (PQresultStatus(res) != PGRES_COMMAND_OK)
        {
          cout<<"error at iteration "<<i<<":"<<PQresultErrorMessage(res)<<endl;
                  PQclear(res);
          break;
        }
        //PQclear(res);


    }

>Why is that PQclear(res) commented out? You're leaking result status for every insert.


I did that purposely to see if cleanup part is contributing to any performance loss.
Right now in my test, memory leak is not a concern for me but performance is.
Though I understand that memory leak can also result in performance loss if leak is too much.
However, in this case, commenting or uncommenting this statement did not cause any change in performance.
 




--0-573496202-1288195944=:43880--