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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:50:18+00:00 2026-06-13T23:50:18+00:00

I have a serious issue with WhERE IN () condition in mysql query. I

  • 0

I have a serious issue with WhERE IN () condition in mysql query. I am fetching RESULT fron two tables which have not more than 10 fields. I created primary fields in both.

I need to use WHERE IN () to see logged_in IDs which can be more than 500 or long. So it creates a heavy query and it fetches records too slow. When there are logged_in IDs are less than 20 or so its fine but when they are more than 50 or 100 or more it becomes more slow and takes much time to process.

So, my problm is how to make it fast? Am i using wrong technique? I mean should I use something else on place of where IN()? Any idea would be highly appreciated.

SELECT subscriber. * , track . * 
FROM track, subscriber 
WHERE track.type =1 AND 
      track.logged_in IN ( 2803, 2806, 54, 54, 64, 383, 833, 2808, 2809, 2810, 56, 2811, 2812, 2813, 2814, 2815, 2816, 2817, 2818, 2819, 2820, 2821, 2822, 2823, 2824, 2825, 2826, 2827, 2828, 2829, 2830, 2831, 2832 ) AND 
      subscriber.post_id = track.post_id AND 
      track.nmade = subscriber.nmade AND 
      subscriber.userid =  '54' 
ORDER BY track.date_created DESC 
LIMIT 5
  • 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-13T23:50:19+00:00Added an answer on June 13, 2026 at 11:50 pm

    The IN clause in mysql isn’t famous by its speed … maybe if you create a temporal table with the id’s that you want and you do a JOIN with track table the operation will be faster.

    The temporaries tables are per session, therefore you don’t need spend effort dropping them after use, when you close the connection to mysql, they will be removed by the mysql.

    Anyway if you want have reasonable performance in the JOIN operation you will need index the logged_in field.

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

Sidebar

Related Questions

I have a serious performance issue about mysql. The storage engine is myisam. I
I have a serious issue with crystal reports. when run in my development environment
I have a serious issue with Liferay 6.1 themes , I know well about
Hi Everyone I m dealing with some serious issue in django-admin.I have created models
This issue is giving me serious headaches, I don't have a clue what's going
I have a serious issue, I want to boot my stm32 discovery board (STM32L152RBT6)
We have a serious issue while saving images from a flex editor Our editor
I have a serious issue, my harddisk crashed yesterday , and i had tons
I am having a serious issue I can not figure out. I am trying
I have a serious issue. When calling the requestLocationUpdates function in Android, the GPS

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.