I have this query. Assuming no index is created yet, how can i optimize this using index so the query runs faster? How do i create the index?
select c.company_name, c.company_id FROM companies AS c
JOIN users AS u USING(companyid)
JOIN jobs AS j USING(userid)
JOIN useraccounts AS ua USING(userid)
WHERE j.jobid = 10;
Any help would greatly be appreciated.