pg.ddx.io  pgsql-php@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: V S P <toreason@fastmail.fm>
To: Andrew McMillan <andrew@morphoss.com>
Cc: pgsql-php@postgresql.org
Subject: Re: [Q] PDO use to bind arrays for insert
Date: Sun, 16 Nov 2008 23:26:58 -0500
Message-ID: <1226896018.14093.1285127497@webmail.messagingengine.com> (raw)
In-Reply-To: <1226894747.5577.267.camel@happy.mcmillan.net.nz>
References: <1226803530.24888.1284994985@webmail.messagingengine.com>
	<492093A5.7040606@gmail.com>
	<20081117002630.d86160fd.knl@bitflop.com>
	<1226890873.32288.1285117971@webmail.messagingengine.com>
	<1226894747.5577.267.camel@happy.mcmillan.net.nz>

Hi,
thank you Andrew.

do you know if query planning happens only once
for the prepared Insert statements
where data is fed from within a client loop

 foreach ...
    execute prepared insert
 end

and if it happens once -- is it on the first insert?

And the last question -- with pgpool
do prepared statements last between
different client connections?

that is If I have say apache setup with 5 processes
(and therefore PHP can be invoked within 5 worker processes
simultaneously)

would the Prepared statements last across invocations

thank you




> Using the COPY functionality in PostgreSQL does save on parsing,
> although an insert of many rows in a single insert statement doesn't
> spend any significant amount of it's time parsing the input, and the
> query planning only happens once.
> 
> If you are really concerned about the performance impacts of an insert,
> you might be better advised to feed the row data to a separate process
> which handled the actual inserts.
> 
> 
> > b) if it will work with PG connection pooling (which I am not
> > using yet, but will in the future).
> 
> There's no reason why COPY shouldn't work with connection pooling,
> unless your connection pooling is trying to understand the statements
> deeply on the way through, without understanding PostgreSQL.  I can't
> think of why someone would write connection pooling that way though!
> 
> Certainly it will work fine with pgpool, which is what I would recommend
> for connection pooling with PostgreSQL as it is written by someone on
> the core team.
> 
> Cheers,
> 					Andrew McMillan.
-- 
  V S P
  toreason@fastmail.fm

-- 
http://www.fastmail.fm - Does exactly what it says on the tin




view thread (7+ messages)  latest in thread

Message-ID: <1226896018.14093.1285127497@webmail.messagingengine.com>
Permalink:  ../1226896018.14093.1285127497@webmail.messagingengine.com/
Also on:    postgresql.org/message-id/1226896018.14093.1285127497@webmail.messagingengine.com

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-php@postgresql.org
  Cc: toreason@fastmail.fm, andrew@morphoss.com
  Subject: Re: [Q] PDO use to bind arrays for insert
  In-Reply-To: <1226896018.14093.1285127497@webmail.messagingengine.com>
  References: <1226803530.24888.1284994985@webmail.messagingengine.com> <492093A5.7040606@gmail.com> <20081117002630.d86160fd.knl@bitflop.com> <1226890873.32288.1285117971@webmail.messagingengine.com> <1226894747.5577.267.camel@happy.mcmillan.net.nz> <1226896018.14093.1285127497@webmail.messagingengine.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox