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 913631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:35:34+00:00 2026-05-15T17:35:34+00:00

I am importing a csv file with more then 5,000 records in it. What

  • 0

I am importing a csv file with more then 5,000 records in it. What i am currently doing is, getting all file content as an array and saving them to the database one by one. But in case of script failure, the whole process will run again and if i start checking the them again one by one form database it will use lots of queries, so i thought to keep the imported values in session temporarily.

Is it good practice to keep that much of records in the session. Or is there any other way to do this ?

Thank you.

  • 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-15T17:35:34+00:00Added an answer on May 15, 2026 at 5:35 pm

    If you have to do this task in stages (and there’s a couple of suggestions here to improve the way you do things in a single pass), don’t hold the csv file in $_SESSION… that’s pointless overhead, because you already have the csv file on disk anyway, and it’s just adding a lot of serialization/unserialization overhead to the process as the session data is written.

    You’re processing the CSV records one at a time, so keep a count of how many you’ve successfully processed in $_SESSION. If the script times out or barfs, then restart and read how many you’ve already processed so you know where in the file to restart.

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

Sidebar

Related Questions

I have a simple rake task importing records from a CSV file and saving
I am currently importing a CSV file which has a column that is all
I am importing approx 350,000 lines from a CSV file into MySQL using PHP
I'm saving out a .csv file from Excel and importing it to a MySQL
When importing numbers from a csv file, I need to convert them to floats
I'm having issues importing a CSV file into my MySQL database because of all
I'm looking for the best method for importing csv or excel file to SQL
I am having an issue with importing a large(60MB) CSV file in MYSQL DB.
I'm importing from a CSV and getting data roughly in the format { 'Field1'
When importing a CSV file into Excel, it only strips the double-quotes from the

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.