insufficient memory reserved for statement
➢ 问题
执行查询时报错"insufficient memory reserved for statement",,"Increase statement memory or reduce the number of Parquet tables to be scanned."
➢ 分析
- 对于 INSERT,每个未加压缩的表所占内存为 rowgroupSize;而每个加压缩的表所占内存为 2 * rowgroupSize
- 对于 SELECT,每个未加压缩的表所占内存为 Sum(toBeselectedAttributeLen)/wholeRecordLen * rowgroupSize ;而每个加压缩的表所占内存为 2 * Sum(toBeselectedAttributeLen)/wholeRecordLen * rowgroupSize
➢ 解答 - 在 session 级别调大 hawq_rm_stmt_nvseg (默认值为 0):SET HAWQ_RM_STMT_NVSEG=X; 或者
- 在 session 级别调大 hawq_rm_stmt_vseg_memory (默认值为 128 MB):SET HAWQ_RM_STMT_VSEG_MEMORY='Xmb’;或者
- 调大资源队列的资源量:ALTER RESOURCE QUEUE queue1 WITH (VSEG_RESOURCE_QUOTA='mem:Xmb’);
➢ 参考
https://community.pivotal.io/s/article/88-Getting-Insufficient-Memory-Reserved-for-Statement-Error-for-Parquet-Tables