DEV Community

Bryan
Bryan

Posted on Originally published at devlogbook.com

Querying for Data in MySQL is Slow

Trying to query the MySQL database is slow (millions of records in table)

Example query:

SELECT * FROM my_table WHERE code='X87L9D82NB';
Enter fullscreen mode Exit fullscreen mode

Just add an index to the column that is frequently used to query for data

Query to add index:

CREATE INDEX index_name ON table_name (column_name);
Enter fullscreen mode Exit fullscreen mode

Top comments (0)