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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T10:18:28+00:00 2026-05-25T10:18:28+00:00

I created a table which has close to 800,000 records. mysql> describe automation_search_test; +———-+———+——+—–+———+—————-+

  • 0

I created a table which has close to 800,000 records.

mysql> describe automation_search_test;
+----------+---------+------+-----+---------+----------------+
| Field    | Type    | Null | Key | Default | Extra          |
+----------+---------+------+-----+---------+----------------+
| id       | int(11) | NO   | PRI | NULL    | auto_increment | 
| filename | text    | YES  | MUL | NULL    |                | 
| site     | text    | YES  | MUL | NULL    |                | 
| script   | text    | YES  | MUL | NULL    |                | 
| station  | text    | YES  | MUL | NULL    |                | 
| result   | text    | YES  | MUL | NULL    |                | 
| failcode | text    | YES  | MUL | NULL    |                | 
| stbmodel | text    | YES  | MUL | NULL    |                | 
| rid      | text    | YES  | MUL | NULL    |                | 
| testdate | text    | YES  | MUL | NULL    |                | 
+----------+---------+------+-----+---------+----------------+

with an index on the filename column

mysql> show index from automation_search_test;
+------------------------+------------+---------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| Table                  | Non_unique | Key_name      | Seq_in_index | Column_name | Collation | Cardinality | Sub_part | Packed | Null | Index_type | Comment |
+------------------------+------------+---------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+
| automation_search_test |          0 | PRIMARY       |            1 | id          | A         |      767825 |     NULL | NULL   |      | BTREE      |         | 
| automation_search_test |          1 | ast_fname_idx |            1 | filename    | A         |      767825 |      255 | NULL   | YES  | BTREE      |         | 
+------------------------+------------+---------------+--------------+-------------+-----------+-------------+----------+--------+------+------------+---------+

With a WHERE condition, a query against the filename column uses the index without problem.

However, a simple SELECT query against the filename column ignores the index

mysql>  explain select filename from automation_search_test;
+----+-------------+------------------------+------+---------------+------+---------+------+--------+-------+
| id | select_type | table                  | type | possible_keys | key  | key_len | ref  | rows   | Extra |
+----+-------------+------------------------+------+---------------+------+---------+------+--------+-------+
|  1 | SIMPLE      | automation_search_test | ALL  | NULL          | NULL | NULL    | NULL | 767825 |       | 
+----+-------------+------------------------+------+---------------+------+---------+------+--------+-------+

How can I force the use of this 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-25T10:18:29+00:00Added an answer on May 25, 2026 at 10:18 am

    It sounds as if you are looking for a covering index. A covering index (one that can satisfy the entire query without going to the table) only works if it contains the complete data. In your example, the index on filename includes up to 255 characters. If the actual file name were longer, it would not contain the entire data, so it is not a covering index for that query.

    If filename had a type such as varchar(255), then it would use the index for the example query.

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

Sidebar

Related Questions

I have a custom table created which has a foreign constraint on the core_website
I have a SQL Server table which has 625 columns created with different datatypes
How can I delete a row from a table which it has been created
I have a table login2 in /data/data/sankalp.jain.shre/databases/loginfinal.db. The database has been created correctly which
The code below compiles/runs without errors. It created the db which has the table
Consider the following table which has the fields - id (int) and date_created (datetime):
I want to create JSF table which has select all button and check box
I'm trying to create an XML sitemap using CakePHP, from a table which has
So I've created a dbml in my project, which has three tables: Elements, ElementImages
I have a dynamically created table which in the last <td> there is a

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.