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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T00:37:22+00:00 2026-05-23T00:37:22+00:00

Following a conversation at work about methods of pagination and only getting the data

  • 0

Following a conversation at work about methods of pagination and only getting the data you need for a particular page. Is it better to use PHP mysql_data_seek() on a returned dataset and use code to limit or use SQL LIMIT to limit results for pagination?

For example we have a built-in function for paginating results but we have to make two queries to use it. First we query the DB to find out how many results are available then we query the db using a LIMIT keyword to actually get the data for the relevant page.

Would it be better to get the entire dataset and iterate through it using mysql_data_seek() to get to the relevant page’s data before displaying it. This way we can do one query for both needs, i.e to see how much data there is available and then to only get the page we need.

I’m guessing the latter will use more memory and perhaps be slower with bigger DBs?

  • 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-23T00:37:22+00:00Added an answer on May 23, 2026 at 12:37 am

    An additional COUNT query or SQL_CALC_FOUND_ROWS combination is more effective then loading your entire table. Imagine if you have billions of rows!

    1. It will eat bandwith.
    2. Extremely slow on larger sets.
    3. It isn’t effective PHP-wise either.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm following this example: http://www.codinghorror.com/blog/2005/12/getting-started-with-indexing-service.html However, the conversion to dataset shows empty columns for
I have been referring to the following page: http://msdn.microsoft.com/en-us/library/ms178129.aspx I simply want to bulk
Concerning the following situation: www.foo.com is a page delivered in UTF-8. It features a
Concerning the following situation: www.foo.com is a page delivered in UTF-8. It features a
I currently have the following: conversation_participation = @user.conversation_participations.find_or_create_by_conversation_id(conversation.id) This correctly creates a record, problem
I've had some interesting conversations recently about software development metrics, in particular how they
Trying to work by the design guidelines for GIL, I use bits__ for my
Using Play 2.0.1 I defined the following route: GET /demo/list controllers.Demos.listDemos(page: Int ?= 0,
I have the following Entities @Entity public class Conversation implements Serializable { @Id private
i need some help improving the following code - there is a conversion between

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.