暂无图片
暂无图片
暂无图片
暂无图片
暂无图片

从oracle数据库检索数据所需的时间

ASKTOM 2019-08-23
246

问题描述

从包含10m条记录的数据库中检索信息需要多少时间,并且该表包含四列

专家解答

这是一个非常松散的问题,因为它取决于很多事情 .... 但这里有一个简单的例子是在一台3岁的笔记本电脑上完成的

SQL> create table t 
  2  as select rownum x1,rownum x2,rownum x3,rownum x4
  3  from ( select 1 from dual connect by level <= 10000 ),
  4       ( select 1 from dual connect by level <= 1000 );

Table created.

-- scanning but not fetching all the rows

SQL>
SQL> 
SQL> set timing on
SQL> select max(x1) from t;

   MAX(X1)
----------
  10000000

Elapsed: 00:00:00.72

-- fetching every row back to the calling environment

SQL> set timing on
SQL> begin
  2    for i in ( select * from t )
  3    loop
  4       null;
  5    end loop;
  6  end;
  7  /

PL/SQL procedure successfully completed.

Elapsed: 00:00:11.45
复制


文章转载自ASKTOM,如果涉嫌侵权,请发送邮件至:contact@modb.pro进行举报,并提供相关证据,一经查实,墨天轮将立刻删除相关内容。

评论