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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T14:44:55+00:00 2026-06-14T14:44:55+00:00

Possible Duplicate: Join vs. subquery I need to work with a massive set of

  • 0

Possible Duplicate:
Join vs. subquery

I need to work with a massive set of data, but need to on occasion exclude records based on a condition.

Since the amount of data being checked against, and also the amount of data that will be returned is in the tens of thousands at a time, and this will be run frequently, I was wondering if anybody could shed some light on which approach is best in terms of speed and load so keep things running as smoothly as we can

SELECT a.* 
FROM table_a as a
LEFT JOIN table_b 
  ON table_b.a_id = a.id
WHERE table_b.status <> 'new'

OR

SELECT * 
FROM table_a
WHERE id NOT IN (
  SELECT a_id 
  FROM table_b
  WHERE status <> 'new'
) 
  • 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-14T14:44:57+00:00Added an answer on June 14, 2026 at 2:44 pm

    In most cases JOINs are faster than sub-queries and it is very rare for a sub-query to be faster.

    In JOINs RDBMS can create an execution plan that is better for your
    query and can predict what data should be loaded to be processed and
    save time, unlike the sub-query where it will run all the queries and
    load all their data to do the processing.

    The good thing in sub-queries is that they are more readable than
    JOINs: that’s why most new SQL people prefer them; it is the easy way;
    but when it comes to performance, JOINS are better in most cases even
    though they are not hard to read too.

    from here

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

Sidebar

Related Questions

Possible Duplicate: How to join data frames in R (inner, outer, left, right)? This
Possible Duplicate: Why is string concatenation faster than array join? Usually we need to
Possible Duplicate: Join lines based on pattern I have the following file: test one
Possible Duplicate: Performing Join Operation in Java, on a small sets of data retrieved
Possible Duplicate: SQL Query JOIN with Table If this is the data in TestingTable1
Possible Duplicate: how to join 2 tables I am very new to databases. I
Possible Duplicate: How do I join two lines in vi? I have the following
Possible Duplicate: What is the difference between Join and Union? How do we combine
Possible Duplicate: SQL left join vs multiple tables on FROM line? SELECT messages.message_title, messages.message_content,
Possible Duplicate: WHERE clause better execute before IN and JOIN or after Hello, someone

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.