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

Community site session details

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

Data Entity export slow

(0) ShareShare
ReportReport
Posted on by 625

I'm creating a new data entity from standard PurchPurchaseOrderLineV2Entity, with 10+ virtual fields that are assigned values in postLoad() method.

The new method added has some select / while select query written to select the column lists required, and index hint is used as well.  

I have around 400K records, export the standard (PurchPurchaseOrderLineV2Entity) data entity quite slow but still can complete, but the new data entity is not. There is no error, it is always in executing status. Count in SQL, staging is inserting records, about 100K after 4 hours. 

My question is, what could be wrong to the new data entity ?  Is virtual field a problem to the long running process ?  

I have the same question (0)
  • Suggested answer
    tyhj Profile Picture
    625 on at
    RE: Data Entity export slow

    Skip staging is working!! It is because postLoad method is overridden. Now the export execute about 30 minutes with computed fields.

  • tyhj Profile Picture
    625 on at
    RE: Data Entity export slow

    I have changed my columns to computed fields, trying the export with "Skip staging" turn on, but still there is staging data exported. Tried refresh entity, restart everything but still the same. So I had no choice but to use the filter.

  • tyhj Profile Picture
    625 on at
    RE: Data Entity export slow

    Yes, I'm looking how to enable change tracking. Hopefully this can help. I think export should happen at least once a month.

    After about 8 hours I'm still waiting for the process to complete but anyhow the slowness may not be tolerable to the user. Worst case I'll need to change to computed field.

  • Verified answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Data Entity export slow

    Also, as suggested above, you could try to use change tracking (or other filtering) and avoid exporting all purchase orders every time. After all, once the PO is invoiced it will never change anymore and should not be needed to be exported again and again.

  • tyhj Profile Picture
    625 on at
    RE: Data Entity export slow

    I did try to add PurchTable at first, it is running slow also. I can give it a try but I have quite some tables to add.  

  • Suggested answer
    nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Data Entity export slow

    How about adding VendInvoiceInfoTable as a data source in your entity?

  • tyhj Profile Picture
    625 on at
    RE: Data Entity export slow

    When comparing standard data entity it take about half an hour to run 400k records. I have tried comment out the code in postLoad, but the export is also running slow. So I suspect it is the unmapped field that is added to the entity object that cause the slowness.

    In postLoad(), there are virtual fields to select from other tables

    VendInvoiceInfoTable vendInvoiceInfoTable = this.vendInvoiceInfoTable(this.PurchaseOrderNumber);

    this.InvoiceNumber = vendInvoiceInfoTable.Num;

    private VendInvoiceInfoTable vendInvoiceInfoTable(PurchId _purchId)

    {

           VendInvoiceInfoTable invoiceInfoTable;

           select firstonly Num, DocumentDate from invoiceInfoTable

               index hint PurchIdx

               order by CreatedDateTime desc

               where invoiceInfoTable.PurchId == _purchId;

           return invoiceInfoTable;

    }

    Is computed field better to use in this scenario ?

  • Suggested answer
    Rahul Mohta Profile Picture
    21,032 on at
    RE: Data Entity export slow

    enable change tracking and schedule export for delta records that way this would not be huge

    other way would be seperate the computed column to a new entity and have that schedule seperately than the original one

  • Verified answer
    Sergei Minozhenko Profile Picture
    23,093 on at
    RE: Data Entity export slow

    Hi

    Exporting this amount of data using staging tables is always slow. If there is a real need to export all data at once every time I would suggest using the "Skip staging" option, but in this case "computed columns" is only the option as PostLoad method doesn't work with "Skip staging" parameter.

    BR, Sergei

  • nmaenpaa Profile Picture
    101,160 Moderator on at
    RE: Data Entity export slow

    You can easily see if your code makes it slow, by temporarily commenting out the code and running the export again.

    Virtual field itself is not a problem but if you run some SQL query 400 000 times it might take time.

    Could you also consider sharing the code with us?

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…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

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

#1
CA Neeraj Kumar Profile Picture

CA Neeraj Kumar 2,351

#2
André Arnaud de Calavon Profile Picture

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

#3
Sohaib Cheema Profile Picture

Sohaib Cheema 638 User Group Leader

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans