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. iptables conntrack有什么用

    iptables conntrack有什么用 http://zhidao.baidu.com/link?url=Eh5SRuplbsY_WkxxGkH4bpEyfMnHAe1RwJYSVlRYGKFU ...

  2. 经过各种坑之后centos+ uwsgi + nginx +django 终于配好了

    https://pypi.python.org/pypi/setuptools#downloads https://www.python.org/ftp/python/ 开机 加入 uwsgi ngi ...

  3. Android设计模式源码解析之外观模式(Facade)

    https://github.com/simple-android-framework/android_design_patterns_analysis/tree/master/facade/elsd ...

  4. CTE计算层级关系

    推广渠道表有ParentID字段,代表上下层级关系.现要统计每个推广员,推广了多少人? --创建表结构,插入测试数据 USE DBA_Monitor GO CREATE TABLE [dbo].[TG ...

  5. 10 个顶尖的 Linux 开源人工智能工具

    在这篇文章中,我们将介绍几个顶级的开源 Linux 生态系统的人工智能(AI)工具.目前,AI 是科学和技术中不断进步的领域之一,很多人都在致力于构建软件和硬件来解决诸如医疗,教育,安全,制造业,银行 ...

  6. Silverlight以列表显示数据库数据_DataGrid

    效果图:      前台代码: 里面有一部分是我测试统计图的代码,不想改,感觉应该不影响理解.... <UserControl x:Class="Task_One.MainPage&q ...

  7. HBase shell

    进入命令行 ./hbase shell 查看HBase shell帮助 help 查看命令帮助 直接输入命令回撤 创建命名空间 create_namespace 'ns1' 查看命名空间 list_n ...

  8. bootstrap实战经验

    凡是基本的布局需要float实现的,都可以考虑利用网格布局. 1,.jumbotron可以形成一个青灰色的背景,并自动调节对应边距 2,.panel的应用十分广泛,可以自动设置合适的padding.甚 ...

  9. bootstrap ace treeview树表

    html部分 <div class="widget-main padding-8" style="height:400px;overflow-y: scroll;& ...

  10. java collections读书笔记(9)collection框架总览(2)

    框架算法: 1)collection接口 add()  Adds an element to the collection.addAll()  Adds a collection of element ...