Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to create an index from columns of 2 different tables?
If not, how do we optimize a query that does a group by on columns of 2 different tables?

For example: the following statement

explain select from Person p join JobStatus js  
group by,js.job_tickets  
order by,p.lastname, pm.job_tickets;  

Uses indexes if I have for (,p.lastname) and for job_tickets.
But I have noticed that on other queries and with more than one joining table the index is omitted.

share|improve this question
This is hard to answer because your query isn't complete... there's no ON for the join, and one stray reference to a column from a table with the alias "pm." – Michael - sqlbot Sep 8 '13 at 20:35

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.