Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 Join Hints: Merge/Hash and Performance

Author  Topic 

Willowdog
Starting Member

1 Post

Posted - 2009-11-27 : 17:39:13
We use table functions quite a bit. We've noticed that 2005/2008 just do not seem to process them well unless we provide a hint such as LEFT MERGE JOIN instead of LEFT JOIN.

Even with table variables we see the problem. I created 2 table variables and populated each with an identical 1000 records; a simple numeric key. When I attemp to join them to each other, unless I specify MERGE JOIN, the performance is terrible for such a simplistic query. Terrible being orders of magnitude slower.

In 2000 we did not see this issue. It's not just with one database, we have several different database on several different servers and they all behave similarly. I see the plan and the database is definitely changing the plan based on the hints but I could practially join the records by hand faster than what the server is doing.

Any help other than not to use table variables or table functions would be appreciated.

Bruce

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-11-27 : 18:34:49
Table variables are bad for performance as can be table-valued functions. You don't get any statistics with table variables and functions tend to lead to scans.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page
   

- Advertisement -