--- title: "Table structure" slug: "table-structure" updated: 2022-04-13T19:24:18Z published: 2022-04-13T19:24:18Z canonical: "docs.echo.stream/table-structure" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.echo.stream/llms.txt > Use this file to discover all available pages before exploring further. # Table structure The table in your Tenant is constructed using a single-table design pattern, where the items or rows in the table may be super-wide but very sparse. Specifically, the table defines the following fields. Additional fields that you store per item are entirely up to you. ## Fields | Field | Type | Description | Required | | --- | --- | --- | --- | | `pk` | String | The partition or hash key for the table | Y | | `sk` | String | The sort or range key for the table | Y | | `lsi0_sk` | String | The sort or range key for the index `lsi0` | N | | `lsi1_sk` | String | The sort or range key for the index `lsi1` | N | | `lsi2_sk` | String | The sort or range key for the index `lsi2` | N | | `lsi3_sk` | String | The sort or range key for the index `lsi3` | N | | `lsi4_sk` | String | The sort or range key for the index `lsi4` | N | | `ttl` | Number | The Time-To-Live for the item, in Unix epoch time formate | N | - It is strongly recommended that you do not assign any meaning to the `pk` or various `sk` fields, and that each of these fields is effectively a copy of a meaningful field that you add to the item. - While the `ttl` is optional, EchoStream **strongly** recommends that you use it. It allows your table to automatically clean up old items. You will pay for all items in the table, even those you have lost reference to, and automatic cleanup mitigates this. ## Indexes | Index | Keys | Use | | --- | --- | --- | | table | `pk` plus `sk` | The primary table index. Supports discrete `GetItem` calls as well as `Query` calls | | `lsi0` | `pk` plus `lsi0_sk` | A Local Secondary Index. Supports `Query` calls using the secondary sort key | | `lsi1` | `pk` plus `lsi1_sk` | A Local Secondary Index. Supports `Query` calls using the secondary sort key | | `lsi2` | `pk` plus `lsi2_sk` | A Local Secondary Index. Supports `Query` calls using the secondary sort key | | `lsi3` | `pk` plus `lsi3_sk` | A Local Secondary Index. Supports `Query` calls using the secondary sort key | | `lsi4` | `pk` plus `lsi4_sk` | A Local Secondary Index. Supports `Query` calls using the secondary sort key | - The `pk` and `sk`, in combination, must be unique. If your `pk` is unique and you do not need the `sk`, put in a placeholder value for the `sk`. - Items in your table may provide any number of the `lsiX_sk` fields for the corresponding indexes, including providing none of them (and just using the table index). - You may have as many items that declare duplicate `lsiX_sk` fields as you wish. If you do this, your `Query` calls on the `lsiX` indexes will return multiple items. - It is **strongly** recommended that you use the indexes provided where possible. While `Scan` calls are allowed, they are expensive and slow.