pg.ddx.io  pgsql-performance@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Heikki Linnakangas <heikki@enterprisedb.com>
To: Steven Flatt <steven.flatt@gmail.com>
Cc: pgsql-performance@postgresql.org
Subject: Re: Very long SQL strings
Date: Thu, 21 Jun 2007 19:41:55 +0100
Message-ID: <467AC673.6080107@enterprisedb.com> (raw)
In-Reply-To: <357fa7590706211133u2ae43d09id1653ca63d7a7838@mail.gmail.com>
References: <357fa7590706211133u2ae43d09id1653ca63d7a7838@mail.gmail.com>

Steven Flatt wrote:
> It looks like Postgres does not enforce a limit on the length of an SQL
> string.  Great.  However is there some point at which a query string 
> becomes
> ridiculously too long and affects performance?  Here's my particular case:
> consider an INSERT statement where you're using the new multi-row VALUES
> clause or SELECT ... UNION ALL to group together tuples.  Is it always
> better to group as many together as possible?

I'm sure you'll reach a point of diminishing returns, and eventually a 
ceiling where you run out of memory etc, but I don't know what the limit 
would be.

The most efficient way to do bulk inserts is to stream the data with COPY.

-- 
   Heikki Linnakangas
   EnterpriseDB   http://www.enterprisedb.com



view thread (7+ messages)  latest in thread

Message-ID: <467AC673.6080107@enterprisedb.com>
Permalink:  ../467AC673.6080107@enterprisedb.com/
Also on:    postgresql.org/message-id/467AC673.6080107@enterprisedb.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 using the --to and --cc options:
  reply via email

  To: pgsql-performance@postgresql.org
  Cc: heikki@enterprisedb.com, steven.flatt@gmail.com
  Subject: Re: Very long SQL strings
  In-Reply-To: <467AC673.6080107@enterprisedb.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