What is better? Subqueries or inner joining ten tables?

后端 未结 5 1951
青春惊慌失措
青春惊慌失措 2021-02-12 17:49

An old system have arrived on our office for some changes and fix, but it is also suffering from performance issues. We don\'t know exactly what is the source of this slowness.<

5条回答
  •  孤独总比滥情好
    2021-02-12 18:04

    If I understand your question correctly, you are starting an operation to rewrite some of your SQL statements because you THINK there might be an issue with them.

    My advice is to stop and first start to determine where your time is currently being spent. Only after you have found that it's in the queries with those scalar subselects AND it's because of those scalar subselects, you should be rewriting them. Until then: start tracing and examining.

    Here are two threads from OTN that are used to guide people with performance problems:

    http://forums.oracle.com/forums/thread.jspa?messageID=1812597 http://forums.oracle.com/forums/thread.jspa?threadID=863295

    Regards,
    Rob.

    And: because of scalar subquery caching, your original query might be a lot faster than a rewritten query using joins.

提交回复
热议问题