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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 26.08.2008, 17:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,477 / 846 (79) +++++++
Регистрация: 28.10.2006
axStart: Table caching in AX
Источник: http://axstart.spaces.live.com/Blog/...C0A0!371.entry
==============


There is a lot of misunderstanding about caching of data in AX.
Axapta 3.0 and 4.0 only caches data if you search exactly with the values of the primary index. I will show you with the next example. The primary index on the CustTable is on the field AccountNum.
Example 1 will place the record in my cache. The second example will read from cache. Example 3 and 4 will not do it.
static void cachingTest(Args _args)
{
    CustTable custTable;
    CustTrans custTrans;
 
    //example 1*
    select custTable where custTable.AccountNum == "4001";
    info(strfmt("%1",custTable.wasCached())); //not cached
 
    //example 2
    select custTable where custTable.AccountNum == "4001";
    info(strfmt("%1",custTable.wasCached())); //cached
 
   //example 3
    select custTable where custTable.AccountNum == "4001" &&
                                              custTable.Name == "The Glass Bulb";
    info(strfmt("%1",custTable.wasCached())); //not cached
 
    //example 4
    select custTable where custTable.AccountNum == "4001" join
                custTrans where custTable.AccountNum == custTrans.AccountNum;
    info(strfmt("%1",custTable.wasCached())); //not cached
}
* Incase the records was already cached on the AOS cache status is SvrRecordCached
In AX 2009 the caching mechanism has improved. Any unique index will be used for caching optimizing. So let’s repeat the test in AX2009. In the next example (2009), we search 2 times for the same record. The first time we use index PartyID that places the record in the cache the second time we search by accounnum index and will find the result in the cache.
static void cachingTest(Args _args)
{
    CustTable custTable;
    CustTrans custTrans;
 
    //example 1*
    select custTable where custTable. PartyId== "215"; //PartyID is also has also an unique index
    info(strfmt("%1",custTable.wasCached())); //not cached
 
    //example 2
    select custTable where custTable.AccountNum == "4001"; //same record like partyID == “215”
    info(strfmt("%1",custTable.wasCached())); //cached
 
   //example 3
    select custTable where custTable.AccountNum == "4001" &&
                                              custTable.Name == "The Glass Bulb";
    info(strfmt("%1",custTable.wasCached())); //not cached
 
    //example 4
    select custTable where custTable.AccountNum == "4001" join
                custTrans where custTable.AccountNum == custTrans.AccountNum;
    info(strfmt("%1",custTable.wasCached())); //not cached
}
* Incase the records was already cached on the AOS cache status is SvrRecordCached
NOTE: Still there is a primary index property in the AOT, I don’t know why.
 


Источник: http://axstart.spaces.live.com/Blog/...C0A0!371.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
Старый 27.08.2008, 11:40   #2  
gl00mie is offline
gl00mie
Участник
MCBMSS
Most Valuable Professional
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
3,684 / 5788 (200) ++++++++++
Регистрация: 28.11.2005
Адрес: Москва
Записей в блоге: 3
Цитата:
Сообщение от Blog bot Посмотреть сообщение
NOTE: Still there is a primary index property in the AOT, I don’t know why.
Рискну предположить: потому что СУБД совершенно фиолетовы улучшения в механизме кэширования в DAX 2009, и она (СУБД) по-прежнему различает UNIQUE и PRIMARY KEY constraints.
Старый 30.08.2008, 12:14   #3  
axstart is offline
axstart
MVP
Most Valuable Professional
NavAx Club
 
16 / 10 (1) +
Регистрация: 04.05.2008
Адрес: Holland
Hi gloomie,
can you provide me some more invormation about your replay, google translate tels me something about primary key constraint, But to my opinion SQL has no primary thing at all..

dick
__________________
MVP
Старый 31.08.2008, 16:00   #4  
gl00mie is offline
gl00mie
Участник
MCBMSS
Most Valuable Professional
Лучший по профессии 2017
Лучший по профессии 2015
Лучший по профессии 2014
Лучший по профессии AXAWARD 2013
Лучший по профессии 2011
Лучший по профессии 2009
 
3,684 / 5788 (200) ++++++++++
Регистрация: 28.11.2005
Адрес: Москва
Записей в блоге: 3
Цитата:
Сообщение от axstart Посмотреть сообщение
can you provide me some more invormation about your replay
Well, the idea is that a DBMS (Ms SQL Server or Oracle DS) doesn't care about DAX caching improvemets - it still distinguishes between PRIMARY KEY (which can be set from MorphX via a corresponding table property) and UNIQUE constraints (which can be set from MorphX via a table index property). Of course if we take into account that DAX neither uses itself (except for RecVersion field value since AX 3 KR3) nor allows to use from X++ NULL table field values, then PRIMARY KEY and UNIQUE constraints differences merely vanish. But still there can be scenarios when you use some tables in a DAX database for a data exchange with a foreign system and enforce a FOREIGN KEY constraint on some other tables involved in the exchange. Obviousely you'll need a primary key for this as none of unique keys will be suitable for such a scenario. And it would be handy to declare a primary key on your DAX table from MorphX rather then altering it from a DBMS side and dealing with AOT Data Dictionary synchronization issues when DAX simply drops all indexes/constraints that are not declared in AOT.
Цитата:
Сообщение от axstart Посмотреть сообщение
to my opinion SQL has no primary thing at all...
It seems this statement is not quite correct.

PS. There's a good book «Expert one-on-one Oracle» by Tom Kyte where he's stressing one idea: don't use a DBMS as a "black box"; if your application relies on a database - learn the DBMS you're using otherwise your project is most likely doomed to be non-scaling application with not more then several concurrent users. DAX is the system that relies on a database so even if DAX moves from ternary SQL logic (value matched - value not matched - value is NULL) to a binary logic (value matched - value not matched) which makes PRIMARY KEY and UNIQUE constrains not so different, you still can't just ignore the underlying DBMS that doesn't care about assumptions and simplifications introduced in your system.

Последний раз редактировалось gl00mie; 31.08.2008 в 16:04.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
axStart: Dynamics AX and Office Business Applications (OBA) Blog bot DAX Blogs 0 27.10.2008 16:05
axStart: Date methods in your Visual Studio Dynamics AX Report. Blog bot DAX Blogs 0 10.09.2008 23:05
axStart: Microsoft Dynamics AX 2009 Hot Topics Web Seminar Series Blog bot DAX Blogs 0 06.08.2008 12:05
Arijit Basu: AX 2009 - Quick Overview Blog bot DAX Blogs 4 19.05.2008 14:47
Dynamics AX: SQL Tuning: Table & Index Scans Blog bot DAX Blogs 0 20.07.2007 11:50

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

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

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