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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T08:01:19+00:00 2026-05-26T08:01:19+00:00

I have 100,000 rows, and this query can sometimes take over 2 seconds. I’m

  • 0

I have 100,000 rows, and this query can sometimes take over 2 seconds. I’m trying to optimize it and had success with indexing the ‘created’ field with DESC. I’m trying to further optimise this query and am wondering if this query actually joins the ‘tracks’ on all 100,000 rows rather than just the 12 I actually need. Could this be causing a slower query?

Query:

SELECT `p`.`id` as performance_id, `p`.`performers`, `t`.`name` as track_name, `p`.`location`, `p`.`fms_id`
FROM (`performances` p)
JOIN `tracks` t ON `p`.`track` = `t`.`id`
WHERE (p.status = 1 OR (p.status != 2 && p.flagged < 3))
AND `p`.`prop` IN ('1', '2', '3', '4', '5', '6', '8', '10', '11', '13') 
AND `p`.`track` IN ('17', '9', '5', '15', '2', '3', '8', '6', '12', '4', '1') 
AND `p`.`type` IN ('1', '0', '2') 
ORDER BY `p`.`created` desc
LIMIT 0, 12

Explain:

1   SIMPLE  p   index   track,prop,flagged,status,type  created_desc    5   NULL    239 Using where
1   SIMPLE  t   eq_ref  PRIMARY PRIMARY 4   database_name.p.track   1   Using where
  • 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-26T08:01:19+00:00Added an answer on May 26, 2026 at 8:01 am

    Use temp table for list of tracks and join that temp table with main query instead of using ‘IN’ clause. Generally, avoid IN clauses, as the number of items within the list goes up the query plan might change.

    Creating index on ‘track’ column of performances table would give the desired behavior (query won’t join the ‘tracks’ on all 100,000 rows.)

    http://apps.ycombinator.com/item?id=2206406

    http://dbaspot.com/sybase/240012-plan-change-clause-number-set-elements-print.html

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

Sidebar

Related Questions

Guys I'm stumped on this one, I have a large table with 100,000 rows
If I have say for example 100,000 rows to insert/update/delete, and this number will
I have a large dataset (over 100,000 records) that I wish to load into
I have a bash file that contains wget commands to download over 100,000 files
I have a data set that looks like this: 000 100 200 300 010
I have a browse category query that im trying to optimize. Im ending up
I have a table with about 100.000 rows that used to look more or
I have a query which joins 6 tables, produces 800,000 rows, and inserts them
i have this table of comments (little over 1 milion rows) that gets around
We have a text file with about 100,000 rows, about 50 columns per row,

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.