indexes

The .indexes command displays index information for tables in your connected database. Indexes are critical for query performance and data integrity, so this command is useful for database tuning, troubleshooting, and schema exploration.

Usage

.indexes [table]

When to use

  • Use .indexes to list all indexes in the database, helping you understand how queries are optimized.
  • Specify a table (e.g., .indexes users) to see indexes relevant to that table, which is helpful for performance tuning or debugging slow queries.

Examples

Display the indexes for all tables:

.indexes

Display the indexes for the users table:

.indexes users

Troubleshooting

  • If no indexes are shown, ensure your database supports index metadata and you have the necessary permissions.
  • Some file-based or NoSQL data sources may not support indexes.

Demonstration