易截截图软件、单文件、免安装、纯绿色、仅160KB

PL/SQL Best Practice On BULK COLLECT

On BULK COLLECT
By Steven Feuerstein Oracle ACE
Best practices for knowing your LIMIT and kicking %NOTFOUND
I have started using BULK COLLECT whenever I need to fetch large volumes of data. This has caused me some trouble with my DBA, however. He is complaining that although my programs might be running much faster, they are also consuming way too much memory. He refuses to approve them for a production rollout. What's a programmer to do?
The most important thing to remember when you learn about and start to take advantage of features such as BULK COLLECT is that there is no free lunch. There is almost always a trade-off to be made somewhere. The tradeoff with BULK COLLECT, like so many other performance-enhancing features, is "run faster but consume more memory."
Specifically, memory for collections is stored in the program global area (PGA), not the system global area (SGA). SGA memory is shared by all sessions connected to Oracle Database, but PGA memory is allocated for each session. Thus, if a program requires 5MB of memory to populate a collection and there are 100 simultaneous connections, that program causes the consumption of 500MB of PGA memory, in addition to the memory allocated to the SGA.
Fortunately, PL/SQL makes it easy for developers to control the amount of memory used in a BULK COLLECT operation by using the LIMIT clause.
Suppose I need to retrieve all the rows from the employees table and then perform some compensation analysis on each row. I can use BULK COLLECT as follows:
PROCEDURE process_all_rows
IS
   TYPE employees_aat
   IS TABLE OF employees%ROWTYPE
      INDEX BY PLS_INTEGER;
   l_employees employees_aat;
BEGIN
   SELECT *
   BULK COLLECT INTO l_employees
      from employees;
   FOR indx IN 1 .. l_employees.COUNT
 &nbs


相关文档:

SQL数据库连接语句

一般的远程访问的写成这样:
Data Source=IP;Initial Catalog=数据库名;UserID=用户名;Password=密码
本地访问的写成这样:
Data Source=(local);Initial Catalog=数据库名;UserID=用户名;Password=密码
如果是本地的,通过windows组件验证的(也就是没有用户名,密码的)写成这样:
Data Source=(local);Initial Cata ......

SQL命令大全 中英文对照

[code=SQL][/code]
--语 句 功 能 
--数据操作 
SELECT --从数据库表中检索数据行和列 
INSERT --向数据库表添加新数据行 
DELETE --从数据库表中删除数据行 
UPDATE --更新数据库表中的数据 
--数据定义 
CREATE TABLE --创建一个数据库表 
DROP TABLE --从数据 ......

SQL Server CE服务器端和客户端安装配置学习笔记

 
SQL Server 2005 CE开发环境介绍:
       最近学习使用SQL Server 2005 Compact Edition进行数据存储,在学习的过程中发现,使用SQL Server2005 management Studio创建数据库时,在“服务器类型”下拉列表中没有“SQL Server Compact Edition”选项。因为文章 ......

SQL子查询实例

子查询是在一个查询内的查询。子查询的结果被DBMS使用来决定包含这个子查询的高级查询的结果。在子查询的最简单的形式中,子查询呈现在另一条SQL语句的WHERE或HAVING子局内。 
    列出其销售目标超过各个销售人员定额综合的销售点。
SELECT CITY
from OFFICES
WHERE TARGET&nbs ......

在Windows2003下安装SQL Server 2000

     在windows2003下面安装SQL Server2000,会提示windows不支持SQL Server2000的版本,安装后,在本机是可以正常使用的,但是无法连接到其他SQL Server2000的服务器,也无法通过其他机器上的SQL Server2000访问,必须安装SQL Server2000sp3或sp4补丁才可以。其实用SQL Server2005就没这么麻烦了。 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号