X-Original-To: pgsql-sql-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 60F95CBA0F for ; Fri, 11 Jul 2003 00:22:42 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 13088-01 for ; Thu, 10 Jul 2003 21:22:23 -0300 (ADT) Received: from mail1.ihs.com (mail1.ihs.com [170.207.70.222]) by svr1.postgresql.org (Postfix) with ESMTP id 37F40CC965 for ; Thu, 10 Jul 2003 12:31:40 -0300 (ADT) Received: from css120.ihs.com (css120.ihs.com [170.207.105.120]) by mail1.ihs.com (8.12.9/8.12.9) with ESMTP id h6AFVSE7002427; Thu, 10 Jul 2003 09:31:28 -0600 (MDT) Date: Thu, 10 Jul 2003 09:24:39 -0600 (MDT) From: "scott.marlowe" To: markus brosch <"brosch [@] gmx [dot] de"@mail.bgm-gmbh.de> Cc: pgsql-sql Subject: Re: max length of sql select statement ? In-Reply-To: <1057590954.886.84.camel@sam> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-MailScanner: Found to be clean X-MailScanner-SpamCheck: X-Virus-Scanned: by amavisd-new at postgresql.org X-Archive-Number: 200307/134 X-Sequence-Number: 14248 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.