db2 v9.7 排序的限制在哪里?

dbm cfg: sheapthres=0 ; db cfg: sheapthres_shr=automatic, sortheap=automatic
自动调整
按理说 只要database_memory足够,那么排序就不会溢出,我观察了一下还是有很多溢出
请问还有什么参数 在限制排序 使用的内存?
参与21

20同行回答

thuanqinthuanqin其它ibm
回复 20# paulxie    我觉得优化器有时候也给的不足,所以也会溢出。不过只要不写磁盘就好啦~显示全部
回复 20# paulxie


   我觉得优化器有时候也给的不足,所以也会溢出。不过只要不写磁盘就好啦~收起
互联网服务 · 2013-11-17
浏览1134
paulxiepaulxie数据库管理员CMBC
其实排序溢出与否只是和sortheap相关的,如果sql需要的排序数据大于sortheap的设置,排序溢出就发生了。sheapthres_shr是所有排序请求的和的软上限,和溢出没什么关系。完毕。我现在发现的是sortheap和sheapthres_shr都是auto的情况下仍然会出现sql0955c的问题,同意其他筒子的...显示全部
其实排序溢出与否只是和sortheap相关的,如果sql需要的排序数据大于sortheap的设置,排序溢出就发生了。sheapthres_shr是所有排序请求的和的软上限,和溢出没什么关系。完毕。
我现在发现的是sortheap和sheapthres_shr都是auto的情况下仍然会出现sql0955c的问题,同意其他筒子的意见,STMM不是随时调整大小的,所以会产生请求的排序空间大于sheapthres_shr的情况发生,虽然是软限制,但是如果持续请求的话仍然会出现不能分配排序内存的问题,即排序堆请求的速度比STMM调整的速度快了。

共同研究:)收起
银行 · 2013-11-15
浏览1269
nowhillnowhill系统工程师
to stephensun123 ,to limin19821  谢谢回复我在全部整理一下我的 情况版本是v9.7(第一次用就用最新的版本了)参数时  dbm cfg: sheapthres=0 ; db cfg: sheapthres_shr=automatic, sortheap=automatic疑问1:sheapthres_shr=automatic, sortheap=automa...显示全部
to stephensun123 ,to limin19821  谢谢回复
我在全部整理一下我的 情况
版本是v9.7(第一次用就用最新的版本了)
参数时  dbm cfg: sheapthres=0 ; db cfg: sheapthres_shr=automatic, sortheap=automatic
疑问1:sheapthres_shr=automatic, sortheap=automatic,都是automatic,是不是就没有什么硬限制或者软限制一说?  只要database_memory足够,那么多大都有可能?

疑问2:sheapthres_shr=automatic, sortheap=automatic 是立刻调整的,还是延迟调整的?
比如sheapthres_shr 是automatic,假设现在automaitc的值是100M(自动调整现在是100M),sortheap是12M(automaitc的值,假设已经调整到12M),现在数据库用到的共享排序的内存是90M,刚好一个session申请了11M的排序内存,那么现在db2会怎么做呢?
是自动扩展sheapthres_shr  到105M,然后给那个session  11M的排序空间?
还是给那个session  10M的排序空间,然后再 自动扩展到105M?

疑问3:sheapthres_shr=automatic, sortheap=automatic 的自动调整的内存大小什么时候会缩小?
如果其他几块自动调整的内存,比如说DBHEAP(AUTOMATIC),locklist(automatic) 刚好不不变的情况下,
而现在 排序又没有那么多的情况下,sheapthres_shr的值 会去调小吗?  还是保留原有的大小

多多讨论才会有更多的收获,谢谢大家参与收起
IT分销/经销 · 2010-11-05
浏览1135
limin19821limin19821系统工程师乐酷天
I am sorry, you are talking about DB2 prior to DB2 V9.1 ^_^The sheapthres_shr parameter represen ...stephensun123 发表于 2010-11-4 21:19 学习了!显示全部
I am sorry, you are talking about DB2 prior to DB2 V9.1 ^_^



The sheapthres_shr parameter represen ...
stephensun123 发表于 2010-11-4 21:19


学习了!收起
IT分销/经销 · 2010-11-04
浏览1163
stephensun123stephensun123软件开发工程师SAP China
I am sorry, you are talking about DB2 prior to DB2 V9.1 ^_^http://publib.boulder.ibm.com/in ... oc/doc/c0023703.htmThe sheapthres_shr parameter represents a limit on the total amount of database shared memory that can be used by sort memory consumers...显示全部
I am sorry, you are talking about DB2 prior to DB2 V9.1 ^_^

http://publib.boulder.ibm.com/in ... oc/doc/c0023703.htm

The sheapthres_shr parameter represents a limit on the total amount of database shared memory that can be used by sort memory consumers at any one time. In DB2(R) Version 8, this limit was a hard limit. If the sort memory was close to the limit, an alert was generated. In DB2 Version 9.1, the sheapthres_shr parameter represents a soft limit. The sort memory heap can consume additional, unreserved, database shared memory if needed.

