MySQL – Large Table Load Slow in PHP with High Resource Usage

MySQLPHP

in this situation i want to tell you guy's about one weird think.
Maybe its already answered for this but seriously i can't find answer.
I have table who have 130k records. 3 columns (id, product_id, picture_url).
When im creating SELECT picture_url FROM table WHERE id='1', server cpu,ram and ssd is going to 100% but when im selecting all SELECT * FROM table; Its loads fast and without any resourses usage. Where could be a problem for this weird situation?

Best Answer

check indexes and table structure

for 99% id - is INT so

SELECT picture_url FROM table WHERE id='1'

born scan of all column and convert it to archer, same if no indexes - it start scan all table and sort

at the same time

SELECT * FROM table

just start send data without transformation

if I right - just change query for

SELECT picture_url FROM table WHERE id=1

and add index if it not already there