orderid, customerid are PK. SELECT order.orderid, customer.customerid, customer.name, customer.address1, customer.address2, customer.city, customer.state, customer.city, customer.pincode, customer.totalsales FROM customer, order WHERE order.customerid = customer.customerid AND customer.customerid > 10 and customer.customerid < 20000 AND order.status = 'CLOSED' ORDER BY customer.name DESC; which part of the query / which operation takes max time of execution? - prat.
Doing an explain plan will give you the best answer to your question as you will get actual numbers to compare. However not knowing more than just the query and the two PKs, I'd say the two places that take the longest are: AND order.status = 'CLOSED' ORDER BY customer.name DESC; 1. If status does not have an index, then this will cause a table scan. 2. Order by always takes time, an index on Name will help. Hope that helps. Mark