There is a HUGE limit on the size of the results of a query but I don't know exactly what yours will be. I do know it should be more than 2GB so I don't think your 4500 fields of data (300X15) will meet that limit.
However, there is a practical limit on how many queries can be UNIONed into one result. One limit is due to the sheer length of the query (text size exceeds input buffer). Another may exist due to the actual # of SELECTS that need to be added together, but I can't recall hearing of that one specifically. Are you saying that you need to UNION the results of up to 300 different select statements? That's a lot of queries but depending on what you are using them for, I _can_ imagine a need for it. I would be interested in the practical reason for needing to perform such a large UNION, if you don't mind. Just curious, Shawn Green Database Administrator Unimin Corporation - Spruce Pine Jay K <[EMAIL PROTECTED]> wrote on 10/14/2004 12:43:50 PM: > Works great. > > Is the a limit on the size of the query. There are > currently 50 queries (may go upto 300 in future) and > each has 15 cols (250b each query) which makes the > entire query 12kb (250 x 50). > > Thanks, > Jay > > --- Michael Stassen <[EMAIL PROTECTED]> > wrote: > > > Right. > > > > (SELECT col1, col2, col3, col4 FROM table1, > > table2 > > WHERE table1.col1 = table2.col1 and table1.col2 > > = 1 > > ORDER BY col3 DESC LIMIT 5) > > UNION > > (SELECT col1, col2, col3, col4 FROM table1, > > table2 > > WHERE table1.col1 = table2.col1 and table1.col2 > > = 2 > > ORDER BY col3 DESC LIMIT 5) > > UNION > > (SELECT col1, col2, col3, col4 FROM table1, > > table2 > > WHERE table1.col1 = table2.col1 and table1.col2 > > = 3 > > ORDER BY col3 DESC LIMIT 5) > > ORDER BY col3 DESC; > > > > should work. Notice that you can reorder the > > results after the UNIONs, if > > you want, with a final ORDER BY clause. UNION is > > available in MySQL 4.0.0 > > and up. > > > > Michael > > > > [EMAIL PROTECTED] wrote: > > > > > I believe you need to combine the results of 3 > > separate queries (each with > > > a limit of 5) into a temp table and respond with > > the contents of the table > > > you built. If I read this correctly > > > (http://dev.mysql.com/doc/mysql/en/UNION.html) you > > could do the same thing > > > with a UNION query and skip the temp table step > > (MySQL does it for you). > > > But you must have be using a version that supports > > UNION queries. > > > > > > Each piece-wise query must have it's own LIMIT > > constraint in order to > > > apply the limit to each value you are querying on. > > Using either method you > > > could even want 10 of #1 but only 5 of #2 and only > > 3 of #3 and still make > > > it work. > > > > > > Shawn Green > > > Database Administrator > > > Unimin Corporation - Spruce Pine > > > > > > > > > __________________________________ > Do you Yahoo!? > Yahoo! Mail Address AutoComplete - You start. We finish. > http://promotions.yahoo.com/new_mail