SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    SitePoint Enthusiast
    Join Date
    May 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    LOAD DATA INFILE Versus Mysql import

    Hi ,

    Plzzzz Help me...

    I neeed to dump around 300,000 to 400,000 records in one table .

    Please let me know which is the good approach.

    1) LOAD DATA INFILE

    2) mysql -uusername -ppassword dbname < sql filename


    Please help me out....

  2. #2
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    they do completely different things and are not interchangeable.

    LOAD DATA INFILE imports records from structured data files, such as CSV or tab delimited files.

    using the mysql CLI in that manner executes a file that contains SQL statements.
    Check out our new Industry News forum!
    Keep up-to-date with the latest SP news in the Community Crier

    I edit the SitePoint Podcast

  3. #3
    SitePoint Enthusiast
    Join Date
    May 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi,

    Thanks for your reply....

    Actually I am designing the PHP script approach to dump 300,000 to 400,000 records in one table...

    I can do using 'LOAD DATA INFILE' or I can create INSERT sql statements in one file and at the end of script i will import it using 'mysql -uusername -ppassword dbname < sql filename' by givin call to shell script.

    Please let me know which one i should prefer...

    It's very urgent...plz help me

    Thankss,
    Ashish

  4. #4
    reads the ********* Crier silver trophybronze trophy longneck's Avatar
    Join Date
    Feb 2004
    Location
    Tampa, FL (US)
    Posts
    9,854
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    if you use SELECT INTO OUTFILE and LOAD DATA INFILE with exactly the same options, you're nearly guaranteed a perfect export/import.

    if you write code to make INSERT statements, i think it's more likely you'll run in to lots of bugs during development trying to handle all of the edge cases.
    Check out our new Industry News forum!
    Keep up-to-date with the latest SP news in the Community Crier

    I edit the SitePoint Podcast

  5. #5
    SitePoint Member
    Join Date
    May 2008
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'd definitely use the second option for records that massive. Few hosting providers (mine) automatically kill long running processes..


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •