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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T01:17:34+00:00 2026-06-05T01:17:34+00:00

I have a php script which runs continuously several hours and every few seconds

  • 0

I have a php script which runs continuously several hours and every few seconds I have new data to save in a database. So I have the option to store new data when it becomes available or gather them in an array and save them once I have 100 or 500. If I’m correct php cannot send multiple insert queries to the database so the two options above would take the exact same amount of time to save.

Am I wrong or one is faster than the other? Perhaps there is a third solution faster than these?

  • 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-06-05T01:17:36+00:00Added an answer on June 5, 2026 at 1:17 am

    You could use the following syntax to insert multiple rows at a time:

    INSERT INTO foo
    ( a, b, c)
    VALUES
    ( 1, 2, 3),
    ( 4, 5, 6),
    ( 7, 8, 9)
    

    or, you could dump the data to a delimited file as you get it and when you get to 100 or so lines in the file use LOAD DATA INFILE (http://dev.mysql.com/doc/refman/5.5/en/load-data.html) to do the insert. I’ve found that LOAD DATA INFILE is very efficient for importing large amounts of data.

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

Sidebar

Related Questions

I have a scheduled task on my server which runs a PHP script every
I have a (PHP) script which runs on a new row in MySQL. However,
I have the following PHP script which runs nicely and inserts all the data
I have a PHP script which downloads files to the client, in a new
Here I have a simple php script which displays some values from a database
I have tried a session.php script which runs at the head of each page
i have a php script which runs fine when executed by SSHing into my
I have a PHP script which runs a MySQL query. $query = INSERT INTO
I have a php script which runs on my ubunutu server. this script runs
I have a button with onclick=sendNews() and a PHP script which does the database

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.