Temporary InMemory Tables [AX 2012]

This topic has not yet been rated - Rate this topic

Updated: October 12, 2012

Applies To: Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012

在 Microsoft Dynamics AX, 有一种类型的临时表叫做 InMemory table. 我们叫它 InMemory tables ,因为他们的 TableType 属性值是 InMemory . 这个值来自于枚举值 TableType::InMemory . The TableType property value can be seen at AOT Data Dictionary Tables MyInMemoryTable Properties TableType .

 Note

In Microsoft Dynamics AX 2009 and earlier versions, InMemory tables were called temporary tables. Now there are two kinds of temporary tables, namely InMemory tables and TempDB tables. To avoid confusion we do not use the phrase temporary tables to refer to just InMemory tables or to just TempDB tables.

Tier(层)

 

不论是在客户端或者服务端层,InMemory表在进程运行所在的活动内存中被实例化. InMemory表从来不出现在数据库管理系统中.

一个InMemory table 留在内存中,知道他的尺寸达到128KB. 该数据集然后被写到服务器层的一个磁盘文件. InMemory表的磁盘文件具有命名约定 $tmp<nnnnnnnn>.$$$.

Scope(范围)

 

当第一条记录插入后,InMemory表被实例化. 只要一条引用该表的记录缓冲区变量存在,实例化后的InMemory表就继续存在. 只要记录缓冲区超出范围,内存或硬盘就不给InMemory表分配空间.

Adding Data to an InMemory Table

 

To add data to an InMemory table, you must declare the record buffer and call the insert method. The following code example uses the TmpCustLedger table which has its TableTypeproperty set to InMemory in the AOT.

X++

static
void TableTmpInsertRecord(Args _args)

{ TmpCustLedger custTmpLedger;

; custTmpLedger.Name =
'NameValue'; custTmpLedger.Balance01 =
2345000;

custTmpLedger.insert();

}

 

 

 

要释放InMemory表的内存,并删除它的文件,可以设置 record buffer 变量为 null .

custTmpLedger = null;

下面演示从 CustTable table 复制数据到InMemory table ,它是 CustTable table 的表结构的副本. setTmp 方法用来创建一个与 CustTable table 匹配的 InMemory table. setTmp 方法改变getTableType方法的返回值 getTableType , from TableType::Regular to TableType::InMemory .

X++

static
void CopyPersistedTableToInMemoryJob(Args _args)

