AXForum  
Вернуться   AXForum > Microsoft Dynamics AX > DAX Blogs
DAX
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 26.04.2012, 13:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
ax-erp: Performance – find() vs. exist() method
Источник: http://microsoft-dynamics-ax-erp.blo...st-method.html
==============

Someone asked me what is the need to have an exist() method when we have a find() method already declared on a table? Logically, exist() checks if a record with a given key exists and find also nearly does the same thing, it fetches the actual record? So why the need for an exist() method? Well, the answer is performance.

The find() method always returns a buffer of the table on which it is called whereas if you look at the syntax of the exist() method, it only returns the RecId. Selecting only a single field versus the entire table takes less time.

On my test machine, calling the exist() method on CustTable with 2000 records finished in 0.0136 milliseconds whereas find() took 0.1388 milliseconds. The rule of thumb is, querying on any indexed field will always be faster than a non-indexed field. So, even if the exist() method on CustTable was selecting AccountNum or PartyId, it would return in 0.0136 m/s only.

Performance degrades only when you mix fields, so selecting (RecId, Name) will slow down to 0.1388 and that is as good as the find() method.

So the bottom line is that exist() methods exist because there are faster than find() methods when large number of records are being queried and helps improve performance.


Источник: http://microsoft-dynamics-ax-erp.blo...st-method.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
emeadaxsupport: New Content for Microsoft Dynamics AX 2012 : October 2011 Blog bot DAX Blogs 0 27.10.2011 17:11
axinthefield: Dynamics AX Event IDs Blog bot DAX Blogs 0 01.03.2011 22:11
daxdilip: Whats New in Dynamics AX 2012 (A brief extract from the recently held Tech Conf.) Blog bot DAX Blogs 7 31.01.2011 12:35
daxline: Performance – find() vs. exist() method Blog bot DAX Blogs 0 28.01.2011 23:14
emeadaxsupport: List of fixes that improve performance of certain features in Dynamics AX 2009 Blog bot DAX Blogs 0 13.10.2009 19:06

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 18:03.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.