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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T05:15:51+00:00 2026-06-13T05:15:51+00:00

I have a very long running script that is doing a pretty significant amount

  • 0

I have a very long running script that is doing a pretty significant amount of work with about 30 million database records. Every time I start it with the CLI and let it run, it runs fairly quickly given the amount of work it’s doing (about 5k records/minute). However, after about 90 minutes of this, it slows down dramatically, taking 2 hours to complete 5k records. If I restart it, it runs fine again for about 90 minutes.

The Apache log doesn’t show anything for the time it slows down, and I’m just not sure where else to look.

Running on the command line, PHP’s max execution time shouldn’t matter, and I’ve commented out the spot in CodeIngiter where it sets it to 300; I’ve even added a set_time_limit(0) to the top of the script.

My database is PostgreSQL.

Any suggestions on where to look?

Edit: Ok, Definitely Seems to be a Memory Problem. But I’m using several arrays to cache results to do batch inserts and updates, but I am clearing them out after and they are used a ton of times before I hit the 90 minute mark.

Is there a way to see what’s currently in memory?

Edit: I won’t know if this is my solution for another 90 minutes, but If you’re a CI user with Memory issues, check out this http://codeigniter.com/forums/viewthread/140012/#689396

  • 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-13T05:15:53+00:00Added an answer on June 13, 2026 at 5:15 am

    You can view your memory usage with this functionmemory_get_usage().

    The only things that you can see in memory are the arrays or variables you have delcared. Anything that has been unset(), reused, or nulled out is added for deletion by the garbage collector.


    I did PHP import scripts back in the day and what you are probably running into is memory issues. Be sure to empty out arrays once you are done with them.

    Depending on how much fun you want to have with your task, this might peak your interest:
    http://gearman.org/

    Gearman provides a generic application framework to farm out work to other machines or processes that are better suited to do the work.

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

Sidebar

Related Questions

I have a long running PHP script. I am making the database connection at
I have a very long running workflow that moves video files around between video
I have very long integer sequences that look like this (arbitrary length!): 0000000001110002220033333 Now
I have a very long javascript (so long that it's too long to escape
We have a very long form that has a number of fields and 2
As background I have a very long ID that too long to display in
I have a WPF (C# and .NET 4) application that has a long running
I have a scenario which is causing very long running processes and suspect it
I have some long-running CLI PHP scripts that run regularly via cron. I'd like
I have a method which is running very long. I want to be able

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.