List:General Discussion« Previous MessageNext Message »
From:Daniel Kasak Date:December 1 2005 4:08am
Subject:Re: MySQL 5 is 25% slower then 4.1
View as plain text  
Chenzhou Cui wrote:

> The file is in fix column width format. If it is in CSV format, I 
> don't need a program to read it.

'load data infile' can import from a fixed-width format. Check the 
documentation. I've set up a number of these imports, and they're a 
little messy to set up ( you have to put details of the widths of 
columns IN THE TABLE DEFINITION, but it does work.

What I do is create a temporary table with the column widths in the 
table definition, 'load data infile' into it, and then use a 'insert 
into ___ select * from ___' query to move the data into the real table. 
If you've got a lot of rows, then maybe this isn't such a good idea, but 
you can *probably* get your column widths into your table without 
causing too much trouble.

Importing from fixed-width columns really is the weakest part of 'load 
data infile'. Perhaps a feature-request bug for a better solution is in 
order?

-- 
Daniel Kasak
IT Developer
NUS Consulting Group
Level 5, 77 Pacific Highway
North Sydney, NSW, Australia 2060
T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989
email: dkasak@stripped
website: http://www.nusconsulting.com.au
Thread
MySQL 5 is 25% slower then 4.1Chenzhou Cui5 Dec
  • Re: MySQL 5 is 25% slower then 4.1Gary Richardson5 Dec
    • Re: MySQL 5 is 25% slower then 4.1Chenzhou Cui6 Dec
      • Re: MySQL 5 is 25% slower then 4.1Daniel Kasak6 Dec
        • Re: MySQL 5 is 25% slower then 4.1Gary Richardson6 Dec
          • Re: MySQL 5 is 25% slower then 4.1Chenzhou Cui6 Dec
            • Re: MySQL 5 is 25% slower then 4.1Daniel Kasak6 Dec