---
title: Create Table Indexes | Datasquirel docs
description: Add indexes to your database tables to improve query performance
page_title: Create Table Indexes
page_description: Add indexes to your tables to speed up queries on frequently searched fields.
---

## Overview

An **index** is a data structure that MariaDB maintains alongside your table to make certain queries faster. Without an index, a query that filters by a column must scan every row in the table. With an index on that column, MariaDB can jump directly to the matching rows.

Adding indexes is especially important on:
- Fields used in `WHERE` clauses (e.g. `WHERE slug = ?`)
- Fields used in `ORDER BY` or `GROUP BY`
- Foreign key fields

## Index Types

Datasquirel supports the following MariaDB index types:

| Type | Description |
|------|-------------|
| **INDEX** | A standard non-unique index. Use this to speed up queries on any column that is not required to be unique. |
| **UNIQUE** | Like INDEX, but also enforces that no two rows can have the same value for the indexed column. |
| **FULLTEXT** | A full-text index used for text search with `MATCH ... AGAINST`. Applies to `TEXT` and `VARCHAR` columns. |

## Adding an Index

### From the Field Settings

The simplest way to index a field is directly in the field editor. When creating or editing a field, click **More** and enable the **Unique** option — this creates a UNIQUE index on the field.

### From the Table Schema Editor

1. Open the table in your admin panel.
2. Navigate to the **Schema** or **Indexes** tab.
3. Click **Add Index**.
4. Select the index type and choose the field(s) to include.
5. Save the index.

<DocsImg
    alt="SQL Field Settings"
    srcLight="/images/screenshots/sql-field-settings-light.webp"
    srcDark="/images/screenshots/sql-field-settings-dark.webp"
/>

## Notes

- Every table automatically has a PRIMARY KEY on the `id` column. This index is created by Datasquirel and cannot be removed.
- Adding an index on a large table may take a moment as MariaDB rebuilds the index structure.
- Indexes speed up reads but add a small overhead to writes (INSERT, UPDATE, DELETE). Only index fields you actually query on.

## What's Next

- [Create Table Fields](/docs/gui-reference/databases/create-table-fields) — understand field types and constraints
- [API Reference → GET](/docs/api-reference/crud/get) — use query parameters to filter and sort data
