Microsoft KB Archive/892935

= FIX: You experience slow performance when you join local partitioned views with a table in SQL Server 2000 =

Article ID: 892935

Article Last Modified on 6/1/2006

-

APPLIES TO


 * Microsoft SQL Server 2000 Standard Edition
 * Microsoft SQL Server 2000 Desktop Engine (Windows)
 * Microsoft SQL Server 2000 Developer Edition
 * Microsoft SQL Server 2000 Enterprise Edition
 * Microsoft SQL Server 2000 Developer Edition
 * Microsoft SQL Server 2000 64-bit Edition

-



Bug #: 473533 (SQL Server 8.0)



''Microsoft distributes Microsoft SQL Server 2000 fixes as one downloadable file. Because the fixes are cumulative, each new release contains all the hotfixes and all the security fixes that were included with the previous SQL Server 2000 fix release.''



SYMPTOMS
When you join local partitioned views with a table in Microsoft SQL Server 2000, SQL Server produces an inefficient query execution plan. The inefficient query execution plan causes poor performance. See the More Information section underneath for a demonstration of reducing the partition view to select from only the relevant partition table.

For a list of previous hotfixes, see the &quot;Microsoft SQL Server 2000 post-Service Pack 3 or Microsoft SQL Server 2000 post-Service Pack 3a hotfixes&quot; section in the following Microsoft Knowledge Base article:

290211 How to obtain the latest SQL Server 2000 service pack



CAUSE
This problem occurs when table scans are performed on very large tables that contain millions of rows. The query execution plan causes poor query performance.



Hotfix information
A supported hotfix is now available from Microsoft, but it is only intended to correct the problem that is described in this article. Only apply it to systems that are experiencing this specific problem. This hotfix may receive additional testing. Therefore, if you are not severely affected by this problem, we recommend that you wait for the next SQL Server 2000 service pack that contains this hotfix.

To resolve this problem immediately, contact Microsoft Product Support Services to obtain the hotfix. For a complete list of Microsoft Product Support Services telephone numbers and information about support costs, visit the following Microsoft Web site:

http://support.microsoft.com/contactus/?ws=support

Note In special cases, charges that are ordinarily incurred for support calls may be canceled if a Microsoft Support Professional determines that a specific update will resolve your problem. The usual support costs will apply to additional support questions and issues that do not qualify for the specific update in question.

Prerequisites
You must install SQL Server 2000 Service Pack 3a. For more information about how to obtain SQL Server 2000 Service Pack 3, click the following article number to view the article in the Microsoft Knowledge Base:

290211 How to obtain the latest SQL Server 2000 service pack

Additionally, this hotfix requires that you also have SQL Server 2000 hotfix build 2000.80.977 installed. For more information about SQL Server 2000 Post SP3a hotfix build 2000.80.977, click the following article number to view the article in the Microsoft Knowledge Base:

888007 You receive a &quot;The product does not have a prerequisite update installed&quot; error message when you try to install a SQL Server 2000 post-S888007 hotfix

Restart information
You do not have restart the computer after you apply this hotfix.

Hotfix file information
This hotfix contains only those files that are required to correct the issues that this article lists. This hotfix may not contain all the files that you must have to fully update a product to the latest build.

The English version of this hotfix has the file attributes (or later file attributes) that are listed in the following table. The dates and times for these files are listed in Coordinated Universal Time (UTC). When you view the file information, it is converted to local time. To find the difference between UTC and local time, use the Time Zone tab in the Date and Time tool in Control Panel.

