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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:00:25+00:00 2026-05-13T08:00:25+00:00

I am about to use Zend_Paginator class in my project. I found examples of

  • 0

I am about to use Zend_Paginator class in my project. I found examples of the class on the internet. One of them is

$sql = 'SELECT * FROM table_name ';    
$result = $db->fetchAll($sql);    
$page=$this->_getParam('page',1);    
$paginator = Zend_Paginator::factory($result);   
 $paginator->setItemCountPerPage(10));   
 $paginator->setCurrentPageNumber($page);   
 $this->view->paginator=$paginator;

on the first line, it actually select all the rows from table_name. What if I have a table with 50000 rows? That would be very inefficient.

Is there any other way to use Zend Paginator?

  • 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-13T08:00:26+00:00Added an answer on May 13, 2026 at 8:00 am

    About this problem, you might be interested by this section of the manual : 39.2.2. The DbSelect and DbTableSelect adapter, which states (quoting, emphasis mine) :

    … the database adapters require a
    more detailed explanation.
    Contrary to
    popular believe, these adapters do not
    fetch all records from the database
    in
    order to count them.

    Instead, the
    adapters manipulates the original
    query to produce the corresponding
    COUNT query.
    Paginator then executes
    that COUNT query to get the number of
    rows.

    This does require an extra
    round-trip to the database, but this
    is many times faster than fetching an
    entire result set and using count()
    .

    Especially with large collections of
    data.

    (There is more to read on that page — and there is an example that should give you more information)

    The idea is that you will not fetch all data yourself anymore, but you’ll tell to Zend_Paginator which Adapter it must use to access your data.

    This Adapter will be specific to “Data that is fetched via an SQL query“, and will know how to paginate it directly on the database side — which means fetching only what is required, and not all data like you initialy did.

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

Sidebar

Related Questions

I'm studying UML and I've been reading about use cases. All of the examples
Im thinking about to use a DB for my logs instead of a normal
I am about to use linqtosql in my first asp.net mvc application. I have
I'm about to use Google's Website Optimizer to do a/b testing on the home
I am wondering about the use of == when comparing two generators For example:
I'm about to use func_get_args for reading additional arguments of a function call. How
I have a question about the use of multidimensional std::intializer_list in C++. I have
I have a question about the use of data structures such as ArrayLists in
I have been reading conflicting information about the use of #define macros in iOS
I'm a bit confused about the use of all the IEnumerable<T> extension methods, intellisense

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.