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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:19:48+00:00 2026-05-23T15:19:48+00:00

I am using cakephp with postgresql. Some of my tables are very large.When using

  • 0

I am using cakephp with postgresql. Some of my tables are very large.When using cakephp’s pagination, it runs COUNT() on the large table and then it queries for the actual result. The count query takes 2.5 minutes, while the actual query that returns the data takes 95ms.

Is it possible to remove the need for the count, or replace it with something that may go faster?
I don’t need an exact number of rows returned, much like the way a Google search returns results 1-10 of about 765,000.

EDIT: Alternately, is there a way I can disable count altogether? There will often be so many results knowing how many pages is not necessary. All I need is a “Next” button that increases the SQL OFFSET like the cakephp pagination already has, and if no rows are returned on the next page then that is fine.

  • 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-23T15:19:48+00:00Added an answer on May 23, 2026 at 3:19 pm

    I found the way to bypass the pagination count query in cakephp.
    In the model that you want to paginate you can override the function that runs the count query, the function is paginateCount($conditions = null, $recursive = 0, $extra = array())

    I used the following code to fix my issue:

    function paginateCount($conditions = null, $recursive = 0, $extra = array()) {
        return 0;
    }
    

    Then I edited the pagination in the view to always display the next button. Going to a page with no results will just display nothing.

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

Sidebar

Related Questions

I am using Cakephp and try to customize the paginator result with some checkboxes
I'm trying to create an XML sitemap using CakePHP, from a table which has
Using CakePHP 1.2, I am trying produce a GROUP BY query: SELECT `categories`.*, COUNT(`entities`.id)
Using cakephp, I have a generic address table, which I want to link to
Using CakePHP, I am finding that I'm duplicating some code between controller actions. I
So I using cakephp and using ajax to submit forms. In some cases it
Using CakePHP 1.3 I'm trying to save some data to a MySQL database. The
Using CakePHP (On PHP 5.2.6) I do a list query on a table which
Hi I am using CakePHP and there are some Vendor files I need to
Using CakePHP 1.3 I have a fairly large model in CakePHP, and I'd like

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.