On Thu, Oct 7, 2010 at 12:11 AM, Sander, Ingo (NSN - DE/Munich)
<ingo.sander@nsn.com> wrote:
> As written before I have rerun the test a) without compression and b)
> with enlarged BLOCK_SIZE. Result was the same.
Using libpqtypes (source code follows after sig), stock postgres,
stock table, I was not able to confirm your results. 4000 bytea
blocks, loops of 1000 I was able to send in about 600ms. 50000 byte
blocks I was able to send in around 2 seconds on workstation class
hardware -- maybe something else is going on?.
merlin
#include "libpq-fe.h"
#include "libpqtypes.h"
#define DATASZ 50000
int main()
{
int i;
PGbytea b;
char data[DATASZ];
PGconn *c = PQconnectdb("host=localhost dbname=postgres");
if(PQstatus(c) != CONNECTION_OK)
{
printf("bad connection");
return -1;
}
PQtypesRegister(c);
b.data = data;
b.len = DATASZ;
for(i=0; i<1000; i++)
{
PGresult *res = PQexecf(c, "insert into bytea_demo(index, part1)
values (%int4, %bytea)", i, &b);
if(!res)
{
printf("got %s\n", PQgeterror());
return -1;
}
PQclear(res);
}
PQfinish(c);
}