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, ...
Suggested Answer

Table index unit Testing

(0) ShareShare
ReportReport
Posted on by 229

Hi friends,

I'm a real newbie here.

Here's the point, i m making some corrections on Best Pratices from an internal tool we are working on it.

This tool was developed by many people before i come.

I got to deal with some indexes, got to choose the good one and set up the property to be used correctly (replacement key and so on).

When i will finish this task i was wondering on the way to make some unit test to check if i did it good or not ?

Do you have some ideas on the way to do it ?

Regards.

I have the same question (0)
  • Awaxx Profile Picture
    229 on at

    Someone for some help please ?

  • Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    How to test whether your changes fixed the problem depends on what the problem was. Can you explain it to us, please? We can't tell you much without it.

  • Awaxx Profile Picture
    229 on at

    My problem is first to learn what could be the impact of indexes on tables and related tables ?

    Then i wanna know how to choose properties correctly for each kind of behaviours.

    And finally how could i use unit test to check if its good ?

    I hope i have better explained myself.

    Thanks.

  • Suggested answer
    Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    Indexes may look like a simple topic, but if I want to understand their impact thoroughly, you'll find that it's not actually that simple. You can find a plenty of information on internet, e.g. SQL Server and Azure SQL index architecture and design guide.

    In short, indexes improve performance by avoiding the need to scan all data in a table. But keeping the updated takes time and resources (therefore you don't want excessive number and size of indexes). They are also used to enforce data uniqueness. They also have impact on locking.

    Before you can test your changes, ask yourself why you added the index. For example, if you did it to enforce uniqueness, you may want to test whether no duplicate records can be created. Or if you did it to solve a performance problem with a query, you may measure performance before and after adding your index.

  • Awaxx Profile Picture
    229 on at

    Thank you goshoom for the answer.

    You re right i got to ask myself first what is the purpose of using index.

    The reason why using index in my case, is to enforce uniqueness and my actual issue is many errors like "record already exist" or other comparison issues.

  • Martin Dráb Profile Picture
    237,976 Most Valuable Professional on at

    You get "record already exist" if you're trying to save a record that violates uniqueness requirements. It seems that some of your current logic doesn't expect this field (or combination of fields) to be unique.

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
André Arnaud de Calavon Profile Picture

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

#2
Martin Dráb Profile Picture

Martin Dráb 422 Most Valuable Professional

#3
BillurSamdancioglu Profile Picture

BillurSamdancioglu 239 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans