select active from websites where id = (select max(id) from websites where url = 'google.com')
id select_type table type possible_keys key key_len ref rows Extra
1 PRIMARY websites const PRIMARY PRIMARY 4 const 1
2 SUBQUERY websites ref url url 767 1867 Using where
How can I optimize this query? The url
field is index and id
is the primary key. So why is it going through all the rows?