Re: max length of sql select statement ?

From: "scott(dot)marlowe" <scott(dot)marlowe(at)ihs(dot)com>
To: markus brosch <"brosch [(at)] gmx [dot] de"(at)mail(dot)bgm-gmbh(dot)de>
Cc: pgsql-sql <pgsql-sql(at)postgresql(dot)org>
Subject: Re: max length of sql select statement ?
Date: 2003-07-10 15:24:39
Message-ID: Pine.LNX.4.33.0307100921140.10734-100000@css120.ihs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

On 7 Jul 2003, markus brosch wrote:

> Hi All!
>
> I was searching the archive and was wondering why nobody asked this
> strange question (or I've not found it?):
>
> "What is the max allowed length of a sql statement or query?"
> I want to combine hundrets or thousands 'OR' within a select statement.
> Possible or not?

the maximum length is not limited. i.e.

insert into table badabing values ('10 gig text field goes here');

is legal and will work assuming your machine can handle such a large field
size. i.e. a pentium 100 with 64 meg ram, 64 meg swap and a 500 meg hard
drive can't handle it because of hardware limits, but a Sun E10k with 64
Gigs ram, 64 CPUs, and a 2200 gig raid array likely would.

How many OR statements can be handled is probably limited by some internal
counter or something. More than likely long before the database has
"issues" with too many OR statements, you'll have issues with the
performance (i.e. a non-linear performance curve is likely to exist as you
start swapping out or something like that.)

I'd say experiment and see where postgresql starts to have issues. I'd
certainly like to know too.

I know that dozens or even hundreds of or terms are possible, thousands,
not so sure.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message scott.marlowe 2003-07-10 15:36:50 Re: substr_count
Previous Message scott.marlowe 2003-07-10 15:20:43 Re: help yourself by helping others