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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:42:16+00:00 2026-05-27T20:42:16+00:00

I am doing a very simple select from a table like SELECT column FROM

  • 0

I am doing a very simple select from a table like

SELECT column FROM table WHERE id=5;

id is a primary key and all the tables are using innodb.

When I enable profiling in phpmyadmin and run this query I see this :

Status                           Time
starting                         0.000025
checking query cache for query   0.000034
checking permissions             0.000004
Opening tables                   0.000022
System lock                      0.000004
Table lock                       0.000022
init                             0.000016
optimizing                       0.000008
statistics                       0.000030
preparing                        0.000022
executing                        0.000003
Sending data                     0.000009
end                              0.000002
query end                        0.000003
freeing items                    0.000061
storing result in query cache    0.000005
logging slow query               0.000002
cleaning up                      0.000002

The second time I run the same query I get this since the query is cached:

Status                           Time
starting                         0.000022
checking query cache for query   0.000005
checking privileges on cached    0.000003
checking permissions             0.000020
sending cached result to clien   0.000055
logging slow query               0.000002
cleaning up                      0.000002

Why is a simple select query like this locking the table?

  • 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-27T20:42:16+00:00Added an answer on May 27, 2026 at 8:42 pm

    Please keep in mind that the primary key is a clustered index (called gen_clust_index). There is a possiblility of a Shared Index Lock hitting the index page where id=5 resides.

    Exclusive Index Locks and Shared Index Locks try to coexist in InnoDB as best as possible to accommodate

    • transactions
    • isolation levels
    • ACID compliance
    • MVCC

    Try running SHOW ENGINE INNODB STATUS\G and look for such locks.

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

Sidebar

Related Questions

I have very simple select like this: SELECT * FROM table WHERE column1 IN
I have the following PHP code doing a very simple select into a table.
I'm doing a very simple YQL statement: select * from xml where url=http://www.wowhead.com/item=50278&xml The
I am doing very simple int division and I am getting odd results. This
I have a very simple CLR Function for doing Regex Matching public static SqlBoolean
I find it very frustrating doing web development with Maven & Jetty using Eclipse,
I'm very new to joins, so far I've been doing relatively simple joins but
I have a very simple table structure here. Just a list of words related
Hi I'm building a very simple search system using ASP.NET MVC. I had it
I've got a very simple table which stores Titles for people (Mr, Mrs, etc).

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.