Does anybody know why the explain of a query that contains a nested query shows that the "dependant" query does not use indexes when it should?? Does the query use indexes at all?
ie:
Table1 structure:
fielda rimary key
fieldb
Table2 structure:
fieldb rimary key
fieldc
select fielda,
(select table2.fieldc from table2 where table2.fieldb=table1.fieldb)
from table1
The nested query always does a full table scan of table2!!
Used force index and it´s the same as not using it.
ie:
Table1 structure:
fielda rimary key
fieldb
Table2 structure:
fieldb rimary key
fieldc
select fielda,
(select table2.fieldc from table2 where table2.fieldb=table1.fieldb)
from table1
The nested query always does a full table scan of table2!!
Used force index and it´s the same as not using it.