ITPub博客

首页 > 数据库 > Oracle > [20230103]COUNT STOPKEY operation.txt

[20230103]COUNT STOPKEY operation.txt

原创 Oracle 作者:lfree 时间:2023-01-31 20:27:15 0 删除 编辑

[20230103]COUNT STOPKEY operation.txt

--//链接:http://blog.tanelpoder.com/2010/10/25/count-stopkey-operation-the-where-rownum/
--//rownum限制仅仅显示2^32-1条,实际上12c版本已经修复了这个bug,通过例子验证.

1.环境:
SCOTT@test01p> @ver1
PORT_STRING                    VERSION        BANNER                                                                               CON_ID
------------------------------ -------------- -------------------------------------------------------------------------------- ----------
IBMPC/WIN_NT64-9.1.0           12.2.0.1.0     Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production              0

2.测试:
with sq as (select null from dual connect by level <= 2000)
select count(*)
from sq a, sq b, sq c;

  COUNT(*)
----------
8000000000

with sq as (select null from dual connect by level <= 2000)
select count(*)
from sq a, sq b, sq c
where rownum <= 8000000000;

  COUNT(*)
----------
8000000000

--//11g下重复测试:
3.环境:
SCOTT@book> @ ver1
PORT_STRING                    VERSION        BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx            11.2.0.4.0     Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production

4.测试:
with sq as (select null from dual connect by level <= 2000)
select count(*)
from sq a, sq b, sq c;

  COUNT(*)
----------
8000000000

with sq as (select null from dual connect by level <= 2000)
select count(*)
from sq a, sq b, sq c
where rownum <= 8000000000;
  COUNT(*)
----------
4294967295

--//很明显11.2.0.4存在这个bug.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2933490/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7970344