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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T11:08:01+00:00 2026-06-15T11:08:01+00:00

Is it possible to change the limits of a Query without executing it again.

  • 0

Is it possible to change the limits of a Query without executing it again.

Here is my code:

$this->db->select("SQL_CALC_FOUND_ROWS e.emp_no, e.birth_date, e.first_name, e.last_name, e.gender, e.hire_date, t.title, s.salary, d.dept_name", FALSE)
            ->from('employees AS e')
            ->join('titles AS t', 'e.emp_no = t.emp_no')
            ->join('salaries AS s', 't.emp_no = s.emp_no')
            ->join('dept_emp AS de', 's.emp_no = de.emp_no')
            ->join('departments AS d', 'de.dept_no = d.dept_no')
            ->join('dept_manager AS dm', 'd.dept_no = dm.dept_no')
            ->order_by($sort_by, $sort_order)
            ->group_by('e.emp_no')
            ->where('t.title', $title)
                        ->limit($limit, $offset);


    $ret['rows'] = $q->get()->result(); 

I am using pagination so if I keep loading a query that return about 100,000 rows it slows down the return.

I wanted to make it faster by running the query once then changing the limit dynamically.

  • 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-15T11:08:03+00:00Added an answer on June 15, 2026 at 11:08 am

    The limit doesn’t slow down your application. “SQL_CALC_FOUND_ROWS” does. It’s known fact that it can slow down a query, and i mean SLOW. Check this post for benchmarks and explanation of how it works: http://www.mysqlperformanceblog.com/2007/08/28/to-sql_calc_found_rows-or-not-to-sql_calc_found_rows/

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

Sidebar

Related Questions

Possible Duplicate: Change the URL in the browser without loading the new page using
First off, here's my SQL query: SELECT research_cost, tech_name, (SELECT research_cost FROM technologies WHERE
Will this query work? Is it most efficient? SELECT * FROM `posts` WHERE MATCH
I have this query SELECT l.licitatii_id, l.nume, l.data_publicarii, l.data_limita FROM licitatii_ue l INNER JOIN
Possible Duplicate: Change icon on of an App in iOS 4 in run-time Is
Possible Duplicate: change layout and template in zend dynamically according to the device(android tab,iphone,ipad)
Is it possible to change the color of View Results text in below ?
Is it possible to change C#'s built-in Vector3 struct to not use floating point
Is it possible to change object's value not directly? For example a = {x:
is it possible to change the Audience of an already existing Post in my

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.