SQL Server 2000, 32 bit versions
  Date         Time   Version         Size       File name ---  21-Jan-2005  21:36  2000.80.1003.0    664,128  Autoplt.dll 21-Jan-2005 21:36  2000.80.1003.0     78,400  Console.exe 21-Jan-2005 21:36  2000.80.1003.0    332,352  Ctasksui.dll 21-Jan-2005 21:36  2000.80.1003.0    315,968  Custtask.dll 21-Jan-2005 21:36  2000.80.1003.0     33,340  Dbmslpcn.dll 21-Jan-2005 21:36  2000.80.1003.0  1,905,216  Dtspkg.dll 21-Jan-2005 21:36  2000.80.1003.0    528,960  Dtspump.dll 21-Jan-2005 21:36  2000.80.1003.0     41,536  Dtsrun.exe 21-Jan-2005 21:36  2000.80.1003.0  1,557,052  Dtsui.dll 21-Jan-2005 21:36  2000.80.1003.0    639,552  Dtswiz.dll 21-Jan-2005 21:36  2000.80.1003.0    352,828  Isqlw.exe 21-Jan-2005 21:36  2000.80.1003.0     82,492  Itwiz.exe 21-Jan-2005 21:36  2000.80.1003.0     90,692  Msgprox.dll 31-Dec-2004 19:16  8.11.41022.0      226,304  Mssdi98.dll 21-Jan-2005 21:36  2000.80.1003.0     62,024  Odsole70.dll 21-Jan-2005 21:37  2000.80.1003.0     25,144  Opends60.dll 21-Jan-2005 21:23                     17,576  Opends60.lib 21-Jan-2005 21:36  2000.80.1003.0     57,904  Osql.exe 21-Jan-2005 21:36  2000.80.1003.0    279,104  Pfutil80.dll 21-Jan-2005 21:36  2000.80.1003.0    143,940  Qrdrsvc.exe 21-Jan-2005 21:36  2000.80.1003.0    221,768  Replprov.dll 21-Jan-2005 21:36  2000.80.1003.0    307,784  Replrec.dll 21-Jan-2005 21:36  2000.80.1003.0    287,304  Rinitcom.dll 21-Jan-2005 21:36  2000.80.1003.0     78,416  Sdiclnt.dll 21-Jan-2005 21:36  2000.80.1003.0     66,112  Semmap.dll 21-Jan-2005 21:36  2000.80.1003.0     57,916  Semnt.dll 21-Jan-2005 21:36  2000.80.1003.0    492,096  Semobj.dll 21-Jan-2005 21:36  2000.80.1003.0     53,832  Snapshot.exe 21-Jan-2005 21:35  2000.80.1003.0     28,672  Sqlagent.dll 21-Jan-2005 21:36  2000.80.1003.0    311,872  Sqlagent.exe 21-Jan-2005 21:35  2000.80.1003.0    168,001  Sqlakw32.dll 21-Jan-2005 19:28                      4,352  Sqlakw32.lib 21-Jan-2005 21:36  2000.80.1003.0     33,344  Sqlctr80.dll 21-Jan-2005 21:36  2000.80.1003.0    815,676  Sqldata.dll 21-Jan-2005 21:36  2000.80.1003.0  4,215,360  Sqldmo.dll 21-Jan-2005 21:36                     25,172  Sqldumper.exe 21-Jan-2005 21:36  2000.80.1003.0    156,224  Sqlmaint.exe 21-Jan-2005 21:36  2000.80.1003.0    180,792  Sqlmap70.dll 21-Jan-2005 21:36  2000.80.1003.0    188,992  Sqlmmc.dll 21-Jan-2005 21:36  2000.80.1003.0    401,984  Sqlqry.dll 21-Jan-2005 21:36  2000.80.1003.0     57,920  Sqlrepss.dll 21-Jan-2005 21:36  2000.80.1003.0  7,721,041  Sqlservr.exe 21-Jan-2005 21:36  2000.80.1003.0    590,396  Sqlsort.dll 21-Jan-2005 21:36  2000.80.1003.0     45,644  Sqlvdi.dll 21-Jan-2005 21:36  2000.80.1003.0    106,588  Sqsrvres.dll 21-Jan-2005 21:36  2000.80.1003.0     33,340  Ssmsgnet.dll 21-Jan-2005 21:36  2000.80.1003.0     33,340  Ssmslpcn.dll 21-Jan-2005 21:36  2000.80.1003.0     33,340  Ssmsqlgc.dll 21-Jan-2005 21:36  2000.80.1003.0     33,340  Ssmssnet.dll 21-Jan-2005 21:36  2000.80.1003.0     82,492  Ssnetlib.dll 21-Jan-2005 21:36  2000.80.1003.0     25,148  Ssnmpn70.dll 21-Jan-2005 21:36  2000.80.1003.0    123,456  Stardds.dll 21-Jan-2005 21:36  2000.80.1003.0    158,240  Svrnetcn.dll 21-Jan-2005 21:36  2000.80.1003.0     76,416  Svrnetcn.exe 21-Jan-2005 21:37  2000.80.1003.0     49,228  Ums.dll 21-Jan-2005 21:36  2000.80.1003.0     74,304  Xplog70.dll 21-Jan-2005 21:36  2000.80.1003.0     98,872  Xpweb70.dll 21-Jan-2005 21:39                      6,473  Hotfix1.inf 21-Jan-2005 21:39                      2,524  Hotfix2.inf 31-Dec-2004 19:15  8.0.21213.0       352,256  Msvcr71.dll 31-Dec-2004 19:15  2000.80.796.0      57,904  Osql.exe 31-Dec-2004 19:15  2000.80.534.0     127,548  Sqdedev.dll 31-Dec-2004 19:15  2000.80.194.0     180,290  Sqlunirl.dll 21-Jan-2005 19:24  2000.80.1003.0    159,813  Replres.rll 21-Jan-2005 21:25  2000.80.1003.0    172,032  Semobj.rll 21-Jan-2005 19:17  2000.80.1003.0     28,672  Sqlevn70.rll 21-Jan-2005 19:38  2000.80.1003.0    479,232  Sqlmmc.rll

