I have a huge database (contains almost 200 000 rows in each table and many such tables). I have to perform querying on it. Data is stored in MySQL and I can't use any other database. In my query I have to perform UNION
of tables. My query is something like this:
select * from table1
UNION
select * from table2
...
select * from tablen;
But when I am doing this, I am getting this error
Incorrect keyfile for the table '/tmp/#sql_d3d_0.MYI';Try to repair it'
I think it is happening because of joining too many tables with too much data. How can I optimize my query so that it won't create this problem and querying becomes faster?