I have this query:

    SELECT * FROM wp_dev_term_taxonomy, wp_dev_terms WHERE ((wp_dev_term_taxonomy.taxonomy = 'category')) AND (wp_dev_term_taxonomy.term_id = wp_dev_terms.term_id);

My question, is that when I have this in the where:

    wp_dev_term_taxonomy.term_id = wp_dev_terms.term_id

What's the correct way to optimize this? Do I set index's? Do I use foreign keys? On a large database this is actually take a few seconds to run.