Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8020373
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:40:39+00:00 2026-06-04T21:40:39+00:00

When i execute the following query with execution plan.I could see that ‘sort’ is

  • 0

When i execute the following query with execution plan.I could see that ‘sort’ is most costlist task.But i am not using any sort option in my query.Why it is happening?There is a nested loop join task exist before select.Also please let me know about merge join,hash join and nested loop join.

enter image description here

select
Ename from dbo.Employee e
where 
Salary>(
select AVG(Salary) from dbo.Employee where 
DeptId=e.DeptId 
group by DeptId)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T21:40:41+00:00Added an answer on June 4, 2026 at 9:40 pm

    In your SQL query your actually sorting data into groups on your column ( Ename) Sort may be a performance bottleneck but you need to find out .If sorting is really causing a performance issue then you can move it to index as suggested by Aaaroon Bertrand .

    The reaon for nested join is SQLserver actually executed 2 query to return back your result .

    One is the Avg(Salary ) written in the sub query and another is an outer query which is selecting Ename from Employee Table which is done using Clustered index Scan .These 2 queries are then combined to return the desired result . It is basically comparing each row from the sub query to each row from the outer query which satisfies the predicate .

    Merge join is only possible when you have index on the joining columns .Merge joins are some times very fast as they are already sorted .

    For in depth explanation you can go through the below link
    Nested join
    Hash Join
    Merge Join

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

When I execute the following query, I get an exception telling me that 'feedItemQuery'
I want to execute following query: from Item i where i.categoryItems.catalogId = :catId That
I have the following query that I am running on my database server but
When I execute the following query on a database containing a table comm_list and
I have to execute the following query in Android SQLite UPDATE player SET rank=rank+1
I am trying to execute the following query. update share set holder = 22
I am trying to execute the following Query select distinct pincode as Pincode,CAST(Date_val as
I need to execute the following MySQL-query in Oracle: INSERT INTO users VALUES(1,10) ON
I need to execute the following grep query as an argument for konsole (the
When I attempt to execute the following non query sql command in my application

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.