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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T17:15:17+00:00 2026-05-21T17:15:17+00:00

From here: http://dev.mysql.com/doc/refman/5.0/en/order-by-optimization.html In some cases, MySQL can use an index to satisfy an

  • 0

From here: http://dev.mysql.com/doc/refman/5.0/en/order-by-optimization.html

In some cases, MySQL can use an index to satisfy an ORDER BY clause without doing any extra sorting.

I thought indexes helped with retrieving specific pieces of data (like the indexes in array) giving you a O(1) instead of O(n) when indexed. But when sorting, I assumed they use whatever O(nlogn) or something algorithm based on the sorting column, however apparently indexing the columns you sort by can decrease the amount of work involve.

How does this work? ( I am not sure if this is a general SQL thing or a MySQL thing either )

  • 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-21T17:15:18+00:00Added an answer on May 21, 2026 at 5:15 pm

    A simple answer: Generally, indexes are themselves stored in sorted order (otherwise, using an index to quickly find a record would be extremely difficult!) Hence, “in some cases” (when an ORDER BY matches the sort order of an index), the data can be returned via its index order, “without doing any extra sorting”.

    Further: As @Will A’s answer reminded me, you may wish to learn about covering indexes, which extend this concept.

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

Sidebar

Related Questions

Here is an example of polymorphism from http://www.cplusplus.com/doc/tutorial/polymorphism.html (edited for readability): // abstract base
I'm downloaded the code from John Papa's book here: http://silverlight-data.com/ and am sucessfully running
I am trying to understand how it's possible to use http://code.google.com/p/django-simple-captcha/ with django comments.
I have got the following code from here to read an Excel file using
I am bringing out a separate question from here . It really confused me.
I'm trying to the the flv Flash player from here in a windows forms
From reading here and around the net, I'm close to assuming the answer is
Here's one from the No question's too dumb department: Well, as the subject says:
Here's the code from the ascx that has the repeater: <asp:Repeater ID=ListOfEmails runat=server >
Here is a sample from Kernighan & Ritchie's The C Programming Language: int getline(char

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.