complex_key_cache

简介: complex_key_cache

complex_key_cache字典与cache字典的特性完全相同,只是将单个数值型key替换成了复合型。完整示例如下:


/etc/clickhouse-server 目录下新建 test_complex_key_cache_dictionary.xml 文件,写入如下内容:

<?xml version="1.0"?>
<dictionaries>
  <dictionary>
    <name>test_complex_cache_dict</name>
    <source>
      <!-- 本地文件需要通过executable形式 -->
      <executable>
        <command>cat /var/lib/clickhouse/dictionaries_lib/organization.csv</command>
        <format>CSV</format>
      </executable>
    </source>
    <layout>
      <complex_key_cache>
        <!-- 缓存大小 -->
        <size_in_cells>10000</size_in_cells>
      </complex_key_cache>
    </layout>
    <!-- 与测试数据的结构对应 -->
    <structure>
      <!-- 复合型key -->
      <key>
        <attribute>
          <name>id</name>
          <type>UInt64</type>
        </attribute>
        <attribute>
          <name>code</name>
          <type>String</type>
        </attribute>
      </key>
      <attribute>
        <name>name</name>
        <type>String</type>
        <null_value></null_value>
      </attribute>
    </structure>
    <lifetime>
      <min>300</min>
      <max>360</max>
    </lifetime>
  </dictionary>
</dictionaries>点击复制复制失败已复制


保存文件,再次查询系统中的所有字典:

$ SELECT name, type, key, attribute.names, attribute.types FROM system.dictionaries;
┌─name─────────────────────────┬─type─┬─key──────────────┬─attribute.names─┬─attribute.types─────┐
│ test_complex_cache_dict      │      │ (UInt64, String) │ ['name']        │ ['String']          │
│ test_hashed_dict             │      │ UInt64           │ ['code','name'] │ ['String','String'] │
│ test_complex_key_hashed_dict │      │ (UInt64, String) │ ['name']        │ ['String']          │
│ test_range_hashed_dict       │      │ UInt64           │ ['price']       │ ['Float32']         │
│ test_flat_dict               │      │ UInt64           │ ['code','name'] │ ['String','String'] │
│ test_cache_dict              │      │ UInt64           │ ['code','name'] │ ['String','String'] │
└──────────────────────────────┴──────┴──────────────────┴─────────────────
目录
相关文章
|
6月前
|
存储 关系型数据库 MySQL
1071 - Specified key was too long; max key length is 767 bytes
【2月更文挑战第5天】1071 - Specified key was too long; max key length is 767 bytes 问题处理
|
6月前
|
PHP
Trying to access array offset on value of type null
你就可以避免在null值上尝试访问数组偏移量的错误。 总的来说,当你遇到这个错误时,你应该回顾你的代码,确保在尝试访问数组偏移量之前,相关的变量已经被正确地初始化为一个数组,并且不是null。
1702 4
|
缓存 关系型数据库 MySQL
【异常解决】缓存报错:Null key returned for cache operation (maybe you are using named params on classes withou
【异常解决】缓存报错:Null key returned for cache operation (maybe you are using named params on classes withou
651 0
HalconDotNet.HTupleAccessException:“‘Cannot convert to double array‘ when accessing ‘HalconDotNet.HT
HalconDotNet.HTupleAccessException:“‘Cannot convert to double array‘ when accessing ‘HalconDotNet.HT
|
缓存 Java Spring
【缓存】At least one non empty cache name should be provided per cache operation.的解决方案
【缓存】At least one non empty cache name should be provided per cache operation.的解决方案
131 0
|
缓存 数据可视化
'dict' object has no attribute '_txn_read_preference' && Sort exceeded memory limit of 10485760
'dict' object has no attribute '_txn_read_preference' && Sort exceeded memory limit of 10485760
210 0
complex_key_hashed
complex_key_hashed
75 0
When allowCredentials is true, allowedOrigins cannot contain the special value ___ since that cannot be set on the _Access-Contr
When allowCredentials is true, allowedOrigins cannot contain the special value ___ since that cannot be set on the _Access-Contr
606 1
|
前端开发
Google Earth Engine——Layer error: Description length exceeds maximum.解决办法
Google Earth Engine——Layer error: Description length exceeds maximum.解决办法
659 0
Google Earth Engine——Layer error: Description length exceeds maximum.解决办法