1) CREATE TEMPORARY TABLE __ip_test_table_tmp ( `ip_use` int(10) unsigned NOT NULL, `from_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `to_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00', `bytes` bigint(20) unsigned NOT NULL, `dayofweek` tinyint(3) unsigned NOT NULL, PRIMARY KEY (`from_time`,`ip_use`,`dayofweek`)
) ENGINE=Memory;
2) LOAD DATA LOCAL INFILE '/tmp/dumps/iul.dump' INTO TABLE __ip_test_table_tmp;
3) REPLACE INTO ip_test_table SELECT * FROM __ip_test_table_tmp;
4) DROP TABLE IF EXISTS __ip_test_table_tmp;
As a temporary solution, we use temporary tables:
1) CREATE TEMPORARY TABLE __ip_test_table_tmp (
`ip_use` int(10) unsigned NOT NULL,
`from_time` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`to_time` timestamp NOT NULL DEFAULT '0000-00-00 00:00:00',
`bytes` bigint(20) unsigned NOT NULL,
`dayofweek` tinyint(3) unsigned NOT NULL,
PRIMARY KEY (`from_ time`,` ip_use` ,`dayofweek` )
) ENGINE=Memory;
2) LOAD DATA LOCAL INFILE '/tmp/dumps/ iul.dump' INTO TABLE __ip_test_ table_tmp; table_tmp; table_tmp;
3) REPLACE INTO ip_test_table SELECT * FROM __ip_test_
4) DROP TABLE IF EXISTS __ip_test_