I have a fairly large MySQL table (~600G) on my own computer (Win10) with the following structure.
id var1 var2 var3
a val1 1 5
b val1 2 6
c var2 3 7
d var2 4 8
both id
and var1
are indexed. I want to split this table into several sub-tables based on the values of var1. That is,
for table table_var1
:
id var1 var2 var3
a val1 1 5
b val1 2 6
for table 'table_var2':
id var1 var2 var3
c val2 3 7
d val2 4 8
I used the following code
CREATE TABLE table_var1 LIKE original_table;
INSERT INTO table_var1 SELECT * FROM original_table where var1=val1;
CREATE TABLE table_var2 LIKE original_table;
INSERT INTO table_var2 SELECT * FROM original_table where var1=val2;
My question is very similar to this. I want to speed up the splitting of the table, but since the database is on my own computer, if I'm not wrong, partition
is not really helpful (which is more helpful when there are several physical harddisks available?).
Is there any suggestion for improving the performance of table splitting?