> ## 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.

# direct 字典布局

> 一种不经过缓存、直接查询源的字典布局。

## direct

字典不存储在内存中，而是在处理请求时直接访问源。

字典键的类型为 [UInt64](/zh/reference/data-types/int-uint)。

只有 lookup 是有选择性的。`dictGet` 及其他字典函数会针对请求的键去查询源，但**以表的方式**读取字典并不是按键拉取：`SELECT ... FROM <dictionary> WHERE key IN (...)` 会读取整个源，然后再对结果进行过滤，因为键过滤条件不会被下推到字典中。如果希望针对特定键去查询源，请使用字典函数。

支持除本地文件外的所有 [源](/zh/reference/statements/create/dictionary/sources/overview#dictionary-sources) 类型。

配置示例：

<Tabs>
  <Tab title="DDL">
    ```sql theme={null}
    LAYOUT(DIRECT())
    ```
  </Tab>

  <Tab title="配置文件">
    ```xml theme={null}
    <layout>
      <direct />
    </layout>
    ```
  </Tab>
</Tabs>

<br />

## complex\_key\_direct

这种存储类型用于复合[键](/zh/reference/statements/create/dictionary/attributes#composite-key)，与 `direct` 类似。
