Skip to Main Content

Oracle Database Discussions

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Best practice query

Nic PilotNov 21 2021

Hi,
For a while I'm questioning myself about a best practice query for performance.
I've 2 tables.
EMPLOYEES and DEPARTMENTS
The EMPLOYEES table can contains millions of records.

Which query is better for performance ?

Query 1

Select t1.emp_id, t1.emp_name, t2.dept_name
from EMPLOYEES t1, DEPARTMENTS t2
where t1.dept_id = t2.dept_id
order by t1.emp_name

Query 2

Select emp_id, emp_name, (select mypackage.get_dept_name(dept_id) from dual) as dept_name
from EMPLOYEES
order by emp_name

Comments

Processing

Post Details

Added on Nov 21 2021
6 comments
274 views