簇 : 简单的说就是更具相同的特征 合并数据
簇表
来自多张table 具有相同key的记录合并成一条记录 放在簇表里
簇表的存储空间在表簇
这个是SAP的bseg的demo
当然我们也可以自定义
原理的话见 cluster table 这篇文章
簇数据库
当然原理上是有类似的
但不能和这里的簇表和表簇相混淆
簇数据库 只是利用这个特性 把不同Object的数据保存到一张table中
同时簇数据库还有其特有的export写入方式
其操作过程也体现簇的分类方式
簇表
2014年4月6日
23:03
Table pools (pools) and table clusters (clusters) are special table types in the ABAP Dictionary. The data from several different tables can be stored together in a table pool or table cluster. Tables assigned to a table pool or table cluster are referred to as pooled tables or cluster tables.
oracle中关于簇表的描述:
簇其实就是一组表,是一组共享相同数据块的多个表组成。 将经常一起使用的表组合在一起成簇可以提高处理效率。
在一个簇中的表就叫做簇表。建立顺序是:簇→簇表→数据→簇索引
特点就是数据存储在一个"block"中
每条记录除了key fields之外 其他数据字段一起打包在一起
cluster 和 pooled的概念差不多 在存储上有区别
You need the structural information stored in the ABAP Dictionary to read the data from a pooled table or cluster table correctly. These tables can therefore only be processed using Open SQL with the cluster interface, and not with Native SQL directly in the database.
个人理解:
sap使用簇表由于表实在太多
逻辑关系过于复杂
查询不便 集中到一个cluster/pool中利于管理
同时带来比view更高的效率
现在还有一个疑问:数据更新是否会把变化同步到cluster中
个人认为是会的 就像index会同步变化一样
据有些人的解释 vardata中存储的甚至是"指针" 这也是可以理解的
table pool存储pool table,pool talbe都是些数据量不大的表
事实上pool中存在大量的pool table
据说是为了减少集中访问这些表时资源的消耗
现在只需对pool分配资源并进行操作 (pool talbe都是小表 没必要不断的分配资源查找 也是有道理的)
所以一些配置信息都是存储在pool table中的
table cluster相反 存储数据量很大的表
关键在于 cluster table 都有相同的key field
相同的key field组成一条记录 显然也是为了节省空间 提高查询效率
以bseg为例
某个客户的一个已清凭证 可能从bseg查得出 1条数据
但是它包含了我们所需的所有信息
例如需要从 bsas 1 bsak 1 各取一条信息合并的结果
通过bseg簇表直接就获取了所有的信息
减少io 提高效率
ps:二级索引的自我解释
一般主索引就是我们定义的table的key fields
二级索引就是自定义的索引
但是这里是一张table
但是这张table的功能来充当索引表
所以称为xxx的次级索引
自定义簇表
2015年1月12日
15:57
赋值 indx
其他字段的赋值 使用from
REPORT YINDX.
parameters:
r1 radiobutton group g1,
r2 radiobutton group g1.
start-of-selection.
data: begin of lt_demo occurs 0,
name(4),
datum type sy-datum,
end of lt_demo,
ls_zindx type zindx.
ls_zindx-uname = sy-uname.
if r1 = 'X'.
do 2 times.
lt_demo-name = sy-index.
lt_demo-datum = sy-index + sy-datum.
append lt_demo.
enddo.
export t1 = lt_demo[] to database zindx(lb)
from ls_zindx
id 'QWERT'.
else.
import t1 = lt_demo[] from database
zindx(lb) id 'QWERT'.
data: l_str type string.
loop at lt_demo.
l_str = lt_demo+0.
write / l_str.
endloop.
endif.
浙公网安备 33010602011771号