I can do the same query in two ways as following, will #1 be more efficient as we don't have join?
select table1.* from table1
inner join table2 on table1.key = table2.key
where table2.id = 1
select * from table1
where key = (select key from table2 where id=1)
The following recommendations will help you in your SQL tuning process.
You'll find 3 sections below:
CREATE INDEX table1_idx_key ON table1 (key);
CREATE INDEX table2_idx_id ON table2 (id);
SELECT
table1.*
FROM
table1
INNER JOIN
table2
ON table1.key = table2.key
WHERE
table2.id = 1