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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 31.07.2007, 15:00   #1  
Blog bot is offline
Blog bot
Участник
 
25,475 / 846 (79) +++++++
Регистрация: 28.10.2006
axcoder: Unwanted fields fetching when selecting by unique index
Источник: http://axcoder.blogspot.com/2007/07/...selecting.html
==============

Last friday i was optimizing a form with a lof of display fields with an implementation like the following:

X++:
display EmplName emplName()
{
  return EmplTable::find(this.EmplID).Name;
}
The one of sources to increase performance of such code is to select only fields which will be used lately. So I have replaced this code with the following:

X++:
display EmplName emplName()
{
  return this.EmplID ?
         (select Name from EmplTable
              where EmplTable.emplID==this.EmplID).Name
         :
         "";
}
but when I enabled SQL tracing, I found, that this code producess select with ALL fields of EmplTable.
It was strange... With a great help of my co worker, i've found the following:
  • when there is only fields of any unique index in the where condition, all fields are fetched
  • when there is an extra field in the condition, only required fields is selected (and the extra fields in where)
  • So I converted previously mentioned methods to the following:

X++:
display EmplName emplName()
{
  return this.EmplID ?
         (select Name from EmplTable
              where EmplTable.emplID==this.EmplID
                     &&
                     EmplTable.recID
          ).Name
         :
         "";
}

Источник: http://axcoder.blogspot.com/2007/07/...selecting.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
palleagermark: Saving the reference to a unique record as a string Blog bot DAX Blogs 0 20.10.2008 11:05
axaptafreak: Getting new table fields into your form datasource Blog bot DAX Blogs 2 24.01.2008 22:51
Dynamics AX: SQL Tuning: Table & Index Scans Blog bot DAX Blogs 0 20.07.2007 11:50
Fred Shen: Tips on optimizing primary index in Axapta Blog bot DAX Blogs 0 28.10.2006 16:40
Говорят вышел SP2 для Axapta 3. Кто нибуть что знает на эту тему? soin DAX: Прочие вопросы 10 13.10.2003 10:43

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

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

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