![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
|
Hi, According to this page: http://support.microsoft.com/kb/294860/EN-US Halloween problem occurs where the physical location of a row within a table changes due to a modification operation. As a result, the same row may be revisited multiple times within the context of a single logical operation. I found an example of Halloween problem in this page: http://www.kbalertz.com/Feedback.aspx?kbNumber=285870 In this example, physical location of a row does not change during the update operation. The "test" table has one index (clustered). The rows will be moved only if the clustered key is updated (which does not occur here). 1) How does Halloween problem happen here? 2) Why Loop Join is not encountered with this problem? Thanks in advance, Leila |
#2
| |||
| |||
|
#3
| |||
| |||
|
|
Is there a practical reason for this question, or is it an academic one? In other words, do you have an update where you think you are seeing the Halloween Problem? The Halloween Problem is a classic database problem wherein the membership in the set you are reading is changed by your own update operation, causing you to see the same row repeatedly. The theoretical problem is independent of the underlying rdbms implementation. The explanation in the first KB article is incomplete in describing the problem. For example, even if rows did not actually move a query plan that referenced any index incorporating a column that is also being modified might be subject to the HP. In early rdbms products it was up to the user to avoid making update requests that would cause the Halloween Problem. In newer products, such as SQL Server 7.0/2000/2005 the Query Optimizer takes care of the problem via a technique called Halloween Protection. When it sees that the update you are performing could change one of the inputs it generates a plan that won't have that problem. For example, it will spool the impacted inputs to a temporary workfile before performing any updates and then read from the temporary workfile rather than the underlying data that is being updated.. The second KB article is just pointing out a situation where the Query Optimizer was not producing the correct plan. I didn't look at it in depth, but I suspect that the reason Loop Join didn't have the problem is that the optimizer was generating the correct Halloween Protection for that situation. -- Hal Berenson, President PredictableIT, LLC http://www.predictableit.com "Leila" <Leilas (AT) hotpop (DOT) com> wrote in message news:uIddyxRVGHA.4884 (AT) TK2MSFTNGP10 (DOT) phx.gbl... Hi, According to this page: http://support.microsoft.com/kb/294860/EN-US Halloween problem occurs where the physical location of a row within a table changes due to a modification operation. As a result, the same row may be revisited multiple times within the context of a single logical operation. I found an example of Halloween problem in this page: http://www.kbalertz.com/Feedback.aspx?kbNumber=285870 In this example, physical location of a row does not change during the update operation. The "test" table has one index (clustered). The rows will be moved only if the clustered key is updated (which does not occur here). 1) How does Halloween problem happen here? 2) Why Loop Join is not encountered with this problem? Thanks in advance, Leila |
![]() |
| Thread Tools | |
| Display Modes | |
| |