Вопрос по union
Добавлено: 06 июн 2005, 23:59

Здравствуйте все уважаемые присутствующие на форуме.
Не разрешите ли задать один простой вопрос, наверное глупый, но меня он малость достает. Почти наверное его уже тысячи раз задавали и десятки тысяч раз отвечали, но тем не менее
Не вдаваясь в детали суть проблемы такова
Есть запрос
select ... from A join B join C (1)
union
select ... from E join F join G (2)
(1) и (2) выполняются махом:
(1) ------ Performance info ------
Prepare time = 16ms
Execute time = 0ms
Avg fetch time = 0,00 ms
Current memory = 1 051 192
Max memory = 1 214 864
Memory buffers = 2 048
Reads from disk to cache = 0
Writes from cache to disk = 0
Fetches from cache = 810
(2)------ Performance info ------
Prepare time = 0ms
Execute time = 16ms
Avg fetch time = 2,00 ms
Current memory = 992 908
Max memory = 1 214 864
Memory buffers = 2 048
Reads from disk to cache = 0
Writes from cache to disk = 0
Fetches from cache = 570
А вот итоговый запрос
Prepare time = 0ms
Execute time = 1s 890ms
Avg fetch time = 236,25 ms
Current memory = 1 047 860
Max memory = 1 177 912
Memory buffers = 2 048
Reads from disk to cache = 0
Writes from cache to disk = 0
Fetches from cache = 912 860
Почему время выполнения union так резко отличается от суммы времен выполнения составляющих его подзапросов?Сервер FB 1.5