# Examine giving index versus For and if search performance

**URL:** <https://techcommunity.softwareag.com/t/examine-giving-index-versus-for-and-if-search-performance/201358>\
**Category:** Forum\
**Tags:** Adabas-Natural, Natural, Natural-on-Mainframes\
**Created:** [October 21, 2018, 2:03pm UTC](https://techcommunity.softwareag.com/t/examine-giving-index-versus-for-and-if-search-performance/201358 "2018-10-21T14:03:47Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Javier\_Gonzalez2](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/javier_gonzalez2/32/6988_2.png) [@Javier\_Gonzalez2](https://techcommunity.softwareag.com/u/Javier_Gonzalez2)\
**Post date:** [October 21, 2018, 2:03pm UTC](https://techcommunity.softwareag.com/t/examine-giving-index-versus-for-and-if-search-performance/201358/1 "2018-10-21T14:03:47Z")

</div>

Hi, there.  
I was testing an examine giving index and for if loop to search just a first value.  
As a result I get FOR and IF has better performance than examine giving index.  
It seem that examine always search the full array.  
What’s your opinion ?  
Any way to optimise using examine ?

---

<div class="post-metadata">

**Author:** ![Ralph\_Zbrog](https://sea1.discourse-cdn.com/techcommunity/user_avatar/techcommunity.softwareag.com/ralph_zbrog/32/78_2.png) [@Ralph\_Zbrog](https://techcommunity.softwareag.com/u/Ralph_Zbrog)\
**Post date:** [October 22, 2018, 7:42am UTC](https://techcommunity.softwareag.com/t/examine-giving-index-versus-for-and-if-search-performance/201358/2 "2018-10-22T07:42:22Z")

</div>

Use the Forum’s search function to see that EXAMINE performance has been discussed several times, with the technique of redefining an array as a scalar getting most of the attention.

Remember that no single technique will give you the best performance in every situation. A number of factors affect performance, including number of occurrences, search string length, and target string length. Every technique has a point of diminishing returns (i.e. where it starts performing badly), so test to see which works best in your situation.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/techcommunity/original/3X/c/d/cd19967bb605d28a72d77eb83a1cae22f3df2eb8.svg) [@system](https://techcommunity.softwareag.com/u/system)\
**Post date:** [April 2, 2021, 3:41pm UTC](https://techcommunity.softwareag.com/t/examine-giving-index-versus-for-and-if-search-performance/201358/3 "2021-04-02T15:41:39Z")

</div>