SQL Server 2000, 64 bit version
  Date         Time   Version         Size        File name      Platform -  22-Jan-2005  05:12  2000.80.1003.0      56,832  Dbmslpcn.dll 22-Jan-2005 05:11  2000.80.1003.0     528,960  Dtspump.dll 22-Jan-2005 05:12  2000.80.1003.0     185,856  Msgprox.dll    IA-64 31-Dec-2004 19:10  8.11.41022.0       742,912  Mssdi98.dll    IA-64 22-Jan-2005 05:12  2000.80.1003.0     151,040  Odsole70.dll   IA-64 22-Jan-2005 05:13  2000.80.1003.0      27,136  Opends60.dll   IA-64 21-Jan-2005 21:46                      19,880  Opends60.lib 22-Jan-2005 05:12  2000.80.1003.0     148,992  Osql.exe       IA-64 22-Jan-2005 05:12  2000.80.1003.0     353,280  Qrdrsvc.exe    IA-64 22-Jan-2005 05:12  2000.80.1003.0     534,528  Replprov.dll   IA-64 22-Jan-2005 05:12  2000.80.1003.0     769,024  Replrec.dll    IA-64 22-Jan-2005 05:12  2000.80.1003.0     650,240  Rinitcom.dll   IA-64 22-Jan-2005 05:12  2000.80.1003.0     160,768  Semmap.dll     IA-64 22-Jan-2005 05:12  2000.80.1003.0     132,608  Semnt.dll      IA-64 22-Jan-2005 05:12  2000.80.1003.0      88,576  Snapshot.exe   IA-64 22-Jan-2005 05:11  2000.80.1003.0      10,240  Sqlagent.dll   IA-64 22-Jan-2005 05:12  2000.80.1003.0   1,055,232  Sqlagent.exe 22-Jan-2005 05:12  2000.80.1003.0      90,112  Sqlboot.dll 22-Jan-2005 05:12  2000.80.1003.0      32,256  Sqlctr80.dll 22-Jan-2005 05:12  2000.80.1003.0     812,032  Sqldata.dll 22-Jan-2005 05:12  2000.80.1003.0  13,845,504  Sqldmo.dll     IA-64 22-Jan-2005 05:12                      39,936  Sqldumper.exe 22-Jan-2005 05:12  2000.80.1003.0     493,568  Sqlmaint.exe 22-Jan-2005 05:12  2000.80.1003.0      23,040  Sqlmap70.dll 22-Jan-2005 05:12  2000.80.1003.0     152,064  Sqlrepss.dll   IA-64 22-Jan-2005 05:13  2000.80.1003.0  25,266,688  Sqlservr.exe 22-Jan-2005 05:12  2000.80.1003.0     616,960  Sqlsort.dll    IA-64 22-Jan-2005 05:12  2000.80.1003.0     120,320  Sqlvdi.dll     IA-64 22-Jan-2005 05:12  2000.80.1003.0     227,328  Sqsrvres.dll   IA-64 22-Jan-2005 05:12  2000.80.1003.0      53,760  Ssmslpcn.dll 22-Jan-2005 05:12  2000.80.1003.0      59,904  Ssmsqlgc.dll 22-Jan-2005 05:12  2000.80.1003.0     256,000  Ssnetlib.dll 22-Jan-2005 05:12  2000.80.1003.0      20,992  Ssnmpn70.dll 22-Jan-2005 05:12  2000.80.1003.0     430,080  Svrnetcn.dll 22-Jan-2005 05:12  2000.80.1003.0     185,856  Svrnetcn.exe 22-Jan-2005 05:12  2000.80.1003.0     183,296  Xplog70.dll    IA-64 22-Jan-2005 05:12  2000.80.1003.0     187,392  Xpweb70.dll    IA-64 22-Jan-2005 05:15                       5,065  Hotfix1.inf 31-Dec-2004 19:10  2000.80.962.0       57,904  Osql.exe       x86 31-Dec-2004 19:10  2000.80.760.0      269,824  Sqdedev.dll 21-Jan-2005 22:00  2000.80.1003.0     146,432  Replres.rll 21-Jan-2005 21:47  2000.80.1003.0      19,968  Sqlevn70.rll Note Because of file dependencies, the most recent hotfix that contains these files may also contain additional files.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed in the &quot;Applies to&quot; section.



