Subject | RE: Bulk data loading |
---|---|
Author | Dan Cumpian |
Post date | 2004-06-04T11:41:25Z |
Helen,
Here's an excerpt from the MySQL manual:
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt'
[REPLACE | IGNORE]
INTO TABLE tbl_name
[FIELDS
[TERMINATED BY '\t']
[[OPTIONALLY] ENCLOSED BY '']
[ESCAPED BY '\\' ]
]
[LINES
[STARTING BY '']
[TERMINATED BY '\n']
]
[IGNORE number LINES]
[(col_name,...)]
The LOAD DATA INFILE statement reads rows from a text file into a table at a
very high speed. If the LOCAL keyword is specified, it is interpreted with
respect to the client end of the connection. When LOCAL is specified, the
file is read by the client program on the client host and sent to the
server. If LOCAL is not specified, the file must be located on the server
host and is read directly by the server. (LOCAL is available in MySQL
Version 3.22.6 or later.)
My understanding is that it is similar to Oracle's LOAD DATA INFILE command.
I've played around with it and it is much faster than doing INSERT
statements for each row. The REPLACE and IGNORE options specify what to do
with rows that match records that already exist.
Regards,
Dan
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.676 / Virus Database: 438 - Release Date: 5/3/2004
Here's an excerpt from the MySQL manual:
LOAD DATA [LOW_PRIORITY | CONCURRENT] [LOCAL] INFILE 'file_name.txt'
[REPLACE | IGNORE]
INTO TABLE tbl_name
[FIELDS
[TERMINATED BY '\t']
[[OPTIONALLY] ENCLOSED BY '']
[ESCAPED BY '\\' ]
]
[LINES
[STARTING BY '']
[TERMINATED BY '\n']
]
[IGNORE number LINES]
[(col_name,...)]
The LOAD DATA INFILE statement reads rows from a text file into a table at a
very high speed. If the LOCAL keyword is specified, it is interpreted with
respect to the client end of the connection. When LOCAL is specified, the
file is read by the client program on the client host and sent to the
server. If LOCAL is not specified, the file must be located on the server
host and is read directly by the server. (LOCAL is available in MySQL
Version 3.22.6 or later.)
My understanding is that it is similar to Oracle's LOAD DATA INFILE command.
I've played around with it and it is much faster than doing INSERT
statements for each row. The REPLACE and IGNORE options specify what to do
with rows that match records that already exist.
Regards,
Dan
---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.676 / Virus Database: 438 - Release Date: 5/3/2004