> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-parallel-read-in-order-multi-part.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# ssd_cache dictionary layout types

> Store dictionary data on SSD with an in-memory index: ssd_cache or complex_key_ssd_cache types

<h2 id="ssd_cache">
  ssd\_cache
</h2>

Similar to `cache`, but stores data on SSD and index in RAM. All cache dictionary settings related to update queue can also be applied to SSD cache dictionaries.

Cache contents are local to each server and are lost when a server restarts or is replaced. Do not use `ssd_cache` or `complex_key_ssd_cache` for reliable insert-time enrichment: an empty cache makes inserts depend on lookups to the dictionary source. In ClickHouse Cloud, autoscaling and managed node replacement make this condition more likely. Use a layout that loads the complete dictionary on each server instead; see [Dictionary best practices](/concepts/features/dictionaries/best-practices#cache-dictionaries-in-ingestion-path).

Like `cache`, this layout keeps no record of which keys exist, so reading it as a table with `SELECT ... FROM <dictionary>` returns only the cells currently held that hold a value: it cannot discover keys absent from the cache, and it skips the default cells that record keys which were looked up but not found at the source. Resident cells that have expired are still re-requested from the source. See [cache](/reference/statements/create/dictionary/layouts/cache).

The dictionary key has the [UInt64](/reference/data-types/int-uint) type.

<Tabs>
  <Tab title="DDL">
    ```sql theme={null}
    LAYOUT(SSD_CACHE(BLOCK_SIZE 4096 FILE_SIZE 16777216 READ_BUFFER_SIZE 1048576
        PATH '/var/lib/clickhouse/user_files/test_dict'))
    ```
  </Tab>

  <Tab title="Configuration file">
    ```xml theme={null}
    <layout>
        <ssd_cache>
            <!-- Size of elementary read block in bytes. Recommended to be equal to SSD's page size. -->
            <block_size>4096</block_size>
            <!-- Max cache file size in bytes. -->
            <file_size>16777216</file_size>
            <!-- Size of RAM buffer in bytes for reading elements from SSD. -->
            <read_buffer_size>131072</read_buffer_size>
            <!-- Size of RAM buffer in bytes for aggregating elements before flushing to SSD. -->
            <write_buffer_size>1048576</write_buffer_size>
            <!-- Path where cache file will be stored. -->
            <path>/var/lib/clickhouse/user_files/test_dict</path>
        </ssd_cache>
    </layout>
    ```
  </Tab>
</Tabs>

<br />

<h2 id="complex_key_ssd_cache">
  complex\_key\_ssd\_cache
</h2>

This type of storage is for use with composite [keys](/reference/statements/create/dictionary/attributes#composite-key). Similar to `ssd_cache`.
