/go/index: index from the Command Line

/go/index speeds up MariaDB and MySQL by adding indexes that your sites' queries could use. It: If query logging is not running yet, the command starts it and asks you to try again later. Every admin action in GoAdmio has a matching /go/ command, so anything you can click you can also script.

Quick start

# Add missing indexes (run as root)
/go/index

On the first run, the command may only start query logging. Run it again after 5 minutes.

Examples

# Add missing indexes
/go/index

# Review the log of past runs
tail -n 20 /var/log/go/index.log

# Check the indexes on a table afterwards (replace the names)
mariadb -e "SHOW INDEX FROM mydb.mytable"

# Remove an index this command added (each index is named after its column)
mariadb -e "ALTER TABLE mydb.mytable DROP INDEX mycolumn"

Output

Message Meaning
Start MariaDB logging... The query log is missing, empty, or older than one hour. Logging is being started with /go/my --log.
Try again after 5 minutes. Run the command again once the log has collected queries. The command exits with status 1.
ALTER TABLE <db>.<table> ADD INDEX <column> (<column>) An index is being added. One line is printed for each index.

If nothing needs indexing, the command prints nothing.

See the full reference at /go/index and the GoAdmio command index.

GoAdmio is free and open source, with no license fees and no account limits. Read the GoAdmio docs, or see why it is a free cPanel alternative at goadmio.com.

By:

Posted in:


Leave a Reply

Your email address will not be published. Required fields are marked *