web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :
Finance | Project Operations, Human Resources, ...
Unanswered

Process runs slow in Batch job when record count greater than 15K

(0) ShareShare
ReportReport
Posted on by 89

Hi Team 

I came across a weird issue - I have a class which does some process and it's running in batch job 

Scenario 1: 

When I have 5000 record in my table, and the batch job loops thru the table records(5000) to do some operations on those records, basically it's just taking approx 10-12 minutes to process 5000 records in batch 

whereas, 

Scenario 2: 

Processing 15K records, I observed via SQL that it's running slower than Scenario 1, It was been observed that for 5K record - it took approx. 30min, and to process whole 15K record it took approx. 2 hours.

Did anyone face similar issue anytime?

Am I missing anything ?

I tried implementing - clearing cache, queryrun.next(), following all BP etc.. 

Please help. thanks!

I have the same question (0)
  • André Arnaud de Calavon Profile Picture
    303,679 Super User 2026 Season 1 on at

    Hi Rahul,

    Can you share your coding, so we can try to assist? On what level(s) do you have try/catch and/or ttsbegin and ttscommits? Have you also considered splitting the batch job into multiple tasks; each with a different part of the dataset?

  • zhifeng Profile Picture
    Microsoft Employee on at

    Hello Rahul,

    Agree with Andre, we need to understand how your code is designed. And did you put 15K records in one large transaction or split to multiple transcations? Have you tried multiple task?

  • RahulD365 Profile Picture
    89 on at

    Sorry I forgot to mention that :)

    Yes, it's running in multithread and it's simple run method where it has ttslevel correctly placed.

    Run method is just trying to loop the record from the table and generate XML in the Azure file storage folder.

    ttsbegin;

    While select SomeTable

    where SomeTable.status = 'Pending'

    {

    // splitting the task upto 1000 records in one batch task

    //Via using contract class, trying to place the XML generated to Azure storage folder

    }

    ttscommit;

    I'm just trying to understand why it's taking so much time for 15K record, whereas 5K record just get executed in 10-12 min.?

  • zhifeng Profile Picture
    Microsoft Employee on at

    Why do we need ttsbegin, per my understanding we just query data and send it to xml.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Congratulations to our 2025 Community Spotlights

Thanks to all of our 2025 Community Spotlight stars!

Leaderboard > Finance | Project Operations, Human Resources, AX, GP, SL

#1
Giorgio Bonacorsi Profile Picture

Giorgio Bonacorsi 617

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 461 Super User 2026 Season 1

#3
Syed Haris Shah Profile Picture

Syed Haris Shah 298 Super User 2026 Season 1

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans