Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6921667
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:18:22+00:00 2026-05-27T10:18:22+00:00

I have a 1GB sql text file I’m importing into MySQL. I’ve used a

  • 0

I have a 1GB sql text file I’m importing into MySQL.
I’ve used a ‘large text file viewer’ and can see it a std mysql table export – starts with drop table, then create new table and then insert. Note: I also have a csv of the table.

I’m used the following methods to import it:

  1. php.ini – upload_max_filesize, memory_limit and post_max_size (increase sizes of these but it still said it was too large – made these numbers very large – 10 zeros after default number).

  2. C:\wamp\bin\mysql\mysql5.1.53\bin>mysqlimport -h localhost -u root -p –fields-t
    erminated-by=’\t’ –lines-terminated-by=’\n’ –local testing c:\temp\filename.csv

  3. source c:\temp\filename.sql

I can see the second 2 methods ‘in task manager’ seem to be moving the entire 1GB file into memory before they try to insert them into MySQL. I can see the process for each and it slowly grows to over 1GB and failed with a error.

Question: Is there a preferable and fastest way to import a table? is there a way that doesn’t need to move the entire file into memory? First time I’ve worked with such a large sql table.

thx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T10:18:23+00:00Added an answer on May 27, 2026 at 10:18 am

    Part of the problem of having such a huge export is (presumably) due to the redundancies in it. There are probably thousands of “INSERT” commands which when loaded all at once, takes up a huge chunk of memory.

    If you have the exact same data as a CSV, what I would do is create a small PHP script to go line-by-line through the CSV file and create an INSERT sql query dynamically and then execute it. This should keep the memory footprint very low since you could keep replacing the values of your temporary variables (corresponding to the fields) after each insertion.

    I’ve linked to the function that I’d try to use. It’s called fgetcsv. That link also has some sample scripts which I believe might be of use to you that were created by other users.

    Good luck!

    fgetcsv PHP function to use for the line-by-line read

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a large xml file (1Gb). I need to make many queries on
I have a large raw data file (up to 1GB) which contains raw samples
SQL Server express editions have memory limit of 1GB. Can I install multiple versions
I have a query returning large XML, its size can reach 1GB in extreme
I have a few very large text files that weigh over 1GB and I
I have a need to read in a 1gb raw text file from disk
Say I have a very large file (say > 1GB) and I want to
I have a large file (typically more than 1GB) with following format: [ header
In one of my applications I have a 1gb database table that is used
I have a 1GB binary file on another system. Requirement: ftp/download and convert binary

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.