Optimising a query
===

I have searched the web in attempt to work this problem out but to no luck. This is also my first SQL question on SO :-)

I am but a simple man with simple queries - allow me to demonstrate

    select asy.aim_student_id, ast.aim_test  
    from aim_student_test ast
      join aim_student_absent asa on (asa.aps_yr = ast.aps_yr and asa.aim_test = ast.aim_test and asa.aim_id = ast.aim_id)
      --join aim_student_qst asq on (asq.aps_yr = ast.aps_yr and asq.aim_test = ast.aim_test and asq.aim_id = ast.aim_id)
      join aim_student_yr asy on (asy.aps_yr = ast.aps_yr and asy.aim_student_yr_id = ast.aim_student_yr_id)
        where ast.aps_yr = '2012'

As you can see - join aim_student_qst is commented out. 

aim_student_qst is a table that lists responses by a student to all questions. So one student would have ~50 cases in this table. To test what was slowing my query I simply commented out the joining of aim_student_qst and sure enough my query sped right up. 

I assume that what Oracle is doing is going - oh you want those tables, let's put them into one big table and THEN look for what exactly we want. Which is why my query is slower despite not doing anything else with aim_student_qst. Is this correct?

For my purposes I only need to select one question for each student, rather than all 50, for example. Is there a way to do this?

Thankyou!!!!!

