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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T12:53:54+00:00 2026-06-10T12:53:54+00:00

I have a problem where my query is Using filesort , even though the

  • 0

I have a problem where my query is Using filesort, even though the field is indexed.

This is my query:

EXPLAIN
SELECT u.name, u.surname, u.id
FROM rw_users u
ORDER BY u.created DESC
LIMIT 4

This is the output:

id  select_type  table  type  possible_keys  key  key_len  ref  rows  Extra           
1   SIMPLE       u      ALL                                     9     Using filesort 

This is create table:

CREATE TABLE `rw_users` (
  `id` mediumint(8) unsigned NOT NULL AUTO_INCREMENT,
  `created` int(11) unsigned NOT NULL,
  `email` varchar(255) COLLATE utf8_swedish_ci NOT NULL,
  `password` char(64) CHARACTER SET utf8 COLLATE utf8_bin NOT NULL,
  `name` varchar(100) COLLATE utf8_swedish_ci NOT NULL,
  `surname` varchar(100) COLLATE utf8_swedish_ci NOT NULL,
  `premium` tinyint(1) unsigned NOT NULL DEFAULT '1' COMMENT 'level or premium membership (0 = standard)',
  PRIMARY KEY (`id`),
  UNIQUE KEY `email` (`email`),
  KEY `password` (`password`),
  KEY `created` (`created`),
  KEY `premuim` (`premium`),
  KEY `name_surname` (`name`,`surname`),
  CONSTRAINT `FK_rw_users` FOREIGN KEY (`premium`) REFERENCES `rw_premium` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=14 DEFAULT CHARSET=utf8 COLLATE=utf8_swedish_ci

What do I need to do to get rid of Using filesort? I tested on database (exactly the same table) with 118 rows and it still gives me Using filesort, so it can’t use it because its faster than using 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-06-10T12:53:55+00:00Added an answer on June 10, 2026 at 12:53 pm

    For the best performance for select queries add covering index. See here:

    ALTER TABLE rw_users ADD KEY ix1 (created, name, surname, id);
    

    for INNODB engine you don’t need to include id in index, check both indexes with EXPLAIN.

    ALTER TABLE rw_users ADD KEY ix1 (created, name, surname);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm using CodeIgniter (http://codeigniter.com/) and have a problem with an query: select * from
I have problem with my query on C, I’m using the oci8 driver. This
I have a strange problem. I do this query in a node.js server using
I have problem with optimize this query: SET @SEARCH = dokumentalne; SELECT SQL_NO_CACHE `AA`.`version`
I have a problem with the following Linq query using Entity Framework: from o
I have problem with this query: MERGE INTO qot USING dual ON (qot_id =
I have this query: SELECT p.prodno AS id, proddesc AS label FROM product p
I have a problem with a query using hibernate. The entity class EntityClass has
I have a problem with a search query I am using my data contains
I have a little problem with a query. I'm selecting data using the between

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.