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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T11:46:40+00:00 2026-06-18T11:46:40+00:00

I have a slow query logged in /var/log/mysql/mysql-slow.log, run from php using PDO, and

  • 0

I have a slow query logged in /var/log/mysql/mysql-slow.log, run from php using PDO, and when I copy-paste it in mysql-client, I get the answer instantaneously, even after restarting mysql. How do you explain that?

Here is the query:

SELECT many_fields FROM some_table u WHERE (u.created_at >= ‘2011-11-01’ AND u.created_at <= ‘2012-02-01’ AND u.valid IS TRUE AND u.test IS FALSE);

Here is the explain of the query:

+----+-------------+-------+------+---------------+------+---------+------+-------+-------------+
| id | select_type | table | type | possible_keys | key  | key_len | ref  | rows  | Extra       |
+----+-------------+-------+------+---------------+------+---------+------+-------+-------------+
|  1 | SIMPLE      | u     | ALL  | NULL          | NULL | NULL    | NULL | 86460 | Using where |
+----+-------------+-------+------+---------------+------+---------+------+-------+-------------+

Here is the output of SHOW FULL PROCESSLIST when running the php script:

+-----+---------+-----------+-----------------------+---------+------+-------+-----------------------+
| Id  | User    | Host      | db                    | Command | Time | State | Info                  |
+-----+---------+-----------+-----------------------+---------+------+-------+-----------------------+
|   9 |some_user| localhost | some_db               | Query   |    0 | NULL  | SHOW FULL PROCESSLIST |
| 187 |some_user| localhost | some_db               | Sleep   |    6 |       | NULL                  |
+-----+---------+-----------+-----------------------+---------+------+-------+-----------------------+
  • 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-18T11:46:41+00:00Added an answer on June 18, 2026 at 11:46 am

    As you said in your reply to my comment, you are logging queries that don’t use indexes. This query is not using an index, so it gets logged with the slow queries. Queries that are logged because they don’t use an index ignore the minimum execution time when being logged.

    Edit: The Time column in SHOW FULL PROCESSLIST shows the time it has been in its current state, which is usually set to Sleep when a query finishes so that time is not reliable for timing queries. To get a more reliable timing of the query, you’d need to use profiling or some other way of benchmarking that works more directly with the query.

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

Sidebar

Related Questions

We have MySQL slow query logs from a suite of applications, mostly in Ruby,
I'm looking at the slow query log from a drupal-based webapp, and have lines
I have got quite slow query (actually this is data loading from mysql.dump). Now
I have a spring based webapp using Hibernate to query mysql. When I enable
I have a slow MySQL query in my application that I need to re-write.
I am trying to write a script to parse the MySQL slow query log.
I have an extensive slow query log which was running for a few weeks.
I have a query that according to my slow query log it's a bit
This query appears in mysql slow query log: it takes 11 seconds. INSERT INTO
Hey I have a very slow MySQL query. I'm sure all I need to

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.