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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T15:16:29+00:00 2026-05-13T15:16:29+00:00

I have used MySQL a lot, but I always wondered exactly how does it

  • 0

I have used MySQL a lot, but I always wondered exactly how does it work – when I get a positive result, where is the data stored exactly? For example, I write like this:

$sql = "SELECT * FROM TABLE"; 
$result = mysql_query($sql);
while ($row = mysql_fetch_object($result)) {
    echo $row->column_name;
}

When a result is returned, I am assuming it’s holding all the data results or does it return in a fragment and only returns where it is asked for, like $row->column_name?

Or does it really return every single row of data even if you only wanted one column in $result?

Also, if I paginate using LIMIT, does it hold THAT original (old) result even if the database is updated?

  • 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-13T15:16:30+00:00Added an answer on May 13, 2026 at 3:16 pm

    The details are implementation dependent but generally speaking, results are buffered. Executing a query against a database will return some result set. If it’s sufficiently small all the results may be returned with the initial call or some might be and more results are returned as you iterate over the result object.

    Think of the sequence this way:

    1. You open a connection to the database;
    2. There is possibly a second call to select a database or it might be done as part of (1);
    3. That authentication and connection step is (at least) one round trip to the server (ignoring persistent connections);
    4. You execute a query on the client;
    5. That query is sent to the server;
    6. The server has to determine how to execute the query;
    7. If the server has previously executed the query the execution plan may still be in the query cache. If not a new plan must be created;
    8. The server executes the query as given and returns a result to the client;
    9. That result will contain some buffer of rows that is implementation dependent. It might be 100 rows or more or less. All columns are returned for each row;
    10. As you fetch more rows eventually the client will ask the server for more rows. This may be when the client runs out or it may be done preemptively. Again this is implementation dependent.

    The idea of all this is to minimize roundtrips to the server without sending back too much unnecessary data, which is why if you ask for a million rows you won’t get them all back at once.

    LIMIT clauses–or any clause in fact–will modify the result set.

    Lastly, (7) is important because SELECT * FROM table WHERE a = 'foo' and SELECT * FROM table WHERE a = 'bar' are two different queries as far as the database optimizer is concerned so an execution plan must be determined for each separately. But a parameterized query (SELECT * FROM table WHERE a = :param) with different parameters is one query and only needs to be planned once (at least until it falls out of the query cache).

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

Sidebar

Related Questions

I am new to MySQL, but I have used Oracle for some time. I
We dont have a lot experience in oracle, Previously we have used mysql by
I know asp.net with mySQL is possible, but does it work well (fast and
I want to use mysql with a rails app (I have never used mysql
I have used full text search mysql. My code is select * from uh_property
I used JPA and mysql. Each table have entity class.I have four tables. Table1
I will have multiple tables used by different projects on the same mySql server.
I have a MySQL database includes a table named 'Task'. and I used Hibernate
I am used to developing in PHP/MySQL and have no experience developing with SQL
I need to used dynamic order query in mysql and i have successfully achieved

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.