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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 09.12.2015, 18:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
SysDictCoder: Performance considerations: aggregate functions
Источник: http://feedproxy.google.com/~r/sysdi...3/_0PQkaJT_KQ/
==============

It’s time for another quick performance tip. During a reviews sometimes I come across code like this (table changed to protect the guilty):

ProdTable prodTable; real total; ; while select prodTable { total += prodTable.QtySched; } return total;
Someone forgot that there’s such a thing as aggregate methods in queries. It’s a lot faster to let SQL Server do the work for you by calculating the sum in a single statement instead of fetching all records and do the calculation in Ax.

When I see something like that I recommend to rewrite it.

ProdTable prodTable; real total; ; select sum(QtySched) from ProdTable; total = prodTable.QtySched; return total;
This is a lot faster. I ran both scenario’s 5000 times for 252 production orders in the USMF demo company on Ax 2012 R3.


Quite a difference, no? Not only is it faster but it’s also more readable because it literally says what it does.

It was actually worse than this because the original code was part of an uncached display method on a table. Can you imagine the effect when it’s used in a grid on a form?

So for the love of insert deity of choice here please use aggregate functions when possible. It’s a low effort, low risk change that can make a noticeable difference.



Источник: http://feedproxy.google.com/~r/sysdi...3/_0PQkaJT_KQ/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
SysDictCoder: Performance considerations: event handlers Blog bot DAX Blogs 0 04.12.2015 17:11
emeadaxsupport: A few performance considerations for Multisite activation in MS Dynamics AX 2009 SP1 Blog bot DAX Blogs 0 16.10.2015 21:11
emeadaxsupport: AX Performance - What information and data to collect when you want to open a support case Blog bot DAX Blogs 0 29.09.2015 15:11
emeadaxsupport: Managing general performance issues in Microsoft Dynamics AX Blog bot DAX Blogs 0 12.09.2014 12:11
emeadaxsupport: AX Performance Troubleshooting Checklist Part 2 Blog bot DAX Blogs 0 09.09.2014 16:11

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 16:59.