Indexes
Indexes let you document the indexing strategy for your tables directly in the ERD. Define single-column indexes, composite indexes, and unique constraints — all from the table edit panel.
Access the Indexes section
- Click a table on the canvas to open the edit panel
- Scroll down to the Indexes section (below Columns and Foreign Keys)
Add an index
- Click + Add Index in the Indexes section
- Configure the index properties:
| Property | Description |
|---|---|
| Name | Index name (e.g., idx_users_email, idx_orders_status_date) |
| Columns | One or more columns included in the index |
| Unique | Whether this index enforces a uniqueness constraint |
- Select columns from the dropdown — the list shows all columns defined on the current table
- The index is saved along with the table
Composite indexes
A composite index spans multiple columns. This is useful for queries that filter or sort on combinations of fields.
To create a composite index:
- Click + Add Index
- Enter the index name
- Add multiple columns — select each column from the dropdown
- The column order in the index matters for query optimization — arrange them according to your most common query patterns
Example
For an orders table with frequent queries filtering by status and created_at:
| Property | Value |
|---|---|
| Name | idx_orders_status_created |
| Columns | status, created_at |
| Unique | No |
Unique indexes
Toggle the Unique checkbox to mark an index as unique. A unique index enforces that no two rows can have the same combination of values in the indexed columns.
Common use cases:
| Table | Columns | Purpose |
|---|---|---|
users | email | Ensure no duplicate emails |
team_members | team_id, user_id | Prevent duplicate memberships |
slugs | resource_type, slug | Unique slug per resource type |
Edit an index
Click on an existing index in the Indexes section to expand it. You can:
- Rename the index
- Add or remove columns
- Toggle the unique flag
Changes are saved with the table.
Delete an index
Click the delete icon next to the index row to remove it.
Tips
- Follow a consistent naming convention for indexes — e.g.,
idx_{table}_{columns}makes indexes easy to identify in migration scripts - Put the most selective column first in composite indexes — this helps the database optimizer choose the index efficiently
- Use unique indexes to enforce business rules at the database level (not just application level)
- When exporting your schema to SQL, indexes are included in the generated DDL statements
- Document indexes in your ERD even if they are already in your migration files — it helps the team see the full picture at a glance