Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Yv4UZ-00039w-KN for pgsql-sql@arkaria.postgresql.org; Wed, 20 May 2015 13:57:03 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1Yv4UY-0006vf-VB for pgsql-sql@arkaria.postgresql.org; Wed, 20 May 2015 13:57:03 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1Yv4UY-0006vX-5s for pgsql-sql@postgresql.org; Wed, 20 May 2015 13:57:02 +0000 Received: from mail-pd0-f182.google.com ([209.85.192.182]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Yv4UU-0003uK-J7 for pgsql-sql@postgresql.org; Wed, 20 May 2015 13:57:00 +0000 Received: by pdbqa5 with SMTP id qa5so69887199pdb.0 for ; Wed, 20 May 2015 06:56:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:date:from:user-agent:mime-version:to :subject:references:in-reply-to:content-type :content-transfer-encoding; bh=fP4awp8vcPHRN64sf5W+f/IxcHWnU4hZsuvzPzhT+Hw=; b=lzFNasI99CX0urlyYCYh5hqnBF6UeUEXCSp7qC9sq02VC0chS26Rrrgx1UMYIXZ0tf zbYanBovuZlJbyDAnglyCjyt4NPPRUdBcqQCzq7kbOx2Ff7krb8/iZfK+ypjIWif3CzS h1U65CMjTSVPL+KD5ppoWSvU+SHJWmcDxYc3Pz5qH0IBVsawytcrHwSCe7csYCHX1LYQ maPWTmn++UhqMGkP2AKgpTFv6B1F6HmIbEmKKW74l8mAOBLtN8lAgXaoS3XWXNyq/k81 karUcNc1+Hwc1L+9RtI3/Ez+I/FvAD8BXisFhEn8GzIJi1Xqi99gy+4FzaW1C2shjWnB lT+g== X-Gm-Message-State: ALoCoQl/HWPjQMNAl/sSe8BjxLP/zeQHFU49GCp10NvIVJLiYCTDo25LBQ2ygWjqUyzctp6q2Nxx X-Received: by 10.68.136.42 with SMTP id px10mr64688882pbb.19.1432130216707; Wed, 20 May 2015 06:56:56 -0700 (PDT) Received: from [192.168.1.109] ([76.14.161.106]) by mx.google.com with ESMTPSA id nm9sm5384519pdb.26.2015.05.20.06.56.55 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 May 2015 06:56:55 -0700 (PDT) Message-ID: <555C92A6.5000503@jfcomputer.com> Date: Wed, 20 May 2015 06:56:54 -0700 From: john User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: pgsql-sql@postgresql.org Subject: Re: [GENERAL] Does PG support bulk operation in embedded C References: <8A634A74EF65401FBE09169A72984EBB@RaviLaptop>, <555BD1C6.4000301@commandprompt.com> <555BD72A.6070406@commandprompt.com> In-Reply-To: <555BD72A.6070406@commandprompt.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Pg-Spam-Score: -3.7 (---) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-sql Precedence: bulk Sender: pgsql-sql-owner@postgresql.org If I'm reading what IBM has on the SQLBulkOperations function correctly you have to know the size in advance - than does not sound like an advantage. Anyway, taking the function name 'bulk' into account - I think you want find the best way to to insert a large number of row/records. Review the 'copy' command to populate a database: http://www.postgresql.org/docs/9.1/static/populate.html - read carefully as it will increase performance in a dramatic way. update and delete - well even in DB2 you are still doing the same thing as Postgres - the only difference is it's handled without sending the command. Whatever, the overhead - it's very small. Johnf On 05/19/2015 05:36 PM, Joshua D. Drake wrote: > > On 05/19/2015 05:27 PM, Ravi Krishna wrote: >> Not sure whether I am understanding this. I checked embedded C and did >> not find any section which describes what I have asked, that is the >> ability to do multiple inserts, or updates or deletes in one sql call. >> For example, if my application does the following >> >> BEGIN TRANSACTION >> INSERT INTO TABLE_A >> UPDATE TABLE_B >> INSERT INTO TABLE_C >> COMMIT TRANSACTION > > Well PostgreSQL certainly supports the above. > >> >> DB2 provides to combine the three sql operations into an array and make >> a call to DB2 which executes the array (that is all 3 sqls as one single >> call). > > You can do this with inserts using multivalue. > > INSERT INTO TABLE_A VALUES (), (), (); > > I am not sure about UPDATE or DELETE, I know you can use WITH on > DELETE which gives you some flexibility. > > I don't think you will get a one to one comparison but you should be > able to get close. > > JD > > > > -- Sent via pgsql-sql mailing list (pgsql-sql@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-sql