Does this query will be faster with a index on "t.type1" and "x.type1" or only index on "x.type1" is enought?
SELECT t.id, x.id
FROM t
INNER JOIN x ON x.type1=t.type1
WHERE t.id=1
Does this query will be faster with a index on "t.type1" and "x.type1" or only index on "x.type1" is enought?
SELECT t.id, x.id
FROM t
INNER JOIN x ON x.type1=t.type1
WHERE t.id=1
It depends, how many records do you have and how many unique values you have in these columns? Just use EXPLAIN to see what the database does and do this with and without indexes. You'll see the difference.
You should have an index on t.id
(presumably it is the primary key?) and an index on x.type1
.