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

  • SEARCH
  • Home
  • 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 7650751
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:20:00+00:00 2026-05-31T11:20:00+00:00

Is anyone here able to provide information on what optimisations SQL Server is capable

  • 0

Is anyone here able to provide information on what optimisations SQL Server is capable of? I’m using 2005 standard edition, but also work with 2008 on occasion. Is 2008 able to perform query optimisations that 2005 can’t?

Sometimes I’ll run a query and it will take an enormous amount of time for no apparent reason, and I have to rewrite it using a different method. (CTEs instead of subqueries, etc) I’m like to know ahead of time whether SQL server is going to give me optimal or near-optional performance from a query before I start using it.

Joins to subqueries

select ... from tbl1 left join(
    select ... from tbl2 group by ...
) as subQ on t1.pk = subQ.fk
where t1.pk between 50 and 100

If I join a table to a subquery as above, and the result set is filtered, can I expect SQL server to propagate the WHERE clause filters down to all relevent subqueries? How good is the compiler at determining which parts of a result set will end up being used in the final output?

Lots of columns in group by

Subqueries with group bys can often by written as a straight up join, but then it’s necessary to reference many columns in the group by

select tbl1.pk,b,c,d,e,f,g, sum(tbl2.h) from tbl1 
inner join tbl2 on tbl1.pk = tbl2.fk
inner join tbl3 on tbl1.fk = tbl3.pk
group by tbl1.pk, tbl1.b, tbl3.c, tbl3.d, tbl3.e, tbl3.f, tbl3.g

Each row in table 1 will match to multiple rows in table 2, in addition to one row in table 3. (Note the join to table 3’s pk) Due to this, all the columns in the group by except for tbl1.pk are superfluous. But SQL requires that they are used in the group by regardless. Now the optimiser should just be sorting on table 1’s primary key in order to aggregate the rows from table 2. Will it do this, or will it needlessly sort and compare the entire column set in the group by? As mentioned, the alternative is to aggregate table 2 in a subquery and then join back to tables 1 and 3. Does this make any difference?

  • 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-05-31T11:20:01+00:00Added an answer on May 31, 2026 at 11:20 am

    Yes 2008 is capable of additional optimisations.

    One indicator of this is that sys.dm_exec_query_transformation_stats has 390 potential transformations on my 2008 instance and 380 on my 2005 instance (Some explanation on this DMV here).

    In general the differences are evolutionary improvements however rather than dramatic. I’ve found from my own experience of reporting minor performance issues on Connect that they tend to be fixed next version rather than backported to previous versions (e.g. 1, e.g. 2)

    A few areas I am aware of that have improved in 2008 are handling of partitioned tables, query plans for dynamic search conditions when the OPTION (RECOMPILE) plan is used and predicate pushing in Views.

    With regard to the specific scenarios you’ve raised you would need to check the execution plans in both versions to see if you can discern any difference in strategy.

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

Sidebar

Related Questions

anyone using the jQuery Elastic plugin around here? Pretty handy but I just don't
I'm clutching at straws a little here but was wondering if anyone had any
I was wondering if anyone would be able to provide me with some guidance
Can anyone figure out what's going on here? I was able to get my
Does anyone here know of a Javascript application (something similar to Lightbox, only not
Has anyone here created a Flash site or application that is ADA (Section 508)
Can anyone here help me with the integration of the DailyMotion API? I am
Has anyone here tried to use a custom animation with MBProgressHUD. There is a
Aside from scalability issues, has anyone here actually stumbled upon a web-development problem where
I forgot the name of that application tool. anyone here remembers it? It let's

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.