1 说明
In-Memory virtual columns enable some or all of the user-defined virtual columns on a table to have their values materialized (precalculated) and populated into the In-Memory Column Store along with all of the non-virtual columns for that table.
In-Memory虚拟列可以使表中的一些或所有用户定义的虚拟列实现其值的具体化(预先计算),并将其插入到In-Memory的列存储中,并与所有非虚拟列一起存储在该表中。
Materializing the values of user-defined virtual columns into the In-Memory Column Store can greatly improve query performance by enabling the virtual column values to be scanned and filtered using In-Memory techniques such as SIMD (single instruction, multiple data) vector processing, just like a non-virtual column.
通过预先计算(比如,提前对某列的值进行复杂的运算,将得到的值作为一个虚拟列,下次直接使用虚拟列即可,无需重新计算),可以大大提高查询的性能。
为了将IM虚拟列插入到IM列式存储中,要设置INMEMORY_VIRTUAL_COLUMNS参数:
- MANUAL (default): If a table is enabled for the IM column store, then no IM virtual columns defined on this table are eligible for population, unless they are explicitly set as INMEMORY. --需要显示指定虚拟列
- ENABLE: If a table is enabled for the IM column store, then all IM virtual columns defined on this table are eligible for population, unless they are explicitly set as NO INMEMORY. --除非显示指定虚拟列不插入
- DISABLE:无法将IM虚拟列插入到IM列式存储中。
2 实验-启用IM虚拟列
2.1 首先要启用IM列式存储
INMEMORY_SIZE值不为0,最小为100M。
2.2 设置INMEMORY_VIRTUAL_COLUMNS参数
–重启生效
2.3 将包含虚拟列的表启用IM列式存储
2.3.1 将已有的表添加虚拟列并启用IM列式存储
–查看BONUS表结构,多了一列WEEKLY_SAL
2.3.2 新建表(包含虚拟列),并显示指定虚拟列插入到IM列式存储
- 新建表
- 将hrly_rate虚拟列插入到IM列式存储中
更为详细信息参考官方文档:
http://docs.oracle.com/database/122/INMEM/populating-objects-in-memory.htm#INMEM-GUID-C0BC34D3-2BD8-41A5-B2F0-9AB109C1B617