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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T11:19:52+00:00 2026-05-18T11:19:52+00:00

Suppose Table X has a 100 tuples. Will the following approach to scanning X

  • 0

Suppose Table X has a 100 tuples.

Will the following approach to scanning X generate all the tuples in TABLE X, in MySQL?

for start in [0, 10, 20, ..., 90]:
    print results of "select * from X LIMIT start, 10;"

I ask, because I’ve been using PostgreSQL, which clearly says that this approach need not work, but there seems to be no such info for MySQL. If it won’t, is there a way to return results in a fixed ordering without knowing any other info about the table (like what the primary key fields are)?

I need to scan each tuple in a table in an application, and I want a way to do it without using too much memory in the application (so simply doing a “select * from X” is out).

  • 1 1 Answer
  • 4 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-18T11:19:53+00:00Added an answer on May 18, 2026 at 11:19 am

    If you are using Innodb or MyISAM table types, a better approach is to use the HANDLER interface. Only MySQL supports this, but it does what you want:

    http://dev.mysql.com/doc/refman/5.0/en/handler.html

    Also, the MySQL API supports two modes of retrieving data from the server:

    1. store result: in this mode, as soon as a query is executed, the API retrieves the entire result set before returning to the user code. This can use up a lot of client memory buffering results, but minimises the use of resources on the server.
    2. use result: in this mode, the API pulls results row-by-row and returns control to the user code more frequently. This minimises the use of memory on the client, but can hold locks on the server for longer.

    Most of the MySQL APIs for various languages support this in oneform or another. It is usually an argument that can be supplied as when creating the connection, and / or a separate call that can be used against an existing connection to switch it to that mode.

    So, in answer to your question – I would do the following:

    set the connection to "use result" mode;
    select * from X
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've a table which has 3 columns: id, a_id and b_id. Suppose rows are
I have requirement like, suppose I have a 'property' table which has 'ListingKey' field
Suppose there is a table A which has a column AccessRights which is multivalued(
Suppose I have employee and department table, employee has foreign key departmentID that is
I'm trying to find a way to get distinctive pairs. Suppose the table has
I have two tables suppose table 1 has two columns with short names and
Suppose that I have two Hibernate POJOs: Customer and Order. The Order table has
Suppose I have the following table ( JS Fiddle ): <table class=data-table> <thead> <tr>
Suppose a database table has a column Name which is defined as key for
Lets suppose there is a stored procedure that has 3 params. Out of all

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.