MORE INFORMATION
The following code is a demonstration to reduce the partition view to select from only the relevant partition table: Example: SELECT * FROM ( SELECT i.TxVal AS TxVal, 1 AS CntClick, c.[DateTime] AS DateTimeStart, ti.DateTimeEnd AS DateTimeComplete, i.[DateTime] AS MeasureDateTimeComplete FROM dbo.VW_Clicks c INNER JOIN dbo.TxImprint ti ON (c.ClickID = ti.ClickID) INNER JOIN dbo.VW_Imprint i ON (ti.TxImprintID = i.ID) WHERE c.UserID IS NOT NULL ) t1 WHERE t1.DateTimeStart BETWEEN '20041001 09:00:00' AND '20041008 10:00:00' AND t1.DateTimeComplete BETWEEN '20041001 09:00:00' AND '20041008 10:00:00' AND t1.MeasureDateTimeComplete BETWEEN '20041001 09:00:00' AND '20041008 10:00:00' The data is partitioned by year and by month, and dbo.VW_Clicks and dbo.VW_Imprint are the partitioning views. The execution plan shows that the correct partition table is chosen. However, a table scan is used to collect the data from the underlying tables:

StmtText

Compute Scalar(DEFINE:([Clicks_20041001_20041101].[DateTime]=[Clicks_20041001_20041101].[DateTime]))


 * --Compute Scalar(DEFINE:([Impressions_20041001_20041101].[DateTime]=[Impressions_20041001_20041101].[DateTime], [Impressions_20041001_20041101]. [TxVal]=[Impressions_20041001_20041101].[TxVal]))


 * --Hash Match(Inner Join, HASH:([ti].[TxImprintID])=([Impressions_20041001_20041101].[ID]), RESIDUAL:([ti].[TxImprintID]=[Impressions_20041001_20041101].[ID]))


 * --Hash Match(Inner Join, HASH:([ti].[ClickID])=([Clicks_20041001_20041101].[ClickID]), RESIDUAL:([ti].[ClickID]=[Clicks_20041001_20041101].[ClickID]))


 * |--Clustered Index Seek(OBJECT:([Repro_LPV].[dbo].[TxImprint].[PK_TxImprint] AS [ti]), SEEK:([ti].[DateTimeEnd] >= 'Oct 1 2004 9:00AM' AND [ti].[DateTimeEnd] <= 'Oct 8 2004 10:00AM') ORDERED FORWARD)


 * |--Table Scan(OBJECT:([Repro_LPV].[dbo].[Clicks_20041001_20041101]), WHERE:(([Clicks_20041001_20041101].[UserID]<>NULL AND [Clicks_20041001_20041101].[DateTime]>='Oct 1 2004 9:00AM') AND [Clicks_20041001_20041101].[DateTime]<='Oct 8 2004 10:00AM'))


 * --Table Scan(OBJECT:([Repro_LPV].[dbo].[Impressions_20041001_20041101]), WHERE:([Impressions_20041001_20041101].[DateTime]>='Oct 1 2004 9:00AM' AND [Impressions_20041001_20041101].[DateTime]<='Oct 8 2004 10:00AM'))

