小编Jar*_*red的帖子

为什么这个oracle select语句需要几分钟才能完成?

这些表少于20个字段,属性有大约900万行,而列表有300万行,但这应该不是问题.这是数据库的用途......

listing_ids的类型为Number.到目前为止,我们最好的猜测是因为属性表有600万行,其中的listingids实际上并没有指向列表,Oracle花了很多时间寻找不存在的列表.这甚至有意义吗?

Select  count(*) 
from listings.rfs_listings listings  
    join listings.rfs_properties properties 
        on listings.listing_id= properties.listing_id        
where listings.display = 1  
    and properties.city= 'New York'
    and rownum <= 10;
Run Code Online (Sandbox Code Playgroud)

我对查询运行了解释计划并得到以下信息:

PLAN_TABLE_OUTPUT

Plan hash value: 772088252

-------------------------------------------------------------------------------------------------------------
| Id  | Operation                     | Name                        | Rows  | Bytes | Cost (%CPU)| Time     |
-------------------------------------------------------------------------------------------------------------
|   0 | SELECT STATEMENT              |                             |    10 |  4110 |   283   (0)| 00:00:04 |
|*  1 |  COUNT STOPKEY                |                             |       |       |            |          |
|   2 |   NESTED LOOPS                | …
Run Code Online (Sandbox Code Playgroud)

sql oracle query-performance

2
推荐指数
1
解决办法
1145
查看次数

标签 统计

oracle ×1

query-performance ×1

sql ×1