Symptoms
When you try to build an index (by using CREATE INDEX or ALTER INDEX) on a spatial data type of a large table, Microsoft SQL Server 2012 or SQL Server 2014 may perform poorly. You can find many spinlock contentions on SOS_CACHESTORE and SOS_SELIST_SIZED_SLOCK.
Resolution
The issue was first fixed in the following cumulative update of SQL Server.
Cumulative Update 1 for SQL Server 2014 /en-us/help/2931693
Cumulative Update 7 for SQL Server 2012 SP1 /en-us/help/2894115
Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:
Hotfix update package information A supported hotfix is available from Microsoft. However, this hotfix is intended to correct only the problem that is described in this article. Apply this hotfix only to systems that are experiencing this specific problem.
If the hotfix is available for download, there is a "Hotfix Download Available" section at the top of this Knowledge Base article. If this section does not appear, submit a request to Microsoft Customer Service and Support to obtain the hotfix. Note If additional issues occur or if any troubleshooting is required, you might have to create a separate service request. The usual support costs will apply to additional support questions and issues that do not qualify for this specific hotfix. For a complete list of Microsoft Customer Service and Support telephone numbers or to create a separate service request, visit the following Microsoft website:http://support.microsoft.com/contactus/?ws=supportNote The "Hotfix Download Available" form displays the languages for which the hotfix is available. If you do not see your language, it is because a hotfix is not available for that language.
More Information
Spinlocks protect the common language runtime (CLR) procedure cache entries. The query plan for a created or altered index usually involves an Apply operator or a Nested Loop operator. The outer side of the JOIN operation is returning rows from the spatial table and driving the spatial function. Every time that the function is invoked, a spinlock may be used. When the query runs with high degrees of parallelism, the spinlocks may become a bottleneck. The following diagram is an example of such a spatial plan.
Status
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.
References
For more information about another performance issue when you build an index on a spatial data type of a large table in SQL Server 2012, click the following article number to view the article in the Microsoft Knowledge Base:
2887888 FIX: Slow performance in SQL Server when you build an index on a spatial data type of a large table in a SQL Server 2012 instance