Possible Duplicate:
Inserting query result to another table hangs on “Copying to temp table on disk” on MySQL
I started the process of inserting returned results to another table. The query groups the rows in respect of indexed IDs (149,000,000 rows are decreased to 460,000 rows). The query includes 3 table inner join (each table has about 20,000,000 rows). Further information, the process is completed in 12 seconds for a test file which has 1000 rows(703rows returned). I started the query, but it is still running in the state: "Copying to temp table on disk" for 38000seconds(10hours and 30minutes). I think there is a problem while insertion process. How can I avoid from this situation? The operating system of the computer is Windows7, 3GB ram, Intel core2duo 2.27GHz processor. The query is:
insert into kdd.contents(adID, descriptionWords, purchasedkeywordWords, titleWords)
SELECT
training.adid,
descriptionid_tokensid.tokensid,
purchasedkeywordid_tokensid.tokensID,
titleid_tokensid.tokensID
FROM kdd.training
inner join kdd.purchasedkeywordid_tokensid
on training.keywordID=purchasedkeywordid_tokensid.purchasedkeywordid
inner join kdd.titleid_tokensid
on training.titleID=titleid_tokensid.titleID
inner join kdd.descriptionid_tokensid
on training.descriptionID=descriptionid_tokensid.descriptionID
group by adID;