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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 11, 20262026-05-11T00:52:40+00:00 2026-05-11T00:52:40+00:00

I have very simple select like this: SELECT * FROM table WHERE column1 IN

  • 0

I have very simple select like this:

SELECT * FROM table    WHERE column1 IN (5, 20, 30); 

on column1 is seted index, after explaining query is index used, all looks to be ok.

but if there are more than three values in range, like this:

  SELECT * FROM table        WHERE column1 IN (5, 20, 30, 40); 

index is not used and select runs thru all records. Am I doing something wrong? thanks

  • 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. 2026-05-11T00:52:41+00:00Added an answer on May 11, 2026 at 12:52 am

    How many rows does MySql think there are in the table?

    Mysql often (usually correctly!) assumes it will be quicker to do a sequential scan of the rows, rather than mess around with the more complex access via an index.

    It varies from DBMS to DBMS but the tradeoff point is somewhere about 30% of the rows.

    IE. If the optimiser expects more than 30% of the rows to be selected it will sequentially scan the whole table as this is usually faster than doing lots of direct access via indexes.

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

Sidebar

Related Questions

I have the beginnings of a query: SELECT tf_threads.*, tf_posts.* FROM tf_threads, tf_posts WHERE
I have a very simple update statement: UPDATE W SET state='thing' WHERE state NOT
This maybe very simple but I cant seem to sort it out on my
I have the following table structure: +----------+------------------------+------+-----+------------------------------------------+----------------+ | Field | Type | Null |
I'm using SQL Server 2005 and am logged in as sa . I would
Okay basically I am creating a stored procedure that will return data for our
When using the CTP 5 of Entity Framework code-first library (as announced here )
I learnt that I should Store UTC and Show in local time. How can
I'm new to Doctrine, and I'm trying to get my head around both Doctrine
I consider myself fairly competent in understanding and manipulating C-ish languages; it's not a

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.