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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:44:22+00:00 2026-05-14T02:44:22+00:00

I have a MySQL InnoDB table with a status column. The status can be

  • 0

I have a MySQL InnoDB table with a status column. The status can be ‘done’ or ‘processing’. As the table grows, at most .1% of the status values will be ‘processing,’ whereas the other 99.9% of the values will be ‘done.’ This seems like a great candidate for an index due to the high selectivity for ‘processing’ (though not for ‘done’). Is it possible to create an index for the status column that only indexes the value ‘processing’? I do not want the index to waste an enormous amount of space indexing ‘done.’

  • 1 1 Answer
  • 1 View
  • 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-14T02:44:23+00:00Added an answer on May 14, 2026 at 2:44 am

    I’m not aware of any standard way to do this but we have solved a similar problem before by using two tables, Processing and Done in your case, the former with an index, the latter without.

    Assuming that rows don’t ever switch back from done to processing, here’s the steps you can use:

    1. When you create a record, insert it into the Processing table with the column set to processing.
    2. When it’s finished, set the column to done.
    3. Periodically sweep the Processing table, moving done rows to the Done table.

    That last one can be tricky. You can do the insert/delete in a transaction to ensure it transfers properly or you could use a unique ID to detect if it’s already transferred and then just delete it from Processing (I have no experience with MySQL transaction support which is why I’m also giving that option).

    That way, you’re only indexing a few of the 99.9% of done rows, the ones that have yet to be transferred to the Done table. It will also work with multiple states of processing as you have alluded to in comments (entries are only transferred when they hit the done state, all other states stay in the Processing table).

    It’s akin to having historical data (stuff that will never change again) transferred to a separate table for efficiency. It can complicate some queries where you need access to both done and non-done rows since you have to join two tables so be aware there’s a trade-off.

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

Sidebar

Related Questions

I have a MySQL-InnoDB table with 350,000+ rows, containing a couple of things like
I have a MySQL InnoDB table on a RedHat Enterprise Linux 4 server, and
I have a MySQL InnoDB table with 238 columns. 56 of them are TEXT
I have a MySQL InnoDB table laid out like so: id (int), run_id (int),
How can I add index to an 18 GB innodb mysql table without affecting
MySQL 4.0 doesn't have information_schema and 'show table status from db ' only gives
Here's some background info. I have three MySQL tables (all InnoDB). The first table
I have a table in my MySQL ( InnoDB ) full with user items.
I have a question about MySQL InnoDB. For example: I have the following table
I have a MySQL InnoDB table, events , with 3 rows: event_id ---> int

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.