I have a local and a remote database.

I create a VIEW locally that SELECTs from the remote DB.
The VIEW statement is 2 selects with a UNION. Depending on the records returned a STRING value is used as an identifier so that when I SELECT * FROM VIEW I know where the records came from (i.e.)

CREATE VIEW test_view (fred, john, tom, qty, type)
AS (
SELECT col_a, col_b, col_c, SUM(col_d), 'Type A'
FROM table_1@remote_db
UNION
SELECT col_1, col_2, col_3, SUM(col_4), 'Type B'
FROM table_2@remote_db
GROUP BY
fred,
john,
tom,
type;

When I run a SELECT * FROM test_view it takes 15-20 seconds before anything is returned. If I remove the string identifier ('Type A') it runs instantaneously. Is there a problem sorting and grouping the remote rows with a local string value?

How can I see what's going on?