I have created a view in MySQL as
create view vtax
as
SELECT * FROM table1
union
SELECT * FROM table2;
Where in table 1 have 800000 records, and table2 have 500000 records, when I run the independent queries the result are returned with 0.078 secs, but when I am running them through the view it goes in toss taking time more than 10-15 secs.
select * from vtax where col1=value; -- takes more than 10-15 secs
select * from table1 where col1=value; -- takes 0.078 secs
select * from table2 where col1=value; -- takes 0.078 secs
I have created indexes on the tables separately.
Any help/idea what should be done.