I want to replace or improve the SELECT command of tblVisor to make it faster.Is there any way to improve this SQL command?SELECT tblVisor.supervisor_id,       tblVisor.last_name,       tblVisor.first_names,       tblVisor.employee_job_profile_id,       org_employees.last_name,       org_employees.first_name,       org_employees.job_codeFROM (SELECT cp_supervisor_properties.supervisor_id,             persons.last_name,             persons.first_names,             cp_supervisor_properties.employee_job_profile_id      FROM cp_supervisor_properties      INNER JOIN persons ON persons.person_id = cp_supervisor_properties.supervisor_id) as tblVisorINNER JOIN org_employees ON org_employees.employee_number = tblVisor.employee_job_profile_idLIMIT 100
Supervisors and employees query, with a subselect and inner join
sql;postgresql
Unless I'm missing something there doesn't seem to be a reason for thesubselect, just join all three tables directly.  Also, INNER is thedefault, so you could drop that prefix as well.The query would then become something like the following:SELECT cp_supervisor_properties.supervisor_id,       persons.last_name,       persons.first_names,       cp_supervisor_properties.employee_job_profile_id,       org_employees.last_name,       org_employees.first_name,       org_employees.job_codeFROM cp_supervisor_propertiesINNER JOIN persons  ON persons.person_id = cp_supervisor_properties.supervisor_idINNER JOIN org_employees  ON org_employees.employee_number = cp_supervisor_properties.employee_job_profile_idLIMIT 100;Without more information (about how the data looks and so) I don't see possible performance improvements.  If you have problems with the query time you should probably check for missing indexes on the join columns and in general look into query optimisation.