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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:09:29+00:00 2026-06-09T19:09:29+00:00

I have 30 millions records and one field (updated) is a tinyint(1) with an

  • 0

I have 30 millions records and one field (updated) is a tinyint(1) with an index.

If I run:

SELECT * FROM  `table` WHERE `updated` = 1

It will take an increasingly long time depending on how many are set to 1.
If it is say 10,000 it will be quite fast about 1 second. However if there is say 1 million it takes a couple of minutes.

Isn’t the index suppose to make this fast?

When I run the same query on a non-indexed field that is similar only it is int(1) it performs the same as the indexed field.

Any ideas as to why this would be? is tinyint bad?

  • 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-09T19:09:30+00:00Added an answer on June 9, 2026 at 7:09 pm

    In general, using a binary column for an index is not considered a good idea. There are some cases where it is okay, but this is generally suspect.

    The main purpose of an index is to reduce the I/O of a query. The way your query is expressed, it requires both the original data (to satisfy “select *”) and the index (for the where clause).

    So, the database engine will go through the index. Each time it finds a matching record, it brings the page into member. You have an I/O hit. Because your table is so large, the page probably was not seen already, so there is a real I/O hit.

    Interestingly, your experience supports this. 10,000 rows is about one second. 100 times as many rows (one million) is about 100 seconds. You are witnessing linearity in performance.

    By the way, the query would be faster if you did “select update” instead of “select *”. This query could be satisfied only from the index. If you have an id column, you could create the index on (update, id), and then do “select id” for performance.

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

Sidebar

Related Questions

I have a SQL Server 2008 database with millions of records. One field has
I have a table that has millions of records and we are looking at
I have a table with 80 millions of records. The structure of the table:
I have a table now containing over 43 million records. To execute SELECT ,
I have a table with 15,000,000 records. These records can be related to one-another
I have a completely blank custom table (DatabaseLogFixLog) with only one field/column called refRecId.
I have two tables with a many-to-one relationship. (Oracle) **Table: PARENT** Field: A (PK)
I have a large table (60+) millions of records. I'm using PHP script to
I have a table with 42 million records. 32 million have a null value
I have about 1 million records in my contact table in the DB, now

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.