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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:05:20+00:00 2026-05-26T01:05:20+00:00

I currently have a summary table to keep track of my users’ post counts,

  • 0

I currently have a summary table to keep track of my users’ post counts, and I run SELECTs on that table to sort them by counts, like WHERE count > 10, for example. Now I know having an index on columns used in WHERE clauses speeds things up, but since these fields will also be updated quite often, would indexing provide better or worse performance?

  • 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-26T01:05:21+00:00Added an answer on May 26, 2026 at 1:05 am

    If you have a query like

    SELECT count(*) as rowcount
    FROM table1
    GROUP BY name
    

    Then you cannot put an index on count, you need to put an index on the group by field instead.

    If you have a field named count

    Then putting an index in this query may speed up the query, it may also make no difference at all:

    SELECT id, `count`
    FROM table1
    WHERE `count` > 10
    

    Whether an index on count will speed up the query really depends on what percentage of the rows satisfy the where clause. If it’s more than 30%, MySQL (or any SQL for that matter) will refuse to use an index.
    It will just stubbornly insist on doing a full table scan. (i.e. read all rows)
    This is because using an index requires reading 2 files (1 index file and then the real table file with the actual data).
    If you select a large percentage of rows, reading the extra index file is not worth it and just reading all the rows in order will be faster.

    If only a few rows pass the sets, using an index will speed up this query a lot

    Know your data

    Using explain select will tell you what indexes MySQL has available and which one it picked and (kind of/sort of in a complicated kind of way) why.

    See: http://dev.mysql.com/doc/refman/5.0/en/explain.html

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

Sidebar

Related Questions

We are currently using a summary table that aggregates information for our users on
I have a report that pulls information from a summary table and ideally will
In summary: I have a mysql db table that holds pdf objects. When a
I currently have an MS Access application that connects to a PostgreSQL database via
I currently have a DetailsView in ASP.NET that gets data from the database based
I currently have this code: /// <summary> /// This is an ineffecient method of
I currently have a class that uses the KeyValuePair with List to store a
I have a site that I am currently working on in ASP.NET 2.0 using
Summary I'm currently writing an application where I have located my SQL instructions into
I'm trying to create a way to have users comment on my posts. Currently

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.