In DB2 Version 8, only sorts in SMP environments or sorts running the concentrator that could be accessed by more than one agent consumed shared memory, regardless of the value of the sheapthres parameter. In DB2 Version 9.1, if you set the sheapthres database manager configuration parameter to 0, all sorts will use shared memory. If you set the sheapthres database manager configuration parameter to a value greater than 0, then only sorts in SMP environments or sorts running the concentrator that could be accessed by more than one agent will consume shared memory. This behavior is the same as in Version 8.

http://publib.boulder.ibm.com/in ... c/doc/r0006014.html收起
互联网服务 · 2010-11-04
浏览1192
limin19821limin19821系统工程师乐酷天
软的还是硬的,看理解不同了。This parameter represents a soft limit on the total amount of database ...stephensun123 发表于 2010-11-4 19:50 可能是我记错了 你上面的描述我记得是对sheapthres的阐述。而sheapthres_shr 是共享排序的硬限制。即如果共享排序在任何...显示全部
软的还是硬的,看理解不同了。

This parameter represents a soft limit on the total amount of database ...
stephensun123 发表于 2010-11-4 19:50

可能是我记错了 你上面的描述我记得是对sheapthres的阐述。
而sheapthres_shr 是共享排序的硬限制。即如果共享排序在任何时间超过设定值,会立即报错。
以nowhill提出的场景为例,如果请求11M,总大小大于100,则会立即收到错误SQL0955(RC=2)。而不是DB2分配最小内存完成任务。
这是我现在的理解,可能是错的。收起
IT分销/经销 · 2010-11-04
浏览1157
stephensun123stephensun123软件开发工程师SAP China
软的还是硬的,看理解不同了。This parameter represents a soft limit on the total amount of database shared memory that can be used by sort memory consumers at any one time.Once the sheapthres_shr limit is exceeded, all requests of shared sort memory fro...显示全部
软的还是硬的,看理解不同了。

This parameter represents a soft limit on the total amount of database shared memory that can be used by sort memory consumers at any one time.

Once the sheapthres_shr limit is exceeded, all requests of shared sort memory from sort memory consumers will be granted the minimum amount of memory required to finish the task. When the total amount of shared memory for active shared sort memory consumers reaches this limit, subsequent sorts could fail (SQL0955C).

举个例子,上面nowhill提出的场景
比如sheapthres_shr 是automatic,假设现在automaitc的值是100M,现在数据库用到的共享排序的内存是90M,刚好一个session申请了11M的排序内存,那么现在db2会怎么做呢?
首先11M应该是optimizer提出申请的,而且要小于sortheap,但是此时总的请求是101M,大于共享sort的限制,这时DB2会分配最小的能完成这个sort任务的mem,但是overflow几乎是立即就会发生了。假如所有的sort都没结束,随后的sort请求到的men也是会很小的,直到分配的所有sort的men达到sheapthres_shr,新的sort就会失败。收起
互联网服务 · 2010-11-04
浏览1177
limin19821limin19821系统工程师乐酷天
对于单个的sort限制就是sortheap,如果需要的mem大于这个值,就会overflow,这个值的自动调整并不是在需要 ...stephensun123 发表于 2010-11-3 19:38 严重同意! 不过记得如果是使用共享排序空间,则这个限制是硬限制而不是软限制。To LZ: 如果有大量排序溢出,并且严重影响了性能,如...显示全部
对于单个的sort限制就是sortheap,如果需要的mem大于这个值,就会overflow,这个值的自动调整并不是在需要 ...
stephensun123 发表于 2010-11-3 19:38


严重同意! 不过记得如果是使用共享排序空间,则这个限制是硬限制而不是软限制。
To LZ: 如果有大量排序溢出,并且严重影响了性能,如果物理内存允许,调节大点就是了。收起
IT分销/经销 · 2010-11-04
浏览1151
nowhillnowhill系统工程师
to  mdkii ,sortheap也是automatic db2stmm应该是逐步的周期性的调整,估计还没办法做到完全实时的按需分配内存如果这个是确认的,那么我觉得 就比较好解释了显示全部
to  mdkii ,
sortheap也是automatic

db2stmm应该是逐步的周期性的调整,估计还没办法做到完全实时的按需分配内存
如果这个是确认的,那么我觉得 就比较好解释了收起
IT分销/经销 · 2010-11-04
浏览1143
mdkiimdkii软件开发工程师bocn
你如何确定你的sortheap是足够的。排序是否溢出受你的sortheap大小的限制,你可以观察一下,排序溢出时sortheap的大小。DB2为了保证并发性,sortheap一般会是sheapthres_shr 的1/X。另外,db2stmm应该是逐步的周期性的调整,估计还没办法做到完全实时的按需分配内存。...显示全部
你如何确定你的sortheap是足够的。
排序是否溢出受你的sortheap大小的限制,
你可以观察一下,排序溢出时sortheap的大小。
DB2为了保证并发性,sortheap一般会是sheapthres_shr 的1/X。
另外,db2stmm应该是逐步的周期性的调整,估计还没办法做到完全实时的按需分配内存。收起
银行 · 2010-11-04
浏览1146

提问者

nowhill
系统工程师

相关问题

相关资料

相关文章

问题状态

  • 发布时间:2010-11-03
  • 关注会员:1 人
  • 问题浏览:12410
  • 最近回答:2013-11-17
  • X社区推广