Oracle 查询优化(使用连接和子选择)
我想优化下面的查询。我没有优化技术方面的专业知识。 请建议我一些可以帮助我优化以下查询的内容:
SELECT
ad.towncity,
ad.state,
FROM promptdescription pd,
osquestion osq,
WHERE acc.status = 1
AND acc.customer_id = con.customer_id
ap.os_id
AND NOT EXISTS (SELECT 1
FROM osquestion osq2,
orderedproduct op3
WHERE osq2.ext_quest_id = pd.id
AND osq2.question_id > osq.question_id
I want to Optimize the Query below. I don't have expertise on optimization techniques.
Please suggest me something which can help me to Optimize the query below :
SELECT
ad.towncity,
ad.state,
FROM promptdescription pd,
osquestion osq,
WHERE acc.status = 1
AND acc.customer_id = con.customer_id
ap.os_id
AND NOT EXISTS (SELECT 1
FROM osquestion osq2,
orderedproduct op3
WHERE osq2.ext_quest_id = pd.id
AND osq2.question_id > osq.question_id
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
首先确定查询的所有表中的所有 PK 字段。
然后根据oracle db表中创建的PK字段的顺序更改where条件。
First of All Identify all the PK fields in all the tables of the query.
Then change your where condition according to the sequence of PK fields created in the oracle db table.
首先,您的查询相当于:
备注:
我可以将第一部分重写为:
NOT EXISTS 部分仍有待改进。
First, your query is equivalent to:
Remarks :
I could rewrite the first part as:
The NOT EXISTS part still remains to be improved.