For mysql you should use
EXPLAIN <query>
eg.
EXPLAIN SELECT * FROM tableX
see mysql link
For the oracle there is something similar, but more detailed:
EXPLAIN PLAN FOR <query>
eg.
EXPLAIN PLAN FOR SELECT * FROM tableX
see also: link for oracle
source share