[EMAIL PROTECTED] wrote:
> 
> Hi,
> 
> for special reasons i need a very long SQL-Query 
> concatenating about 400 tables with UNION-statements.
> But i got an error message:
> "General error;-1107 POS(494) Too complicated SQL statement 
> (too many internal commands)"
> 
> I tried the same query for about 200 UNION-Statements and 
> everything went fine.
> So, there must be an internal limit, determining whether an 
> SQL statement is too complicated or not.
> 
> Now my questions is:
> Are there any Configuration-Parameters(General or Extended) 
> for MaxDB 7.5 which affect the internal limit for "too many 
> internal commands" ???
> 

Sorry, but there is no parameter which can be used to increase the number
of possible unions. And because of size-restrictions we will not easily
be able to increase this number within the next versions.

Two suggestions I have:
select ... union all select ... for the first 200 tables
walking through the results
the same for the other tables.
This is only possible if UNION ALL is used and no Aggregation, Sorting
or the like has to be done on top of this huge union.

declare c1 cursor for select ... union select ...
for the first 200 tables
declare c2 cursor for select ... union select ...
for the other tables
select * from c1 union [ALL] select * from c2
Because at some time the final result is stored twice (once in c1 + c2
and once in the final result) memory needs may be a problem (depending
on the amount of rows in the final result. The performance will only 
be a little bit worse than with the 400-at-once solution.

Elke
SAP Labs Berlin

> Any suggestions are welcomed.
> 
> Frank
> 
> 
> 
> 
> 
> 
> -- 
> MaxDB Discussion Mailing List
> For list archives: http://lists.mysql.com/maxdb
> To unsubscribe:    
> http://lists.mysql.com/[EMAIL PROTECTED]
> 

-- 
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to