Subject Re: [firebird-support] Maximum number of union?
Author Arno Brinkman
Hi,

> Is there any maximum number of union in a query?

Not directly UNION, but the number of streams (255).
Every tables uses 1 stream and every UNION uses 1 stream, thus

Example1:

SELECT * FROM RDB$DATABASE
UNION ALL
SELECT * FROM RDB$DATABASE

uses 3 streams


Example2:

SELECT * FROM RDB$DATABASE
UNION ALL
SELECT * FROM RDB$DATABASE
UNION ALL
SELECT * FROM RDB$DATABASE
UNION ALL
SELECT * FROM RDB$DATABASE

uses 7 streams


Example3:

SELECT
*
FROM
RDB$RELATIONS r
JOIN RDB$RELATION_FIELDS rf ON
(rf.RDB$RELATION_NAME = r.RDB$RELATION_NAME)
UNION ALL
SELECT
*
FROM
RDB$RELATIONS r
JOIN RDB$RELATION_FIELDS rf ON
(rf.RDB$RELATION_NAME = r.RDB$RELATION_NAME)

uses 5 streams