- Use sql_query_limit instead of sql_query
- Update SQL query to reflect the above change
- Assign proper last post_id to $post_counter
As-per previous code, between 2 post_ids there may or may not be 100/100 posts,
sometimes or most of the times some posts might be deleted
and hence no of post can be less than 100, eg. 80/100.I optimized such that there will be always be 100/100 posts to index it in one while(...) loop.
Example (Approx, since it's system depended):
Step is no of refresh, inside each step there are no of while(...) loops.
In Previous code:
Step 1: 80 | 60 | 100 = 240 - (1 min)
Step 2: 40 | 90 | 70 = 200 - (1 min)
Step 3: 50 | 70 | 90 = 210 - (1 min)PR code:
Step 1: 100 | 100 | 100 = 300 - (1 min)
Step 2: 100 | 100 | 100 = 300 - (1 min)
Step 3: 50 = 50 - (few secs)also on larger board, even no of Steps will reduce and hence also the time.
I hope you understand what I mean, this is the best explanation I can come with.