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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T23:14:04+00:00 2026-05-27T23:14:04+00:00

I have a table that contain one primary key. When I run EXPLAIN SELECT

  • 0

I have a table that contain one primary key.
When I run

EXPLAIN SELECT * FROM news ORDER BY id ASC LIMIT 29

Mysql returns

id  select_type     table   type    possible_keys   key     key_len     ref     rows    Extra
1   SIMPLE           news    ALL      NULL           NULL    NULL      NULL     640     Using filesort

But by EXPLAIN SELECT *
FROM news
ORDER BY id ASC
LIMIT 28

it returns

id  select_type     table   type    possible_keys   key     key_len     ref     rows    Extra
1   SIMPLE          news    index   NULL           PRIMARY  4          NULL     28   

SHOW INDEX FROM news ;

Table, Non_unique, Key_name, Seq_in_index, Column_name, Collation, Cardinality, Sub_part, Packed, Null, Index_type, Comment  
'news', 0, 'PRIMARY', 1, 'id', 'A', 640, , '', '', 'BTREE', ''
'news', 1, 'tarix', 1, 'tarix', 'A', 106, , '', '', 'BTREE', ''
'news', 1, 'yayindil', 1, 'yayin', 'A', 3, , '', '', 'BTREE', ''
'news', 1, 'yayindil', 2, 'dil', 'A', 7, , '', '', 'BTREE', ''

I checked it on other tables, they work fine also on limit 4000. What is going wrong? Why only under 29 limitations use indexes?

  • 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-27T23:14:04+00:00Added an answer on May 27, 2026 at 11:14 pm

    The optimiser is trying to select the cheapest execution path. With only 640 rows in the table it isn’t strange that the optimiser chooses a full scan. Load the table with 40000 rows and you will find that you have to increase the limit (probably to around 2000) before a full table scan is chosen.

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

Sidebar

Related Questions

I have one mysql table 'alfa' that will contain the primary key of another
I have data from a table in a database (string) that contain text and
I have an SQL Azure database with a table that has JobId primary key.
I have one table that contain lots of records and I want to update
Here is my situation: I have one table that contains a list of drugs
I have table that contain date and time field. id|date|time ========= 1|01/01/2001|10:45 2|01/02/2002|11:45 3|01/03/2003|12:45
I have two functions to add and remove table rows that contain a form
Another basic Rails question: I have a database table that needs to contain references
Say I have a result set that can contain one or more values, but
I have one table named tblm_customer . It contain field named firstname and lastname

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.