其中rownum = 1查询在Oracle中花费的时间 [英] where rownum=1 query taking time in Oracle

查看:413
本文介绍了其中rownum = 1查询在Oracle中花费的时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试执行

select * from tableName where rownum=1

这个查询基本上是要获取表的列名.表中有超过一百万条记录.当我把上面的条件放在上面时,它花了很多时间来获取第一行.第一行.

This query is basically to fetch the column names of the table.There are more than million records in the table.When I put the above condition its taking so much time to fetch the first row.Is there any alternate to get the first row.

推荐答案

尝试一下:

select * from tableName where rownum<=1

有一些奇怪的ROWNUM错误,有时稍微更改一下查询即可解决.我以前见过这种情况,但是我无法重现.

There are some weird ROWNUM bugs, sometimes changing the query very slightly will fix it. I've seen this happen before, but I can't reproduce it.

以下是有关类似问题的一些讨论: http://jonathanlewis.wordpress.com /2008/03/09/cursor_sharing/ http ://forums.oracle.com/forums/thread.jspa?threadID = 946740&tstart = 1

Here are some discussions of similar issues: http://jonathanlewis.wordpress.com/2008/03/09/cursor_sharing/ and http://forums.oracle.com/forums/thread.jspa?threadID=946740&tstart=1

这篇关于其中rownum = 1查询在Oracle中花费的时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