Marcin Skladaniec wrote:
On 11/12/2006, at 3:54 AM, Rajesh Kartha wrote:
Marcin Skladaniec wrote:
Hi !
I asked a question about the maximum query length on the user
mailing list, but no one answered.
Does someone from the dev list know the answer to my question ?
Regards
Marcin
Begin forwarded message:
From: Marcin Skladaniec <[EMAIL PROTECTED]>
Date: 6 December 2006 6:20:32 PM
To: [email protected]
Subject: query length
Reply-To: "Derby Discussion" <[email protected]>
hello !
Is there a limit to the query length ?
When I execute long query (more than about 1000 characters, but
less than 64000) i get weird exceptions.
Squirrel-sql reports StackOverflowError, but some exceptions seems
to be munched internally and never pop up, cause when not using
squirrel-sql I'm getting class org.apache.derby.client.net.NetSqlca
in response.
Marcin
Hi Marcin,
Some questions:
What version of Derby are you using and what is the nature of the
query you are executing ? ~1000 characters does not
seem that long for a query, I have seen queries > 2000 characters
working in Derby
(for example http://issues.apache.org/jira/browse/DERBY-1315)
Not sure if it is Squirrel that is causing the error, did you try
running your query using the Derby command line tool - ij ?
Is it possible to post the stack trace and a reproduction of the issue.
-Rajesh
Thank you for answering !
I'm using derby 10.2.1.6.
I tried putting my query (about 42000 characters) to ij, as the result I
got an answer :
ERROR 42ZA0: Statement too complex. Try rewriting the query to remove
complexity. Eliminating many duplicate expressions or breaking up the
query and storing interim results in a temporary table can often help
resolve this error. SQLSTATE: XBCM4: Java class file format limit(s)
exceeded: method:e1 code_length (135615 > 65535) in generated class
org.apache.derby.exe.ac888c4022x010fx70a9x5790xffff8e6417d30.
I did simplified the query using 'SELECT * from table where field in
(option1, option2 ...)' so now the query is much shorter, but I still do
expect to have my query be over 10000 characters long. would that be
supported ?
Quick summary is the number of characters is not the real factor for if
a query will work in Derby or not.
Derby's SQL statements are compiled to Java byte code. The limits in
Java byte code lead to limits on the complexity of statements that Derby
can handle. For example the above the query required a Java method that
was larger than the 64k limit imposed by the JVM. A lot of work was done
in 10.2 to avoid these limits, e.g. splitting compiled methods into
multiple methods to avoid the 64k limit. The split code though only
works in certain situations, I sure it could be improved to cover more,
if you enter a Jira bug and provide a reproducible case then it provides
the basics for someone to look at the issue and see if there is some way
to improve the code generation to avoid limits of the class file format.
Thanks,
Dan.