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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T17:36:58+00:00 2026-05-15T17:36:58+00:00

I am executing a mysql SELECT statement which takes 30 seconds to run the

  • 0

I am executing a mysql SELECT statement which takes 30 seconds to run the first time, but then just takes .2 all times after that.

I thought clearing the query cache would resolve the problem (RESET QUERY CACHE), but it still takes .2 seconds after that. Only restarting the server reverts the query back to taking 30 seconds, but then it takes .2 after that first run too. Adding SQL_NO_CACHE does not work either.

Query:

SELECT id FROM tblOne WHERE szAddress = '123 Main Street' AND szCity = 'LAS VEGAS' AND szStateCode = 'NV'

EXPLAIN:

"id","select_type","table","type","possible_keys","key","key_len","ref","rows","Extra"
1,"SIMPLE","tblOne","ref","szCity_2,idx_state_active","szCity_2","52","const",62620,"Using where"

Is there another way to get this to repeatedly run slowly (without restarting the server) so I can test adding new indexes and their performance?

I was planning on adding an address or an address+city+state index.

  • 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-15T17:36:58+00:00Added an answer on May 15, 2026 at 5:36 pm

    SQL_NO_CACHE should be the way to do it. I did stumble upon something in the configuration that lets you change if it honors that or not though, so you could check that.

    Also, http://www.mysqlperformanceblog.com/2007/09/12/query-profiling-with-mysql-bypassing-caches/

    E: MySQL – force not to use cache for testing speed of query has a couple of other solutions to the same problem.

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

Sidebar

Related Questions

I have a MySQL table on which I'm executing SELECT statements within Python. Is
All, Say I have the following Select statement in mySQL: $qry = Select filename
The following code is executing perfectly but there is a mySQL error somewhere that
I'm having some trouble with a MySQL Select Where statement that uses aliases and
I've been executing the following query in MySQL console: INSERT INTO pixel_window SELECT id
I just get a problem executing my sql statement, This is the Northwind db.
I had problem while executing this SQL statement in MySQL workbench. Can anyone point
I have a select query in mysql . On each execution of this query
What I want to do is while executing MySQL query, passing column data into
I have a MySQL/Slave Setup everyday we are executing queries on slave machine for

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.