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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T20:31:51+00:00 2026-05-22T20:31:51+00:00

i am working with a very large data set (786,432 rows to be precise).

  • 0

i am working with a very large data set (786,432 rows to be precise).

So, to prevent memory limits I want to loop over the data set in piles of 50,000 rows, so to test this out I thought I would try:

function test(){
    $start = 0;
    $end = 50000;

    $q = $this->db->select('uuid')->from('userRegionLink')->limit($end, $start)->get();
    $i = 0;
    while($q->num_rows() != 0){
        echo 'Round: '.++$i.'<br />';
        echo 'Rows: '.$q->num_rows().'<br />';
        echo 'Start: '.$start.'<br />';
        echo 'End: '.$end.'<hr />';

        $start = $end;
        $end = $end+50000;
        $q = $this->db->select('uuid')->from('userRegionLink')->limit($end, $start)->get();
    }
}

But my results are very strange: look at round 9 and below.

What is causing this?

Round: 1
Rows: 50000
Start:
0
End: 50000


Round: 2
Rows:
100000
Start: 50000
End:
100000


Round: 3
Rows:
150000
Start: 100000
End:
150000


Round: 4
Rows:
200000
Start: 150000
End:
200000


Round: 5
Rows:
250000
Start: 200000
End:
250000


Round: 6
Rows:
300000
Start: 250000
End:
300000


Round: 7
Rows:
350000
Start: 300000
End:
350000


Round: 8
Rows:
400000
Start: 350000
End:
400000


Round: 9
Rows:
386432
Start: 400000
End:
450000


Round: 10
Rows:
336432
Start: 450000
End:
500000


Round: 11
Rows:
286432
Start: 500000
End:
550000


Round: 12
Rows:
236432
Start: 550000
End:
600000


Round: 13
Rows:
186432
Start: 600000
End:
650000


Round: 14
Rows:
136432
Start: 650000
End:
700000


Round: 15
Rows:
86432
Start: 700000
End:
750000


Round: 16
Rows:
36432
Start: 750000
End:
800000


  • 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-22T20:31:52+00:00Added an answer on May 22, 2026 at 8:31 pm

    It looks like $end is not a global offset just number of records to fetch (offset from $start). Try to set $end always for 50000 and changing only $start.

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

Sidebar

Related Questions

I'm working with a large set of legacy data (converted from a flat-file db),
I'm working on a very large, data-intensive legacy application. Both the code base &
I have a query that returns a very large data set. I cannot copy
I am working on a very large scale computing library that is using STL
I'm working on a very large project that has associated class files in multiple
We're working with some very large config files which contain lots of Unity and
I'm working on a very large project with three phases of source code. Development
I have recently started working on a very large C++ project that, after completing
I've recently begun working on a very large, high traffic website. We would very
I'm working on a project which generates a very large number of sequential text

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.