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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T20:42:11+00:00 2026-06-11T20:42:11+00:00

Using MySQL, I have a number of queries that look like: SELECT * FROM

  • 0

Using MySQL, I have a number of queries that look like:

SELECT * FROM table_name WHERE some_clause ORDER BY id LIMIT 1000 OFFSET 0
SELECT * FROM table_name WHERE some_clause ORDER BY id LIMIT 1000 OFFSET 1000
SELECT * FROM table_name WHERE some_clause ORDER BY id LIMIT 1000 OFFSET 2000
SELECT * FROM table_name WHERE some_clause ORDER BY id LIMIT 1000 OFFSET 3000

and so on. The key point is that I am paginating through the result set. Each offset will only ever be executed once, so there’s no point in caching it. However, I will eventually iterate through all the results. I care very much about polluting our query cache in this situation.

If I add SQL_NO_CACHE, this will cause MySQL to stop caching the results. Is this the most efficient, as each specific result set will only be used once? Or is MySQL smart enough to cache the entire result set once, pulling subsets based on the limit and offset with each request?

In other words, if I do not use SQL_NO_CACHE, would the four example SQL statements above result in one query and three cached responses, or would it result in four separate uncached queries?

  • 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-06-11T20:42:12+00:00Added an answer on June 11, 2026 at 8:42 pm

    According to MySQL’s documentation on query caching, “If an identical statement is received later, the server retrieves the results from the query cache rather than parsing and executing the statement again.”

    Specifically, the following two statements are considered different, even though they differ only in capitalisation, and so would not be cached:

    SELECT * FROM tbl_name
    Select * from tbl_name
    

    As such, it is clear that, in my question above, adding SQL_NO_CACHE is the correct thing to do, as MySQL’s query cache is useless here.

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

Sidebar

Related Questions

I have a part of webpage that is dynamically generated using MySQL queries: <table
(Using MySQL and PHP) I have a search form that will allow my users
Using MySQL, I have a simple table that logs the IP Address that users
I have two mysql queries that return a column of phone numbers. I want
I am using mysql and have a table (Log_Table) storing user login dates, a
I'm using MySQL I have three tables: accounts { account_id, username } account_ips {
using php and mysql I have two tables, a users table and a profiles
Using MySQL, I have three tables: projects : ID name 1 birthday party 2
I have been using MySQL for 2 years now, yet I still don't know
I have tried fetching MySQL query results using mysql_fetch_row() and mysql_result() and numeric values

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.