Re: [GENERAL] Getting value of SERIAL column after insert from libpq?
| От | Mike Mascari |
|---|---|
| Тема | Re: [GENERAL] Getting value of SERIAL column after insert from libpq? |
| Дата | |
| Msg-id | 386105A0.402D5A30@mascari.com обсуждение исходный текст |
| Ответ на | Re: [GENERAL] Getting value of SERIAL column after insert from libpq? ("Mark Alliban" <MarkA@idnltd.com>) |
| Список | pgsql-general |
Mark Alliban wrote:
>
> Thanks for the help, it works great!
>
> However, there is a problem with performance.
> I am moving from MySQL to Postgres, and to test performance I am inserting a
> large row (30 fields) into a table from my C program. I am running this
> program 50 times, and timing the results. The MySQL version of the program
> took 0.75 seconds to execute 50 times, but the Postgres version takes 22-25
> seconds. A similar test with a simple select takes 3.5 seconds on Postgres
> but 0.8 on MySQL. Postgres undoubtably has more features and is better for
> my app than MySQL, but are these performance values normal?
>
> All my program does is read the query from a text file, open the database
> connection, perform the query, output currval('seqence_name') or the query
> results to a text file, and close the connection. This is how my app needs
> to work.
>
> Thanks,
> Mark.
Are you running with fsync() disabled? That is the single
largest bottleneck for PostgreSQL performance and is
disabled by default in MySQL, except on NT (since NT has a
tendency to crash). You can disable fsync() with the
postmaster -o -F option, to pass the option to the backend.
See the postmaster and postgres man pages for more info.
Hope that helps,
Mike Mascari
В списке pgsql-general по дате отправления: