Hi everyboy, i have problem in table structure. I have table which has 3 million records and i want to seperate this table intto another tables. For example 0 to 100,000 records in another tablo 100,000 to 200,000 records in another table.
Don't. Unless there's a reason for why they should be in separate tables other than the number of rows. As long you have have an index on the right columns it really shouldn't be a problem.
It depends on the database type if it's oracle you can partition tables, but 3 million rows are not that much.
MYsql Tables structure is CREATE TABLE IPCountry ( ipFROM INT(10) UNSIGNED ZEROFILL NOT NULL DEFAULT '0000000000', ipTO INT(10) UNSIGNED ZEROFILL NOT NULL DEFAULT '0000000000', countrySHORT CHAR(2) NOT NULL, countryLONG VARCHAR(45) NOT NULL, ipISP VARCHAR(255) NOT NULL, PRIMARY KEY(ipFROM, ipTO) );
Maybe MySQLs MERGE can solve your problems? I cannot add a link but search for it in the MySQL Reference manual Some issues it can solve: Obtain more speed. You can split a big read-only table based on some criteria, and then put individual tables on different disks. A MERGE table on this could be much faster than using the big table. Perform more efficient searches. If you know exactly what you are looking for, you can search in just one of the split tables for some queries and use a MERGE table for others. You can even have many different MERGE tables that use overlapping sets of tables.
i solved this problem by using "LIMIT" Like that, Insert into data1 select * from IPISP LIMIT 0,100000 Insert into data2 select * from IPISP LIMIT 100000,100000 Insert into data3 select * from IPISP LIMIT 200000,100000 Insert into data4 select * from IPISP LIMIT 300000,100000 Insert into data5 select * from IPISP LIMIT 400000,100000 Insert into data6 select * from IPISP LIMIT 500000,100000 Insert into data7 select * from IPISP LIMIT 600000,100000 Insert into data8 select * from IPISP LIMIT 700000,100000 Insert into data9 select * from IPISP LIMIT 800000,100000 Insert into data10 select * from IPISP LIMIT 900000,100000 Insert into data11 select * from IPISP LIMIT 1000000,100000 Insert into data12 select * from IPISP LIMIT 1100000,100000 Insert into data13 select * from IPISP LIMIT 1200000,100000 Insert into data14 select * from IPISP LIMIT 1300000,100000 ... Maybe it helps to other people