易截截图软件、单文件、免安装、纯绿色、仅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 查询慢的48个原因分析

查询速度慢的原因很多,常见如下几种:
  1、没有索引或者没有用到索引(这是查询慢最常见的问题,是程序设计的缺陷)
  2、I/O吞吐量小,形成了瓶颈效应。
  3、没有创建计算列导致查询不优化。
  4、内存不足
  5、网络速度慢
  6、查询出的数据量过大(可以采用多次查询,其他的方法降低数据量)
  7、 ......

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 ......

常用的WORDPRESS 的SQL语句


下面所有的SQL语句都是针对前缀为wp_的表,如果你的表前缀不是wp_,请做相应的修改
1.更改wordpress安装和首页地址
如果你更换域名或者把wordpress的安装目录进行了变动就需要进行修改,
UPDATE wp_options SET option_value = replace(option_value, ‘旧网址’, ‘新网址’) WHERE option_name ......

SQl Cookbook学习笔记

1.select  * from A where a.a='a';
  执行顺序 先执行 from 在执行 where 中的东西 ,最后执行 select
2.列值连接 db2 oracle ||  , mysql concat(column1,'sss',column2) sqlServler使用+连接;
3. case when  表达式 then ''
           ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号