From: wespvp@syntegra.com
To: Michael Meskes <meskes@postgresql.org>
Cc: pgsql-interfaces@postgresql.org
Subject: Re: ECPG multiple INSERTS or SELECTS in one command?
Date: Fri, 21 May 2004 09:38:17 -0500
Message-ID: <BCD37E89.D866%wespvp@syntegra.com> (raw)
In-Reply-To: <20040521135618.GD14285@1>
>> A (different) Pro*C program I recently ported from Oracle to PostgreSQL
>> showed this difference. In Pro*C you can load an array with rows to insert,
>> then issue a single INSERT request passing it the array. I believe the same
>> thing applies to FETCH. As far as I can tell, in PostgreSQL ecpg (or other)
>> you have to execute one request per record. The program SEGV'd all over the
>> place when I tried to use the Pro*C array code. I had to do a major rework
>> of the code to remove the array logic.
>
> That is for insert right?
Yes, correct.
> Batching inserts is tricky as there is no way
> for ecpg to see if your array of 10 ints shall be inserted as 10 ints or
> as one array.
Perhaps there is some way a flag could be passed as part of the SQL
statement to ecpg to differentiate this? I suspect (but have no easy way of
proving) the lack of this feature may be why there is a 2:1 difference
between loading the same table with Oracle Pro*C and PostgreSQL (Oracle is
twice as fast). With Oracle, I populate an array and do a batch load. With
PostgreSQL, I have to load a row at a time.
> With fetch on the other hand it should work the same as with Pro*C.
> There is no problem to fetch into an array.
Someone on the Interfaces list sent me some sample code. I had made the
rash assumption that since I had to convert all the Pro*C array (INSERT)
code to non-array, that array usage wasn't supported at all by ecpg.
Wes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: wespvp@syntegra.com, meskes@postgresql.org
Subject: Re: ECPG multiple INSERTS or SELECTS in one command?
In-Reply-To: <BCD37E89.D866%wespvp@syntegra.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox