Re: Very long SQL strings

From: Heikki Linnakangas <heikki(at)enterprisedb(dot)com>
To: Steven Flatt <steven(dot)flatt(at)gmail(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Very long SQL strings
Date: 2007-06-21 18:41:55
Message-ID: 467AC673.6080107@enterprisedb.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

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

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message Tom Lane 2007-06-21 18:45:54 Re: Very long SQL strings
Previous Message Heikki Linnakangas 2007-06-21 18:33:47 Re: Database-wide VACUUM ANALYZE