r/SQLServer • u/cute_polarbear • Jan 18 '26
Question Sql hashjoin against large table
Hi,
I have a temp table indexes on int Id, joining to a large table (1billion+) rows indexed on int id, both unique, 1 to 1. Temp table can be few hundred rows to hundred of thousand rows. Does it make sense to do a hashjoin in this scenario or normal inner join? Thank you.
5
Upvotes
View all comments
Show parent comment
2
u/alinroc 4 Jan 18 '26
Don't try to outsmart the SQL Server optimizer. It takes a lot of experience to get the point where you can say "yeah, I'm pretty sure it's making the wrong call here."
Not sure how much I trust that thing. Last time I saw it give a suggestion on improving a query's performance, all it said was "slap a
NOLOCKhint on there"