If you change the partitioning views so that they only select from the single partition tables by using only one select statement left, no union all, the execution plan is different. It now uses NL joins, index seeks, and filters instead of using hash match and table scans:

StmtText

Parallelism(Gather Streams)


 * --Filter(WHERE:([Impressions_20041001_20041101].[DateTime]>='Oct 1 2004 9:00AM' AND [Impressions_20041001_20041101].[DateTime]<='Oct 8 2004 10:00AM'))


 * --Bookmark Lookup(BOOKMARK:([Bmk1003]), OBJECT:([Repro_LPV].[dbo].[Impressions_20041001_20041101]))


 * --Nested Loops(Inner Join, OUTER REFERENCES:([ti].[TxImprintID]) WITH PREFETCH)


 * --Filter(WHERE:(([Clicks_20041001_20041101].[UserID]<>NULL AND [Clicks_20041001_20041101].[DateTime]>='Oct 1 2004 9:00AM') AND [Clicks_20041001_20041101].[DateTime]<='Oct 8 2004 10:00AM'))


 * --Bookmark Lookup(BOOKMARK:([Bmk1000]), OBJECT:([Repro_LPV].[dbo].[Clicks_20041001_20041101]))


 * --Nested Loops(Inner Join, OUTER REFERENCES:([ti].[ClickID]) WITH PREFETCH)


 * --Sort(ORDER BY:([ti].[ClickID] ASC))


 * ||--Clustered Index Seek(OBJECT:([Repro_LPV].[dbo].[TxImprint].[PK_TxImprint] AS [ti]), SEEK:([ti].[DateTimeEnd] >= 'Oct 1 2004 9:00AM' AND [ti].[DateTimeEnd] <= 'Oct 8 2004 10:00AM') ORDERED FORWARD)


 * --Index Seek(OBJECT:([Repro_LPV].[dbo].[Clicks_20041001_20041101].[ID_Clicks_20041001_20041101]), SEEK:([Clicks_20041001_20041101].[ClickID]=[ti].[ClickID]) ORDERED FORWARD)


 * --Index Seek(OBJECT:([Repro_LPV].[dbo].[Impressions_20041001_20041101].[ID_Impressions_20041001_20041101]), SEEK:([Impressions_20041001_20041101].[ID]=[ti].[TxImprintID]) ORDERED FORWARD)

For more information about the naming schema for Microsoft SQL Server updates, click the following article number to view the article in the Microsoft Knowledge Base:

822499 New naming schema for Microsoft SQL Server software update packages

For more information about the terminology that Microsoft uses when it corrects software after the software is released, click the following article number to view the article in the Microsoft Knowledge Base:

824684 Description of the standard terminology that is used to describe Microsoft software updates

Keywords: kbbug kbfix kbqfe kbhotfixserver KB892935

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.