Hi, mysql query is extremely slow when I use SELECT ... UNION ALL ... SELECT for one table. Queries on that table are working fine when I use only SELECT. There are other tables on the same database some of them are larger of that table but UNION ALL works fast for them. Only for one table and when using UNION ALL in the query. Any help would be greatly appreciated.
well I'm not sure ... but I had not changed anything, it started working slow suddenly. The same query works fast ... let's say SELECT * FROM table1 this works fast and SELECT * FROM table2 works fine too but SELECT * FROM table1 UNION ALL SELECT * FROM table2 this works extremely slow there are other tables on which it's fast as well SELECT * FROM table2 UNION ALL SELECT * FROM table3
Are the field types of table1 and table 2 identically the same? (If it's the same table, you shouldn't be using different names for it.)