I have an ongoing issue which is in critical phase at this point, any needful suggestions on this issue would be greatly appreciated.We are running below query on SQL Server 2014 instance for X database, and this query is taking around 12 minutes to complete, where as the same query on same database is getting completed in less than 2 minutes in this case SQL instance hosted on SQL Server 2012.PROD --> SQL Server 2012UAT --> SQL Server 2014To the matter of the fact UAT infrastructure and CPU & RAM assignment levels better when compared to PROD environment.Index Rebuild, Update Stats kind of maintenance related activities are up-to-date on the database.Below is the query which we are trying to run on both the cases.SELECT DISTINCT OBJECT_NAME(part.object_id) as TableName ,ss.name as SchemaName ,psch.name as PartitionSchemeName ,pfun.name as PartitionFunctionName ,c.name as ColumnName ,CONVERT(NVARCHAR(128),prng.value) AS PartitionValue ,prng.boundary_id AS BoundaryId ,CASE WHEN pfun.boundary_value_on_right = 1 THEN 'R' ELSE 'L' END as RangeType ,'{0}' As ServerGroupName FROM sys.partitions part JOIN sys.indexes idx ON part.[object_id] = idx.[object_id] and part.index_id = idx.index_id JOIN sys.data_spaces dsp ON idx.data_space_id = dsp.data_space_id JOIN sys.partition_schemes psch ON dsp.data_space_id = psch.data_space_id JOIN sys.partition_functions pfun ON psch.function_id = pfun.function_id JOIN sys.Tables st ON st.object_id = idx.Object_id and idx.index_id < 2 JOIN sys.schemas ss ON ss.schema_id = st.schema_id JOIN sys.index_columns ic on(ic.partition_ordinal > 0 and ic.index_id = idx.index_id and ic.object_id = st.object_id) JOIN sys.columns c on(c.object_id = ic.object_id and c.column_id = ic.column_id) JOIN sys.partition_range_values prng ON prng.function_id=pfun.function_id --where OBJECT_NAME(part.object_id) NOT IN ('OdsCTPView_Bss_Line_Item') ORDER BY TableName,prng.Boundary_id Please assist. Thanks.
↧