Thread: Bulk updates/inserts
Is it currently possible to perform bulk updates/inserts via host arrays using ecpg? If so, would someone mind showing me an example of the proper syntax as I can't seem to come up with something that the ecpg preprocessor likes. On a side note, if ecpg doesn't support bulk inserts/updates are there any plans for adding such support? Is there anyway programmatically to get close to the same speed for inserts/updates as say the COPY command? Regards, Shelby Cain __________________________________ Do you Yahoo!? Yahoo! Small Business $15K Web Design Giveaway http://promotions.yahoo.com/design_giveaway/
> > Is it currently possible to perform bulk > updates/inserts via host arrays using ecpg? If so, > would someone mind showing me an example of the proper > syntax as I can't seem to come up with something that > the ecpg preprocessor likes. > > On a side note, if ecpg doesn't support bulk > inserts/updates are there any plans for adding such > support? Is there anyway programmatically to get > close to the same speed for inserts/updates as say the > COPY command? > > Regards, > > Shelby Cain > > __________________________________ Doing bulk inserts via host arrays is not possible AFAICT. I posted a similar request in February 2003. See http://archives.postgresql.org/pgsql-interfaces/2003-02/msg00091.php BTW, I don't see how a bulk update could be done. There is a way to use COPY programmatically via libpq: something like ... PQexec("COPY xxx FROM stdin"); for (...) { sprintf(buf, "%d\t%d\t...\n", values[0], values[1], ... values[n]); PQputline(conn, buf); } PQputline(conn, "\\.\n"); PQendcopy(conn); Regards, Christoph
--- Christoph Haller <ch@rodos.fzk.de> wrote: > > There is a way to use COPY programmatically via > libpq: > > > PQexec("COPY xxx FROM stdin"); > for (...) > { > sprintf(buf, "%d\t%d\t...\n", > values[0], values[1], ... values[n]); > PQputline(conn, buf); > } > PQputline(conn, "\\.\n"); > PQendcopy(conn); > > Regards, Christoph > Excellent. That'll help reduce my load times. Thanks for the help. Regards, Shelby Cain __________________________________ Do you Yahoo!? Yahoo! Tax Center - File online by April 15th http://taxes.yahoo.com/filing.html