Re: InitPostgres and flatfiles question

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: elein <elein(at)varlena(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: InitPostgres and flatfiles question
Date: 2007-01-07 02:02:49
Message-ID: 200701070202.l0722nP27481@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

elein wrote:
> On Fri, Jan 05, 2007 at 08:45:51PM -0500, Tom Lane wrote:
> > Ron Mayer <rm_pg(at)cheapcomplexdevices(dot)com> writes:
> > > Tom Lane wrote:
> > >> Bruce Momjian <bruce(at)momjian(dot)us> writes:
> > >>> What value is allowing multiple queies via PQexec()
> > >>
> > >> The only argument I can think of is that it allows applications to be
> > >> sloppy about parsing a SQL script into individual commands before they
> > >> send it. (I think initdb may be guilty of exactly that BTW...) At the
> > >> same time you could argue that such sloppiness is inherently a Bad Idea.
> >
> > > Doesn't it also avoid some network(?) overhead when you have
> > > a large number of small inserts or updates?
> >
> > > I seem to recall a previous company where we had a major performance
> > > by concatenating a bunch of updates with ";"s in between and sending
> > > them to postgresql as a single command.
> >
> > These days you'd probably be better off using a multi-row VALUES() list
> > if relevant. Also, if you really want to send multiple statements like
> > that, there's a cleaner way to do it: use the extended query protocol
> > and don't Sync or wait for a reply until you've sent them all.
> >
> > regards, tom lane
> >
> In shell scripts that do things in the database I often put >1 statement
> in the line. Since it is the shell, I want quick results. Usually it
> is an INSERT/UPDATE followed by a SELECT.
>
> It would be very frustrating not to be able to send multiple commands
> with one -c in psql.

We aren't going to disable that --- we are considering disabling the
backend from treating it as a single transaction.

--
Bruce Momjian bruce(at)momjian(dot)us
EnterpriseDB http://www.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2007-01-07 02:09:17 Re: InitPostgres and flatfiles question
Previous Message elein 2007-01-07 01:40:07 Re: InitPostgres and flatfiles question