---
title: "关于oralce大批量查询语句速度慢,IO占用高的问题"
author: "Carterslam"
date: "2011-08-31T16:49:58Z"
tags: []
categories: ["数据库"]
slug: "oralce-io"
draft: false
lastmod: "2011-08-31T16:49:58Z"
id: 1162577
url: "https://carterslam.iteye.com/blog/1162577"
---

今天项目中遇到一条sql语句,其中t_userdownreslog表数据4千万条,t_userinfo 数据2千万条.

修改前

```sql

select t.user_account username,
              t.mobile usermobile,
              t.user_id userid,
              u.down_type downtype,
              u.resourceid appid,           
              u.resourcename appname,
              u.package_id jarid      
          from t_userdownreslog u,t_userinfo t
        where u.transaction_id = '10111902201098785862'
          and t.user_id = u.user_id 
          and u.down_status=2 
          and u.tran_type=2;

```


修改后

```sql

select /*+FIRST_ROWS*/
              t.user_account username, 
              t.mobile usermobile,
              t.user_id userid,
              u.down_type downtype,
              u.resourceid appid,           
              u.resourcename appname,
              u.package_id jarid
          from t_userdownreslog u,t_userinfo t
        where u.transaction_id = '10111902201098785862'
          and t.user_id = u.user_id 
          and u.down_status=2  
          and u.tran_type=2;

```



多了个,/*+FIRST_ROWS*/