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 :
Microsoft Dynamics AX (Archived)

Performance Issue with insert_recordset

(0) ShareShare
ReportReport
Posted on by 3,945

Hi experts,

We have a X++ query , which we are using to fetch data and inserting into temp Table.

In this query we are using insert_recordset to insert in temp table and 6 joins to extract data but we are facing performance issue with the same.

So is there any way to optimize this query.

Kindly suggest me , Thanks

*This post is locked for comments

I have the same question (0)
  • Martin Dráb Profile Picture
    239,084 Most Valuable Professional on at

    (Un)fortunately you're not the first one trying to improve performance of a query, therefore you'll find previous discussions on this topic. What I recommend the most is running the query in SSMS and collect statistics and the actual execution plan, which will tell you how exactly is your query executed, which part it the slowest etc.

    Also, make sure that your insert_recordset isn't turned to row-by-row processing for some reason (they're explained in documentation, if you're not familiar with them).

    By the way, isn't is an InMemory temporary table?

  • Gautam Profile Picture
    3,945 on at

    Hi Martin ,

    Thanks for your reply

    Table is tempdb, not InMemory.

  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    You probably have not eliminated the root causes of poor performance for queries, which are some of the following:

    - use a field list for every table

    - selection criteria in the where clause have covering indexes on the tables

    - sorting and grouping fields have covering indexes too

    - use exists joins wherever possible if values are not used from the table or from child tables

    - make sure the set-based operations do not fall back to row-based operations to speed up processing in SQL

    - make sure your SQL Database statistics and indexes have a maintenance for fragmentation and keeping them up-to-date

  • Gautam Profile Picture
    3,945 on at

    Thanks Vilmos for prompt reply, I will cross check my query.

  • Martin Dráb Profile Picture
    239,084 Most Valuable Professional on at

    The advantage of analyzing the execution plans and statistics is that you don't have to guess what's causing the problem (fetching unnecessary data, performing a full scan because of a missing index etc.) and trying random fixes; you can see the problem in the data and you can focus on the right thing.

  • Vilmos Kintera Profile Picture
    46,149 on at

    Please make sure you mark helpful answers as verified to resolve the topic.

  • Manmohan Mehta Profile Picture
    1,185 on at

    Hi Gautam,

    Please ensure that you don't have insert method overridden on you temptable as this may also lead to performance issues...

  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Can you please make sure you tick the checkboxes for helpful answers next to each post, so the topic gets resolved? Thank you.

  • Gautam Profile Picture
    3,945 on at

    Sure Vilmos.

    Thanks for your suggestion.

  • Vilmos Kintera Profile Picture
    46,149 on at

    If you have been able to resolve the issue, please give us some summary on what was the problem, so others with similar problems would know where to look. Thank you

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!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Basit Profile Picture

Basit 1

#1
GL-01081504-0 Profile Picture

GL-01081504-0 1

#1
Roya Profile Picture

Roya 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans