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

  • Home
  • SEARCH
  • 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 1027445
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T12:14:31+00:00 2026-05-16T12:14:31+00:00

i want to implement my own Zend_Paginator_Adapter so i implemented Zend_Paginator_Adapter_Interface ( docs ).

  • 0

i want to implement my own Zend_Paginator_Adapter so i implemented Zend_Paginator_Adapter_Interface (docs). i am now at implementing count(). am i right to say that if my query is

SELECT * FROM Posts LIMIT ... // where limit is for pagination purposes

i need to get the total number of rows in the table (to return in count())?

SELECT COUNT(*) FROM Posts

it seem unavoidable to have 2 queries? i am not too concerned in my current project about performance, but the need for 2 queries, just made me think, so i wanted to just ask here

  • 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-16T12:14:31+00:00Added an answer on May 16, 2026 at 12:14 pm

    am i right to say…to get the total number of rows in the table (to return in count())?
    SELECT COUNT(*) FROM Posts

    This is certainly one way to get the result you are looking for. Running a second query is not that bad assuming your table/indexes are optimized.

    There is an alternative. You can include the statement “SQL_CALC_FOUND_ROWS” in your original query, then your second query would consist of only:

    “SELECT FOUND_ROWS();”

    See the following link for more info on this functionality:
    http://dev.mysql.com/doc/refman/5.0/en/information-functions.html#function_found-rows

    Of course, this assumes you are using MySQL.

    i am not too concerned in my current project about performance, but the need for 2 queries, just made me think…

    It is certainly a valid concern especially as the number of records starts to increase. What makes Zend_Paginator awesome is the fact that you can
    inject a Zend_Cache_Core instance. This will ensure that you will only be running these queries a minimal number of times based on how long your
    cache lifetime is.

    See the following page for more info on the caching features:
    http://framework.zend.com/manual/en/zend.paginator.advanced.html#zend.paginator.advanced.caching

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

Sidebar

Related Questions

I want to implement an automatic update system for a windows application. Right now
I have my own password/login rules that I want to implement such as: Password:
I want to implement my own clustering algorithm using this Virtual Earth javascript API:
I want to implement my own cursor in an OpenGL / GLUT window. The
I want to implement the own custom TextBox control in Asp.Net(C#). Please give me
I want to implement my own dynamic memory management system in order to add
For a project I want to implement my own Z-buffer. I know the algorithm
I'm developing a Windows Phone 7 app but don't want to re-implement my own
I want to implement and understand the concept of marshalling over my own rpc
How can I implement serialization on my own. Meaning I don't want my class

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.