---
title: "Oracle 中对于查询语句的优化"
author: "llhdf"
date: "2009-08-20T16:37:54Z"
tags: []
slug: "oracle"
draft: false
lastmod: "2009-08-20T16:37:54Z"
id: 453735
url: "https://llhdf.iteye.com/blog/453735"
---

产品开发过程中，遇见了查询数据很慢的问题。

 

例如以下语句：

 

select * from tab1 a left join  tab2 b on a.id=b.id and a.customer='11' and a.isdelete='0' and b.lang='1'

 

tab1 中存放数据 5000 条 数据库 tab2 数据为10000条

 

查询时间为：20秒

 

优化后SQL语句  
select * from a left join b on a.id=b.id where a.customer='11' and a.isdelete='0'  and b.lang='1'

 

查询时间：1 秒