AXForum  
Вернуться   AXForum > Прочие обсуждения > Курилка
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 19.05.2023, 12:53   #1  
fed is offline
fed
Moderator
Аватар для fed
Ex AND Project
Соотечественники
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
2,895 / 5650 (194) ++++++++++
Регистрация: 13.03.2002
Адрес: Hüfingen,DE
Цитата:
Сообщение от gl00mie Посмотреть сообщение
Казалось бы, что с ним не так? А то, что он не использует параметры и плодит, собака, сотни одинаковых планов запроса, которые вымывают из кэша другие более полезные планы запросов. С помощью "триангуляции" обнаружил, что такие запросы генерятся (в DAX2012 R3) из AccountingEventSourceDocumentProcessor::updateDistributionsForEvent(). Спрашивается, что мешало смастерить там прямой SQL-запрос с параметрами, чтобы он не плодил кучу одинаковых планов запросов?..
Нет под рукой DAX2012, поэтому хочу спросить - там что - реально forceliterals стоял в коде ? (Просто я наверное и не вспомню на вскидку, где в стандарте forceliterals прописан был в DAX2012...)
Старый 19.05.2023, 13:58   #2  
Владимир Максимов is offline
Владимир Максимов
Участник
КОРУС Консалтинг
 
1,658 / 1162 (42) ++++++++
Регистрация: 13.01.2004
Записей в блоге: 3
Цитата:
Сообщение от fed Посмотреть сообщение
Нет под рукой DAX2012, поэтому хочу спросить - там что - реально forceliterals стоял в коде ? (Просто я наверное и не вспомню на вскидку, где в стандарте forceliterals прописан был в DAX2012...)
Там напрямую строка запроса формируется и выполняется "как есть"

X++:
AccountingEventSourceDocumentProcessor::executeSQL(sqlStatementText);
Т.е. приведенный UPDATE - это значение переменной sqlStatementText, которая там сформирована.

Еще и комментарий написан

X++:
    // Do the update as direct SQL as there is a deadlock on AccountingDistribution due to a clustered
    // index scan operator in the query plan. This operator appears only in low data volume scenarios.
    // In higher volume scenarios, the plan includes a seek operator using the index I_7452SOURCEDOCUMENTHEADERIDX.
    // Testing in SSMS indicates an index hint will correct the plan at low volumes and represents minimal
    // risk at high volumes. In order to enable the index hint on the update_recordset, direct SQL must be used.
    // Also note that xGlobal::randomPositiveInt32() is the method used by the kernel to populate the
    // recversion field.
__________________
- Может, я как-то неправильно живу?!
- Отчего же? Правильно. Только зря...
Старый 19.05.2023, 20:25   #3  
Logger is offline
Logger
Участник
Лучший по профессии 2015
Лучший по профессии 2014
 
3,889 / 3165 (113) ++++++++++
Регистрация: 12.10.2004
Адрес: Москва
Записей в блоге: 2
Цитата:
Сообщение от fed Посмотреть сообщение
Нет под рукой DAX2012, поэтому хочу спросить - там что - реально forceliterals стоял в коде ? (Просто я наверное и не вспомню на вскидку, где в стандарте forceliterals прописан был в DAX2012...)
Не, там прямой запрос к БД.

X++:
private static server boolean updateDistributionsForEvent(recId _accountingEventRecId, AccountingDate _accountingDate, recId _sourceDocumentRecId)
{
    str                             sqlStatementText;
    str                             sqlDate = date2str(_accountingDate, 321, 2, 3, 2, 3, 4, DateFlags::None); // 'YYYY-MM-DD'

    // Do the update as direct SQL as there is a deadlock on AccountingDistribution due to a clustered
    // index scan operator in the query plan. This operator appears only in low data volume scenarios.
    // In higher volume scenarios, the plan includes a seek operator using the index I_7452SOURCEDOCUMENTHEADERIDX.
    // Testing in SSMS indicates an index hint will correct the plan at low volumes and represents minimal
    // risk at high volumes. In order to enable the index hint on the update_recordset, direct SQL must be used.
    // Also note that xGlobal::randomPositiveInt32() is the method used by the kernel to populate the
    // recversion field.

    sqlStatementText = strFmt('UPDATE T1 SET ACCOUNTINGEVENT=%1,RECVERSION=%2 FROM ACCOUNTINGDISTRIBUTION T1 WITH (INDEX(I_7452SOURCEDOCUMENTHEADERIDX)) CROSS JOIN SOURCEDOCUMENTLINE T2 ', _accountingEventRecId, xGlobal::randomPositiveInt32());

    sqlStatementText += strFmt('WHERE (((T1.PARTITION=%1) AND (T1.ACCOUNTINGEVENT=0) AND (T1.ACCOUNTINGDATE={ d\'%2\'})) AND (T1.SOURCEDOCUMENTHEADER=%3)) AND ', getcurrentpartitionrecid(), sqlDate, _sourceDocumentRecId);
    sqlStatementText += strFmt('((T2.RECID=T1.SOURCEDOCUMENTLINE) AND (T2.ACCOUNTINGSTATUS=%1 OR T2.ACCOUNTINGSTATUS=%2)) AND (T2.PARTITION=%3)', enum2int(SourceDocumentLineAccountingStatus::Completed), enum2int(SourceDocumentLineAccountingStatus::Canceled), getcurrentpartitionrecid());

    return AccountingEventSourceDocumentProcessor::executeSQL(sqlStatementText);
}
Теги
axapta, cil, d365fo, guid, rasset, uuid, uuidv7, баг

 


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

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

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