| From: | "hatman" <joel(dot)winteregg(at)gmail(dot)com> |
|---|---|
| To: | pgsql-performance(at)postgresql(dot)org |
| Cc: | "Andreas Kostyrka" <andreas(at)kostyrka(dot)org>, "Richard Huxton" <dev(at)archonet(dot)com> |
| Subject: | Re: Insert performance |
| Date: | 2007-03-06 15:38:25 |
| Message-ID: | 1173195505.228450.239060@c51g2000cwc.googlegroups.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-performance |
Hi Andreas,
Thanks for the info about COPY !!
On Mar 6, 1:23 pm, andr(dot)(dot)(dot)(at)kostyrka(dot)org (Andreas Kostyrka) wrote:
> * Richard Huxton <d(dot)(dot)(dot)(at)archonet(dot)com> [070306 12:22]:> >>2. You can do a COPY from libpq - is it really not possible?
>
> > >Not really but i have been testing it and inserts are flying (about
> > >100000 inserts/sec) !!
>
> > What's the problem with the COPY? Could you COPY into one table then insert from that to your target table?
>
> Well, there are some issues. First your client needs to support it.
> E.g. psycopg2 supports only some specific CSV formatting in it's
> methods. (plus I had sometimes random psycopg2 crashes, but guarding against
> these is cheap compared to the speedup from COPY versus INSERT)
> Plus you need to be sure that your data will apply cleanly (which in
> my app was not the case), or you need to code a fallback that
> localizes the row that doesn't work.
>
> And the worst thing is, that it ignores RULES on the tables, which
> sucks if you use them ;) (e.g. table partitioning).
Ok, but what about constraints (foreign keys and SERIAL id) using a
copy statement ? do we need to handle auto-generated id (SERIAL)
manually ?
Thanks for your feedback.
Regards,
Joël
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Jeff Cole | 2007-03-06 15:40:11 | Re: |
| Previous Message | Tom Lane | 2007-03-06 15:31:37 | Re: Estimate the size of the SQL file generated by pg_dump utility |