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

  • Home
  • SEARCH
  • 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 1054033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T17:20:33+00:00 2026-05-16T17:20:33+00:00

In MySQL, does putting SELECT foo increase in performance if foo is indexed? At

  • 0

In MySQL, does putting SELECT foo increase in performance if foo is indexed?

At RedditMirror.cc, I have a database with 1.2 million records in the GrabbedSites table, a number that increases by approx 500-2000 per day.

Early in my career, I was mentored that the only columns that should be indexed are those which you

  1. will do WHERE or JOIN SELECT/UPDATEs on in the future,
  2. need them to be UNIQUE data.

Because of that, GrabbedSites only has one key indexed (besides the primary key): categoryID, but 8 columns are queried.

The website receives dramatic bursts of flash traffic, sometimes over 100,000 unique visitors a day, and the DB becomes “taxed” at about 20% usage.

So I’m wondering, would there be a performance advantage in MySQL to adding indexes to all 8 frequently-queried columns??


Edit: Query is:

  SELECT url, 
         title, 
         published, 
         reddit_key, 
         UNIX_TIMESTAMP(last_fetched) last_fetched, 
         comment_link 
    FROM GrabbedSites 
   WHERE published BETWEEN DATE_SUB('2010-09-03', INTERVAL 1 DAY) 
                       AND '2010-09-03' 
ORDER BY published;

Only index is “published”.

Explain says: Using where; Using filesort

  • 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-16T17:20:34+00:00Added an answer on May 16, 2026 at 5:20 pm

    First thing to be aware of is that MySQL only uses one index per psuedo-SELECT (not statement) – when you view output of the SELECT using EXPLAIN, you’ll see which index was chosen per. EXPLAIN can only be run on SELECTS, so we have to assume that a DELETE/UPDATE is using the same plan when you swap out the syntax for SELECT…

    Most databases (embedded ones can be odd) to my knowledge support the use of indexes in the following clauses:

    • SELECT
    • JOIN (ANSI-92 syntax)
    • WHERE (because there’s both ANSI-89 and filteration here)
    • HAVING (WHERE equivalent, but unlike WHERE – allows aggregate use without needing subquery)
    • ORDER BY

    I’m not 100% on GROUP BY, so I’m omitting it for the time being.

    Ultimately, it’s the optimizers choice for what to use based on it’s algorithm and the statistics it has onhand. You can use the ANALYZE TABLE syntax to refresh the statistics (periodically, not constantly please).

    Addendum

    MySQL also limits the amount of space that for allocating indexes – 1,000 bytes for MyISAM tables, and 767 bytes for InnoDB tables. Because of MySQL only using one index per psuedo-SELECT, covering indexes (indexes that include more than one column) are a good idea but it really comes to testing the most common query & optimizing for it as best you can. The indexing priority should be:

    1. Primary key (somewhere in v5, index creating for the pk became automatic)
    2. Foreign keys (next most likely JOIN candidate
    3. Filtration criteria (assuming you have the space)
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 531k
  • Answers 531k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer $newText=str_replace(' ', ' + ', $_GET['search']); str_replace will replace the… May 16, 2026 at 11:54 pm
  • Editorial Team
    Editorial Team added an answer Use the date() method: datetime.datetime.now().date() May 16, 2026 at 11:54 pm
  • Editorial Team
    Editorial Team added an answer I don't have experience running Codeigniter on shared server hosting,… May 16, 2026 at 11:54 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I have a mysql database table filled with 1000+ records, lets say 5000 records.
Suppose I have a MySQL database named DB, and a table named ContactInfo. The
i am connecting to a mysql database through excel using odbc what does this
MySQL - Why does count() change the behavior of join I have a simple
I have a mysql database which I support using phpMyAdmin. The website this is
I know this is something of a classic question, but does the mysql/grails (deployed
I have a database that has multiple scripts/sites interacting with it in terms of
Today I learned this JavaScriptSerializer ser = new JavaScriptSerializer(); Foo foo = ser.Deserialize<Foo>(jsonSz); I
Below is just a mockup of 2 codes in php/mysql. The first one returns
So I've got a SQL statement that pared down looks something like this: SELECT

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.