CREATE INDEX
CautionCreate an index
CREATE INDEX <name> ON <table>(<col>);
Creates an index to speed up queries; remedy for slow queries.
Examples
CREATE INDEX idx_uid ON orders(user_id);Index on user_id
Syntax
CREATE INDEX <name> ON <table>(<cols>);
Before you run it
On large tables it can be slow and lock.
Used when you see
Related commands
- EXPLAINQuery plan
The same reference, with no signal at all
Every command and flow from this site, held on your device and searchable with no connection. Free to install, no ads.
Get it free on the App Store