Hosting Operations
Read-onlyShow Indexes on a SQLite Table
You need to inspect indexes attached to one SQLite table.
Command
sqlite3 app.db "PRAGMA index_list('orders');"
Before you run this
System impact: Read-only. Low when scoped to the shown target.
When not to use it: Do not use it alone to prove an index is used; follow up with EXPLAIN QUERY PLAN.
Expected output
Index rows showing index name, uniqueness, origin, and partial-index flag.
System impact
Read-only. Nothing changes. SQLite prints index metadata for the table.
Recovery / rollback: no state is changed.
When to use it
Use before changing queries or adding indexes during performance triage.
When not to use it
Do not use it alone to prove an index is used; follow up with EXPLAIN QUERY PLAN.
Watch this command run
Command transcript
This sanitized transcript shows the commands and output shape without exposing host details.
$ sqlite3 app.db ".schema orders"
CREATE TABLE users (id INTEGER PRIMARY KEY, email TEXT NOT NULL, created_at TEXT NOT NULL);
CREATE UNIQUE INDEX idx_users_email ON users(email);
CREATE TABLE orders (id INTEGER PRIMARY KEY, user_id INTEGER NOT NULL, total_cents INTEGER NOT NULL, created_at TEXT NOT NULL);
CREATE INDEX idx_orders_user_id ON orders(user_id);
CREATE TABLE events (id INTEGER PRIMARY KEY, event_type TEXT NOT NULL, created_at TEXT NOT NULL);
$ sqlite3 app.db "PRAGMA index_list('orders');"
0|idx_orders_user_id|0|c|0
View commands shown
These are the commands shown in the sanitized transcript.
Commands shown
sqlite3 app.db ".schema orders"sqlite3 app.db "PRAGMA index_list('orders');"
next steps
Related commands
Count Rows in Key SQLite Tables
A quick row count can reveal empty imports, runaway events, or missing data.
sqlite3 app.db "SELECT 'users', count(*) FROM users UNION ALL SELECT 'orders', count(*) FROM orders UNION ALL SELECT 'events', count(*) FROM events;"
Show One SQLite Table Schema
A failed query is often just a wrong assumption about column names.
sqlite3 app.db ".schema users"
Check SQLite Database Integrity
When a SQLite-backed app behaves strangely, first rule out file corruption.
sqlite3 app.db "PRAGMA integrity_check;"
List SQLite User Tables Only
System metadata tables can distract from the app tables you care about.
sqlite3 app.db "SELECT name FROM sqlite_master WHERE type='table' ORDER BY name;"
Show Recent SQLite Events
For small apps, the quickest timeline may be inside the SQLite file.
sqlite3 app.db "SELECT created_at, event_type FROM events ORDER BY created_at DESC LIMIT 5;"
Study mapping
Use this as independent command practice: read the notes, predict the output, then compare it with the example before using a real shell.
Useful for
- LPIC-1 style command-line practice
- LFCS style performance tasks
- Linux+ style troubleshooting review
Independent study support only. No affiliation, endorsement, exam dumps, or real exam questions.