易截截图软件、单文件、免安装、纯绿色、仅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 server数据库的硬盘备份地址

写了一个小程序,使用了sql server 2005数据库,当时该数据库放到了C:\Program Files\Microsoft SQL Server\MSSQL.4\MSSQL\Data下面,但是现在觉得不方便,想把它转移到我这个网站代码所在的那个目录,比如d:\network\app_data下面,请问怎么转过去,谢谢?
还有一个问题,就是我看C:\Program Files\Microsoft SQL Serve ......

特殊SQL语句

1.查询连接到某数据库的连接数
   select   count(*)   as   连接数   from   master..sysprocesses   where   db_name(dbid)='数据库名' ......

linq to sql 中的类型强传解决方案

 List<Class1> li = dc.Table_1.Where(item => item.id > 1).Cast<Class1>().ToList();
Table_1 为自动生成类, class1为自定义类,属性名称都是一样的,要能实现上面的语句,必须有几个条件
Table_1 需要继承class1,可以通过partial类来实现
Table_1  属性加override
class1里面的属性要是vir ......

sql调优之 寻找我们最感兴趣的语句

Tuning an Application / Reducing Load
If your whole application is performing suboptimally, or if you are attempting to
reduce the overall CPU or I/O load on the database server, then identifying
resource-intensive SQL involves the following steps:
1. Determine which period in the day you would ......

常用的WORDPRESS 的SQL语句


下面所有的SQL语句都是针对前缀为wp_的表,如果你的表前缀不是wp_,请做相应的修改
1.更改wordpress安装和首页地址
如果你更换域名或者把wordpress的安装目录进行了变动就需要进行修改,
UPDATE wp_options SET option_value = replace(option_value, ‘旧网址’, ‘新网址’) WHERE option_name ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号