.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Post New Web Links

JOIN Performance wise which is better a.id=b.id or b.id=a.id

Posted By:      Posted Date: September 03, 2010    Points: 0   Category :Sql Server
While joining 2 tables A & B... which one is better? from A a join B b on a.id=b.id --or-- on b.id=a.id   Is there any difference?

View Complete Post

More Related Resource Links

IN,EXISTS or INNER JOIN - which one is the best (performance wise)


hi all,

when we compare  IN,EXISTS or INNER JOIN with performance  wise which one is the best? Any Example to prove it?


Tharindu Dhaneenja

Tharindu Dhaneenja (http://dhaneenja.blogspot.com)

Performance-wise, what is the best way to do a....

I have a combination of 2 tables (Header/Detail) that will have Millions of rows within a year or so.    I have to do an Insert into the detail table if the Header information exists and an Insert into Both if it does not exist.  there are several ways to do this (if Exists, If not exists, attempt the insert and catch a restraint violation). I was hoping someone could recommend the most efficient way to do this as opposed to me setting up several variations and try to "Time it" and see which is bettter. the header contains an identity column, Claim Number varchar(38), Partner varchar(30) and 3 other small varchar fields. the detail column has an identity column, a Bigint column that matches to the Identity from the Header, a "Date" field that is char(08) "CCYYMMDD" format,  batchNumber varchar(10) and 2 other varchar fields. it the Claim Number / Partner already exists on the Header table, I want to insert a new Detail record (Using the Old HeaderKey) and if it does not exist, I will insert the Header and then insert the Detail record (using the New headerKey). any suggestions are appreciated. Thanks, Daryl

Performance tuning > two tables with strings > best query to join them


I have two subqueries which build a string (varchar(200)), first subquery creates 200000 records and second 50000 records, how can I write a select statement to get records from subquery first with string existing in second subquery records.

Will sorting both the sub query results be helpful? Kindly advice for best performing select statement.

Use of > or >= in Where clause performance wise


This question is sequel to my previous question in this forum: http://social.msdn.microsoft.com/Forums/en-US/transactsql/thread/a4a9edd5-4896-497d-91a9-520979a1f36b/

Both of the WHERE clause will fetch equal number of records, but which one is best to use performance wise or just as a best practice?

where x > 9


where x >= 10

Edit: SQL Server Ver 2005 (on request of Kalen Delaney)


performance in inner join with sub-select


may i expect to have diff performance (reads, duration, ...) for:

select (cols)

from table1 as t1 inner join (select col1, col2 from table2) as t2

on t2.col1 = t1.col1


select (cols)

from table1 as t1 inner join table2 as t2

on t2.col1 = t1.col1

??? (consider i have indexes in table1 and table2 on col1)

i mean... does it matter if i join full table with full table or sub-selects (which reduce the number of columns)?

What is the difference performance wise in creating a temp table using declare @table table or creat



I have a query that is taking forever to run on the production server.

Do you see a reason why will it take forever to insert it to a temp table... If i put my query in a cte it works fine...

This procedure was using a table variable and i changed it to a temp table but it didnt help performance wise

I found out that when i just do the select statement it works the same amount of time that cte takes but when it inserts it a temp table (around 75 rows) it takes forever.

Any help will be appreciated.



Union all in SSIS join two tables row wise or column wise

Union all in SSIS join two tables row wise or column wise

Which JOIN style is better from performance point of view?



If I do,

SELECT col1, col2....

FROM table1 AS A


(SELECT col3, col4....

FROM table2) B

ON A.col1 = B.col3

Or, I first take the inner query in a temp table first and then use that temp table directly in the JOIN? Consider that both the tables are really really huge (over 100 million records, and they have proper indexes).




In persuit of learning SQL.

ASP.NET Best Practices for High Performance Applications

This article lists the techniques that you can use to maximize the performance of your ASP.NET applications. It provides common issues, design guidelines, and coding tips to build optimal and robust solutions.

Top .NET Performance Problems and how to avoid them

Every time I work with one of our .NET customers to help them with managing their application performance I come across the same problems as seen with other clients before: lots of ADO.NET queries, many hidden exceptions in core or 3rd party .NET libraries, slow 3rd party components, inefficient custom code

High-Performance .NET Application Development & Architecture

It has always been a goal of project architects to plan an effective strategy from the ground up in regards to an new application. All relevant factors are taken into consideration with respect to the application, from its design and layout to a functional website infrastructure. Pre-.NET strategies and design guidelines still effective now were developed with Microsoft's DNA (Distributed interNet Application) platform. This model successfully served the purpose of architecting N(any number of)-Tier (levels) applications. In its basic sense, as in most robust, distributed applications, you'll architect 3 main layers or Tiers: presentation, business rules and data access.

How to improve the performance of ASP.NET MVC web applications

It is an in depth analysis of a Digg-like site and how it went from serving (on a test machine) 6 req/sec to 390 req/sec.

The biggest gain, 74 req/sec to 390 req/sec happened when he introduced data caching and another 25 req/sec where gained when he introduced the compilation of LINQ queries.

High Performance ASP.NET - Speeding Up ASP.NET Pages

have been writing a series of blog posts, which I have named High Performance ASP.NET Websites Made Easy! There is no rhyme or reason to the order of these posts and certainly can be read in any order:

Developing High Performance and Scalable ASP.NET Websites
Avoid Chatty Interfaces Between the Tiers in Your ASP.NET Web Application
ASP.NET Page Profiling - Page Tracing - High Performance and Scalable ASP.NET Websites Made Easy
Web Applications: N-Tier vs. N-Layer - Benefits and Trade-Offs
Query Analyzer - Sql Server Database Indexes and Execution Plans

Improving Application Performance in .Net

Application performance has always been a concern for Web Application developers. This article contains guidelines and tips for maximizing application performance in ASP.NET.

Tips to Improve Your ASP.NET Web site performance

ASP.NET has been developed with lots of features which makes developer life easy. Start from ViewState, PostBack, Server Controls , User Controls and etc. All of them can make your web development experience fun and easy, but improper use of them can cause your site performance slowdown. Most of the controls generate overhead to the client and server. Therefore in this article, I I will list out about things you can do and don't to improve your ASP.NET website performance.

10 Tips for Writing High-Performance Web Applications

Writing a Web application with ASP.NET is unbelievably easy. So easy, many developers don't take the time to structure their applications for great performance. In this article, I'm going to present 10 tips for writing high-performance Web apps. I'm not limiting my comments to ASP.NET applications because they are just one subset of Web applications. This article won't be the definitive guide for performance-tuning Web applications-an entire book could easily be devoted to that. Instead, think of this as a good place to start.

Performance Tests: Precise Run Time Measurements with System.Diagnostics.Stopwatch

Everybody who does performance optimization stumbles sooner or later over the Stopwatch class in the System.Diagnostics namespace. And everybody has noticed that the measurements of the same function on the same computer can differ 25% -30% in run time. This article shows how single threaded test programs must be designed to get an accuracy of 0.1% - 0.2% out of the Stopwatch class. With this accuracy, algorithms can be tested and compared.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend