in reply to Sort large files
Some may claim that MySQL isn't up for this kind of job. If it doesn't, then you might consider downloading the free (as in gratis) versions of Oracle or DB2.CREATE DATABASE sorter; USE sorter; CREATE TABLE t619575 ( c01 varchar(2), -- SK c02 integer, -- 1242 c03 integer, -- 0180010100 c04 varchar(3), -- AAR c05 varchar(3), -- CPH c06 varchar(3), -- AAR c07 integer, -- 0735 c08 varchar(3), -- CPH c09 integer, -- 0810001 c10 bigint(25), -- 20070521200705211 c11 varchar(2), -- SK c12 integer -- 1242 ); -- Assuming tab separated columns LOAD DATA LOCAL INFILE '619575.csv' INTO TABLE t619575 FIELDS TERMINATED BY '\t' ENCLOSED BY '' ESCAPED BY '\\'; -- Add index on the fields to sort ALTER TABLE t619575 ADD INDEX idx_c02_c03_c04 (c02, c03, c04); -- Create sorted output SELECT * INTO OUTFILE '619575.sorted.csv' FROM t619575 ORDER BY c02, c03, c04 ;
|
|---|