> For the complete documentation index, see [llms.txt](https://docs.acpt.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.acpt.io/custom-content-types/indexes.md).

# Indexes

Add database indexes to improve query performance on your custom tables.

Database indexes speed up queries by allowing MySQL to find rows without scanning the entire table. You configure indexes in **Step 3** of the [table wizard](/custom-content-types/tables.md).

## When to add an index

Add an index on a column if you:

* Filter or search records by that column frequently
* Use that column in a `WHERE` clause in REST API queries
* Join tables on that column via a foreign key (MySQL often does this automatically for foreign keys)

Indexes improve read performance at the cost of slightly slower writes. For small tables (< 1,000 rows) the difference is negligible.

## Creating an index

1. Open the table wizard and navigate to **Step 3 — Indexes**.
2. Click **Add index**.
3. Fill in the index settings:

| Field          | Description                                                                        |
| -------------- | ---------------------------------------------------------------------------------- |
| **Index name** | Unique identifier for this index within the table.                                 |
| **Key parts**  | The columns included in the index. Multi-column (composite) indexes are supported. |
| **Index type** | See types below.                                                                   |

<figure><img src="https://3235524095-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fiyf0tSKPgXiyoQ3zV3I6%2Fuploads%2Fgit-blob-b6e503f4f5e453c12d17c54aacaf219645530ec5%2Fcct-indexes-step.png?alt=media" alt="Indexes step of the table wizard"><figcaption><p>Step 3 — Indexes, with an index configured on director_id.</p></figcaption></figure>

## Index types

| Type         | Description                                                                                               |
| ------------ | --------------------------------------------------------------------------------------------------------- |
| **INDEX**    | Standard B-tree index. Suitable for most query patterns.                                                  |
| **UNIQUE**   | Enforces uniqueness across the indexed column(s). Use for columns that must not contain duplicate values. |
| **FULLTEXT** | Optimized for full-text search on text and longtext columns. Enables `MATCH ... AGAINST` queries.         |
| **SPATIAL**  | Used for geometric/geographic data types. Rarely needed for standard CCT use cases.                       |

## Example

For a `movies` table that is frequently filtered by `year` and `director_id`:

| Index name     | Key parts     | Type  |
| -------------- | ------------- | ----- |
| `idx_year`     | `year`        | INDEX |
| `idx_director` | `director_id` | INDEX |

## Deleting an index

Click the **Delete** icon next to the index in Step 3 of the wizard. The index is removed from the database the next time the table schema is synced.
