Skip to main content

Notifications

Announcements

No record found.

Finance | Project Operations, Human Resources, ...
Suggested answer

Table index unit Testing

(0) ShareShare
ReportReport
Posted on by 203

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.

  • Martin Dráb Profile Picture
    Martin Dráb 230,354 Most Valuable Professional on at
    RE: Table index unit Testing

    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.

  • Awaxx Profile Picture
    Awaxx 203 on at
    RE: Table index unit Testing

    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.

  • Suggested answer
    Martin Dráb Profile Picture
    Martin Dráb 230,354 Most Valuable Professional on at
    RE: Table index unit Testing

    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
    Awaxx 203 on at
    RE: Table index unit Testing

    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.

  • Martin Dráb Profile Picture
    Martin Dráb 230,354 Most Valuable Professional on at
    RE: Table index unit Testing

    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
    Awaxx 203 on at
    RE: Table index unit Testing

    Someone for some help please ?

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

Congratulations 2024 Spotlight Honorees!

Kudos to all of our 2024 community stars! 🎉

Meet the Top 10 leaders for December!

Congratulations to our December super stars! 🥳

Get Started Blogging in the Community

Hosted or syndicated blogging is available! ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,622 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,354 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans