x

Can bad joins fill up TempDB

If I have bad joins (that ignore indexes) on large tables, will that affect / fill up my TempDB database?
more ▼

asked Nov 28 '11 at 05:28 AM in Default

Raj More gravatar image

Raj More
1.7k 77 82 84

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first
Heck yes. The different JOIN mechanisms within the optimizer can store information in tempdb. For example, a hash join builds a hash table which is in tempdb. A merge join might require a sort operation and the sort will take place in tempdb. That's just the first two that I thought of. There are others that can, and will, dump into tempdb. So yes, "bad" JOINs are an issue for tempdb.
more ▼

answered Nov 28 '11 at 06:19 AM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
90.9k 19 21 74

(comments are locked)
10|1200 characters needed characters left
Yes very much possible. If the server is unable to keep it in the memory, then it will spill it to the tempdb space.
more ▼

answered Nov 28 '11 at 05:38 AM

Sacred Jewel gravatar image

Sacred Jewel
1.7k 2 4 5

(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x111
x79
x49

asked: Nov 28 '11 at 05:28 AM

Seen: 1432 times

Last Updated: Nov 28 '11 at 05:28 AM