Mystery query
Why does the first query take so much longer to execute?
-- Main query: > 100 seconds.
SELECT
customers.CompanyName, customers.City, customers.Country
FROM
customers
WHERE
customers.CustomerID IN (SELECT
orders.customerid
FROM
orders
WHERE
orders.OrderID IN (SELECT
order_details.OrderID
FROM
order_details
WHERE
ProductID = 34));
-- Sub-query: < 2 seconds.
SELECT
orders.customerid
FROM
orders
WHERE
orders.OrderID IN (SELECT
order_details.OrderID
FROM
order_details
WHERE
ProductID = 34);
Subject
Written By
Posted
Mystery query
November 06, 2013 12:19AM
November 07, 2013 06:58AM
November 07, 2013 07:22PM
Sorry, you can't reply to this topic. It has been closed.
Content reproduced on this site is the property of the respective copyright holders.
It is not reviewed in advance by Oracle and does not necessarily represent the opinion
of Oracle or any other party.