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'] │
└──────────────────────────────┴──────┴──────────────────┴─────────────────
目录
相关文章
|
7月前
|
缓存 关系型数据库 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
219 0
|
5月前
|
JavaScript
[Vue warn]_ Avoid using non-primitive value as key, use string_number value instea
[Vue warn]_ Avoid using non-primitive value as key, use string_number value instea
HalconDotNet.HTupleAccessException:“‘Cannot convert to double array‘ when accessing ‘HalconDotNet.HT
HalconDotNet.HTupleAccessException:“‘Cannot convert to double array‘ when accessing ‘HalconDotNet.HT
|
7月前
|
缓存 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.的解决方案
49 0
relocation R_X86_64_PC32 against symbol can not be used when making a shared object recompile with
relocation R_X86_64_PC32 against symbol can not be used when making a shared object recompile with
437 0
relocation R_X86_64_PC32 against symbol lua_newstate can not be used when making a shared object
relocation R_X86_64_PC32 against symbol lua_newstate can not be used when making a shared object
208 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
155 0
complex_key_hashed
complex_key_hashed
54 0
|
关系型数据库 MySQL PHP
laravel5.5报错:1071 Specified key was too long; max key length is 767 bytes
laravel5.5报错:1071 Specified key was too long; max key length is 767 bytes