{

CustTable custTable;

CustTable custTmpLedger; custTmpLedger.setTmp(); custTable.recordLevelSecurity(true);

while select * from custTable where custTable.AccountNum like '1*'
{ custTmpLedger.data(custTable.data());

custTmpLedger.doInsert(); info(strFmt("Inserted a row for AccountNum =

%1",custTable.AccountNum)); } custTmpLedger = null;

}

 

Indexes

 

InMemory 表可以向
持久化的表一样定义索引. 如果一个InMemory表是通过拷贝一个持久化的表创建的,索引页会被拷贝到InMemory表中. 索引对于快速检索数据很有用,特别是当InMemory表数据在磁盘文件中时.

InMemory Tables vs. Containers

 

Microsoft Dynamics AX 支持一种特殊的数据类型,叫做 container .这种数据类型可以像你使用InMemory表一样使用. For more information, see Containers .

在容器中的数据是连续地存储和检索,但在InMemory表中,你可以定义索引来加快数据检索. 对于几行数据来说,索引没有益处.在这种情况下,容器可能有更少的开销,更快的执行速度.

另一个重要的不同是,如何在方法调用中使用.当你传递一个InMemeory表到一个方法调用, 它通过引用传递.容器通过值传递.当一个变量通过引用传递,只有指向该对象的指针被传递. 当一个变量通过值传递,该变量的一个新的拷贝被传递给方法.如果计算机有一定限制量的内存, 它会开始交换内存到磁盘,减慢应用程序的执行.当你传递一个变量给方法,InMemory表可能提供
更佳的性能.

For more information about temporary tables, see Greef, Pontoppidan, et al. 2006. Inside Microsoft Dynamics AX 4.0 . 351-359. Redmond: Microsoft Press.

TempDB Tables for Disabled Tables

 

你可以通过禁用 configuration key 来禁用一个常规持久化的数据库表,它控制着表.禁用这个键会导致系统自动创建一个, 与数据库表的字段和架构相匹配的TempDB类型的临时表.这个临时表会在SQL Server 数据库的底层存在, 通过AOS管理.

自动创建这个TempDB表的目的,是为了能让引用了被禁用表的AOT对象,继续编译和运行. 甚至在configuration key被禁用时,你依然可以读写这个TempDB表.

所有表缓冲区变量都继承 xRecord 类的方法. 其中一个方法是 setTmp , 它创建一个与常规表有着相同架构的InMemory 临时表. 然而, setTmp 方法不能从TempDB表创建InMemory表. 你可以调用 isTempDb 方法确定 setTmp 方法是否可用.

See also

 

Use the Table Browser to View, Add, Modify, or Delete Records

Temporary InMemory Tables [AX 2012]的更多相关文章

  1. Temporary TempDB Tables [AX 2012]

    Temporary TempDB Tables [AX 2012] 1 out of 4 rated this helpful - Rate this topic Updated: November ...

  2. Temporary Tables and the TableType Property [AX 2012]

    Temporary Tables and the TableType Property [AX 2012] 1 out of 1 rated this helpful - Rate this topi ...

  3. Table Properties [AX 2012]

    Table Properties [AX 2012] 1 out of 2 rated this helpful - Rate this topic Updated: July 20, 2012 Ap ...

  4. Select Statement Syntax [AX 2012]

    Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 ...

  5. View Properties [AX 2012]

    View Properties [AX 2012] Other Versions This topic has not yet been rated - Rate this topic Updated ...

  6. Understanding the RelationshipType Enumeration [AX 2012]

    Understanding the RelationshipType Enumeration [AX 2012] 3 out of 3 rated this helpful - Rate this t ...

  7. Table Groups [AX 2012]

    Table Groups [AX 2012] 0 out of 1 rated this helpful - Rate this topic Updated: February 21, 2012 Ap ...

  8. Dynamics AX 2012 的工业物联网解决方案

    Dynamics AX 2012 的工业物联网解决方案 物联网 物联网的概念在这两年非常火,包括近期很火的共享单车初创公司--摩拜单车,在产品中运用了Azure Iot物联网技术.但是,物联网并不是一 ...

  9. Dynamics AX 2012 在BI分析中建立数据仓库的必要性

    AX系统已有的BI分析架构 对于AX 的BI分析架构,相信大家都了解,可以看Reinhard之前的译文[译]Dynamics AX 2012 R2 BI系列-分析的架构 . AX 的BI分析架构的优势 ...

随机推荐

  1. 30天,O2O速成攻略【8.22北京站】

    活动概况 时间:2015年8月22日13:30-16:30 地点:车库咖啡(北京市海淀西大街48号鑫鼎宾馆二层) 主办:APICloud.融云.品读者 网址:www.apicloud.com 费用:免 ...

  2. 通过ping确定网卡mtu

    使用 ping 测试确定网卡最佳 MTU 的方法 MTU ( Maximum Transmission Unit ,最大传输单元)是指某一层协议上一次能最大传输的数据量.当一个数据包超过 MTU 数据 ...

  3. Java多线程实现

    1.继承Thread类,由于Java单继承特性,此方法并不推荐. 2.实现Runnable接口,代码如下 class MyThread implements Runnable { private St ...

  4. 注册页面的简单搭建(H5)

    <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...

  5. Android中的Handler机制

    直接在UI线程中开启子线程来更新TextView显示的内容,运行程序我们会发现,如下错 误:android.view.ViewRoot$CalledFromWrongThreadException: ...

  6. SQL Server Index详解

    最近在进行数据库调优,对索引的使用和其内部的运转一知半解.在园子里看到一篇相关文章非常好.留下印记以便日常查找. http://www.cnblogs.com/xwdreamer/archive/20 ...

  7. The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation. 怎么解决

    cd 文件 pod install --no-repo-update 就可以了

  8. SQL order by 两个字段排序

    select * from emp;

  9. 2-sat(石头、剪刀、布)hdu4115

    Eliminate the Conflict Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/O ...

  10. DataBase: LeetCode

    Combine Two Tables # Write your MySQL query statement below Select p.FirstName, p.LastName, a.City, ...