clickhouse 哪些会占据内存
github上有个issue,讲述了在哪些地方会使用到内存 dictionaries marks cache uncompressed cache running queries currently executed materialized views buffer tables memory / temporary tables background merges kafka etc.
mark cache
mark cache的作用
占用内存 用以缓存主键稀疏索引,用以加速查询。
配置 mark cache 的大小
config.xml 文件,配置参数
<mark_cache_size></mark_cache_size>
监控
1: 查看mark cache 占据的内存大小
select * from system.asynchronous_metrics where metric = 'MarkCacheBytes'
2: 评价 mark cache 的设置是否合适的指标 主键稀疏索引缓存的未命中次数: select * from system.events where event = 'MarkCacheMisses'
uncompressed cache
uncompressed cache 的作用
用于缓存数据
uncompressed cache 相关的配置参数
- use_uncompressed_cache :是否开启数据缓存
- uncompressed_cache_size :uncompressed_cache 数据的大小
监控
查看数据缓存占据的内存大小
select * from system.asynchronous_metrics where metric = 'UncompressedCacheBytes'