r/SQLServer • • 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.

6 Upvotes

16 comments sorted by

View all comments

Show parent comment

1

u/cute_polarbear Jan 18 '26

yeah. I had been testing ai sql suggestions / SP refactoring, it was in general doing a decent job. I then started working with having it analyzing db execution plans, while pretty good at isolating / quantifying what probably should to be addressed, its suggestions (obviously) can be very questionable. I just don't have a good understanding (especially realistic use cases) for Hash join (never had to use it in my life), hence started this post.