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

Notifications

Announcements

No record found.

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 85

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
    301,075 Super User 2025 Season 2 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
    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
    85 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
    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

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

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

#1
Martin Dráb Profile Picture

Martin Dráb 551 Most Valuable Professional

#2
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 450 Super User 2025 Season 2

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 278 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans