Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Customer experience | Sales, Customer Insights,...
Unanswered

Slowness at particular time

(0) ShareShare
ReportReport
Posted on by 7,755

Hi,

We have implemented MS Dynamics CRM 8.2 on-premise and we have huge customizations on case entities even we have created maximum attributes on case entity.

About 8 plugins running on the creation of the case entity.

From the last one month, Users are facing slowness for half an hour between 11:30 AM to 1:30 PM. During slowness, a case takes 7 minutes to get saved.

Users are able to create other entities record and slowness happened only for Case entity.

We have checked the event log, disabled plugins but it did not resolve the issue.

Please let me know what is the possible cause of it.

  • Dynamics365 Rocker Profile Picture
    7,755 on at
    RE: Slowness at particular time

    Thanks for your response.

    There is no high fragmentation on the case entity and also no scheduled maintenance job for that particular time.

    It may be different cause of slowness.

  • Gustavo Longo Profile Picture
    on at
    RE: Slowness at particular time

    Hello Dynamics365 Rocker,

    I hope you are well.

    Review the index fragmentation level for Case entity.

    -- Ensure a USE  statement has been executed first.
    USE AdventureWorks
    GO
    
    -- Look at the Index Information
    SELECT
    DB_NAME(idxst.database_id) AS [database_name],
    OBJECT_NAME(idxst.object_id, idxst.database_id) AS [object_name],
    QUOTENAME(idxif.name) [index_name],
    CASE 
    WHEN avg_fragmentation_in_percent < 10 THEN 'LOW'
    WHEN avg_fragmentation_in_percent < 30 THEN 'MEDIUM'
    WHEN avg_fragmentation_in_percent < 50 THEN 'HIGH'
    ELSE 'EXTREME'
    END as fragmentation_indicator,
    idxst.*
    FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL, NULL , 'LIMITED') AS idxst -- not using DETAILED or SAMPLED
    INNER JOIN sys.indexes idxif ON idxst.object_id = idxif.object_id AND idxst.index_id = idxif.index_id
    ORDER BY [object_name], [index_name]
    GO
    
    -- Look at the usage of the indexes within all tables
    SELECT ops.database_id, ops.index_id, 
    DB_NAME(ops.database_id) AS database_name, OBJECT_NAME(ops.object_id, database_id) AS tableview_name, idx.[name] as index_name,
    ops.range_scan_count, ops.singleton_lookup_count, ops.row_lock_count, ops.page_lock_count
    FROM sys.dm_db_index_operational_stats(DB_ID(), NULL, NULL, NULL) AS ops
    RIGHT JOIN sys.indexes AS idx ON ops.object_id = idx.object_id and ops.index_id = idx.index_id
    WHERE ops.database_id = DB_ID() AND ops.object_id > 100
    ORDER BY ops.range_scan_count ASC, ops.row_lock_count DESC, ops.page_lock_count DESC
    GO
    

    If you have high levels of fragmentation, please, apply script to rebuild/reorganize them.

    SET NOCOUNT ON;
    DECLARE @objectid int;
    DECLARE @indexid int;
    DECLARE @partitioncount bigint;
    DECLARE @schemaname nvarchar(130);
    DECLARE @objectname nvarchar(130);
    DECLARE @indexname nvarchar(130);
    DECLARE @partitionnum bigint;
    DECLARE @partitions bigint;
    DECLARE @frag float;
    DECLARE @command nvarchar(4000);
    SELECT
    object_id AS objectid,
    index_id AS indexid,
    partition_number AS partitionnum,
    avg_fragmentation_in_percent AS frag
    INTO #work_to_do
    FROM sys.dm_db_index_physical_stats (DB_ID(), NULL, NULL , NULL, 'LIMITED')
    WHERE avg_fragmentation_in_percent > 10.0 AND index_id > 0;
    DECLARE partitions CURSOR FOR SELECT * FROM #work_to_do;
    OPEN partitions;
    WHILE (1=1)
    BEGIN;
    FETCH NEXT
    FROM partitions
    INTO @objectid, @indexid, @partitionnum, @frag;
    IF @@FETCH_STATUS < 0 BREAK;
    SELECT @objectname = QUOTENAME(o.name), @schemaname = QUOTENAME(s.name)
    FROM sys.objects AS o
    JOIN sys.schemas as s ON s.schema_id = o.schema_id
    WHERE o.object_id = @objectid;
    SELECT @indexname = QUOTENAME(name)
    FROM sys.indexes
    WHERE object_id = @objectid AND index_id = @indexid;
    SELECT @partitioncount = count (*)
    FROM sys.partitions
    WHERE object_id = @objectid AND index_id = @indexid;
    IF @frag < 30.0
    SET @command = N'ALTER INDEX '   @indexname   N' ON '   @schemaname   N'.'   @objectname
      N' REORGANIZE';
    IF @frag >= 30.0
    SET @command = N'ALTER INDEX '   @indexname   N' ON '   @schemaname   N'.'   @objectname
      N' REBUILD';
    IF @partitioncount > 1
    SET @command = @command   N' PARTITION='   CAST(@partitionnum AS nvarchar(10));
    EXEC (@command);
    PRINT N'Executed: '   @command;
    END;
    CLOSE partitions;
    DEALLOCATE partitions;
    DROP TABLE #work_to_do;
    GO
    

    Moreover, apply script to update statistics.

    exec sp_MSForEachTable "UPDATE STATISTICS ? with fullscan"

    Finally, as the issue is happening on specific timeframe, I would say to validate the Maintenance Jobs schedule.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Daivat Vartak – Community Spotlight

We are honored to recognize Daivat Vartak as our March 2025 Community…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Kudos to the February Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 292,863 Super User 2025 Season 1

#2
Martin Dráb Profile Picture

Martin Dráb 231,723 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156 Moderator

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans