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)

A Workflow Copilot. Tailored to You.

Pieces.app image

Our desktop app, with its intelligent copilot, streamlines coding by generating snippets, extracting code from screenshots, and accelerating problem-solving.

Read the docs

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay