[GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread Sergey A.
Hello. My application generates a large amount of inserts (~ 2000 per second) using one connection to PostgreSQL. All queries are buffered in memory and then the whole buffers are send to DB. But when I use two connections to PostgreSQL instead of one on dual core CPU (i.e. I use two processes of

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread Raymond O'Donnell
On 01/10/2008 11:44, Sergey A. wrote: Using several connections in my application is somewhat tricky, so I want to move this problem to PostgreSQL's side. Is there any method for PostgreSQL to process huge inserts coming from one connection on different cores? I don't think so. Postgres

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread Sergey A.
Hello. I don't think so. Postgres spawns a single process for each connection, so each connection is going to be confined to a single core. Thanks for your answer. I know that I can use a connection pooler to involve early created connections. Can poolers balance queries coming from my

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread Richard Huxton
Sergey A. wrote: I know that I can use a connection pooler to involve early created connections. Can poolers balance queries coming from my connection among a few physical connections to DB? The pg_loader project might be of use to you. http://pgfoundry.org/projects/pgloader/ -- Richard

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread David Fetter
On Wed, Oct 01, 2008 at 05:13:59AM -0700, Sergey A. wrote: Hello. Are you using COPY? If not, start there :) I'm new to PostgreSQL. No, I'm not using COPY =) Are you about http://www.postgresql.org/docs/8.3/interactive/sql-copy.html (COPY -- copy data between a file and a table)? You

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread David Fetter
On Wed, Oct 01, 2008 at 03:44:40AM -0700, Sergey A. wrote: Hello. My application generates a large amount of inserts (~ 2000 per second) using one connection to PostgreSQL. All queries are buffered in memory and then the whole buffers are send to DB. Are you using COPY? If not, start

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread Sergey A.
Hello. You can use it for whatever you're generating. I've tested this technique, and I'm wondering! 12 inserts per ~600ms! Thanks for your help. Multiple cores are not the solution to your problem here, but COPY almost certainly is :) But as I can see this approach doesn't work over

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread Scott Marlowe
On Wed, Oct 1, 2008 at 6:58 AM, Sergey A. [EMAIL PROTECTED] wrote: Hello. You can use it for whatever you're generating. I've tested this technique, and I'm wondering! 12 inserts per ~600ms! Thanks for your help. Multiple cores are not the solution to your problem here, but COPY almost

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread Bill Moran
In response to Sergey A. [EMAIL PROTECTED]: Multiple cores are not the solution to your problem here, but COPY almost certainly is :) But as I can see this approach doesn't work over network: I need to create file with data locally, and then ask PostgreSQL to read it. There is a network

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread Merlin Moncure
On Wed, Oct 1, 2008 at 6:44 AM, Sergey A. [EMAIL PROTECTED] wrote: Hello. My application generates a large amount of inserts (~ 2000 per second) using one connection to PostgreSQL. All queries are buffered in memory and then the whole buffers are send to DB. But when I use two connections to

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread Nikolas Everett
If you happen to be using JDBC you can also get copy to work: http://kato.iki.fi/sw/db/postgresql/jdbc/copy/ On Wed, Oct 1, 2008 at 9:24 AM, Merlin Moncure [EMAIL PROTECTED] wrote: On Wed, Oct 1, 2008 at 6:44 AM, Sergey A. [EMAIL PROTECTED] wrote: Hello. My application generates a large

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread Sergey A.
Sure it does. copy from STDIN 213 345 567 847 837 473 \. Thanks. Was this query entered in psql shell? -- Sent via pgsql-general mailing list (pgsql-general@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-general

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread Sergey A.
There is a network API for COPY. Look up pg_put_line (or PQputLine or whatever the convention is for whatever API you're using). Thanks for your answer. I use Erlang (erlang.org) + pgsql2 (it's native Erlang driver maintained by ejabberd developers). All all I have is the following functions:

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread Scott Marlowe
On Wed, Oct 1, 2008 at 7:58 AM, Sergey A. [EMAIL PROTECTED] wrote: Sure it does. copy from STDIN 213 345 567 847 837 473 \. Thanks. Was this query entered in psql shell? Yes, but if you're using something like php, you can enter it as a single string and it will work. -- Sent via

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread Scott Marlowe
On Wed, Oct 1, 2008 at 8:04 AM, Sergey A. [EMAIL PROTECTED] wrote: There is a network API for COPY. Look up pg_put_line (or PQputLine or whatever the convention is for whatever API you're using). Thanks for your answer. I use Erlang (erlang.org) + pgsql2 (it's native Erlang driver maintained

Re: [GENERAL] How to force PostgreSQL to use multiple cores within one connection?

2008-10-01 Thread Bill Moran
In response to Scott Marlowe [EMAIL PROTECTED]: On Wed, Oct 1, 2008 at 7:58 AM, Sergey A. [EMAIL PROTECTED] wrote: Sure it does. copy from STDIN 213 345 567 847 837 473 \. Thanks. Was this query entered in psql shell? Yes, but if you're using something like php, you can