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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T06:45:37+00:00 2026-05-27T06:45:37+00:00

This query takes 16 seconds to run SELECT WO.orderid FROM WebOrder as WO INNER

  • 0

This query takes 16 seconds to run

SELECT 
    WO.orderid
FROM 
    WebOrder as WO
    INNER JOIN Addresses AS A ON WO.AddressID = A.AddressID
    LEFT JOIN SalesOrders as SO on SO.SO_Number = WO.SalesOrderID   

If I comment out either of the joins, it runs in a small fraction of a second. Example:

SELECT 
    WO.orderid
FROM 
    WebOrder as WO
    INNER JOIN Addresses AS A ON WO.AddressID = A.AddressID
    -- LEFT JOIN SalesOrders as SO on SO.SO_Number = WO.SalesOrderID    

or

SELECT 
    WO.orderid
FROM 
    WebOrder as WO
    -- INNER JOIN Addresses AS A ON WO.AddressID = A.AddressID
    LEFT JOIN SalesOrders as SO on SO.SO_Number = WO.SalesOrderID

Notes

  • There exists about 40,000 records each in tables SalesOrders and Adddresses.
  • I have indexes or PKeys on all fields used in the ON clauses.

Execution Plan for the slow version (SalesOrders Join commented out)

enter image description here

Execution Plan for fast version

enter image description here

Why do these joins when used in conjunction with one another cause this to go from ~0.01 seconds to 16 seconds?

  • 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-27T06:45:38+00:00Added an answer on May 27, 2026 at 6:45 am

    Your execution plan doesn’t show any expensive operations, I would try to following to troubleshoot bad performance:

    • Rebuild Indexes
    • Update Stats
    • DBCC FREEPROCCACHE

    Personally I wouldn’t expect the latter to do anything — it looks like you have a sensible query plan as it is.

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

Sidebar

Related Questions

This query run alone: SELECT -- lots of columns FROM table1 t1 LEFT JOIN
Have follow query: SELECT tbl_yaca_sites.`id_site` FROM `tbl_yaca_sites` INNER JOIN `tbl_relation` ON tbl_relation.id_website = tbl_yaca_sites.id_site
I have the following MySql query: select t1.* from Table1 t1 inner join Table2
This query takes a split second select * from tbl1 limit 0,1 This query
Take this query: SELECT * FROM MyTable WHERE MyColumn = 'SomeValue' ORDER BY SomeFakeQualifier.MyColumn
i got this SQL query where post_title taken from $_GET $sql = SELECT ID
This query works great: var pageObject = (from op in db.ObjectPermissions join pg in
This query works: item = db.GqlQuery(SELECT * FROM Item WHERE CSIN = 13)[0] although
Query below takes 20 seconds to run. user_table has 40054 records. other_table has 14000
I am executing a mysql SELECT statement which takes 30 seconds to run the

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.