Temporary InMemory Tables [AX 2012]
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 .
|
|
|
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. |
不论是在客户端或者服务端层,InMemory表在进程运行所在的活动内存中被实例化. InMemory表从来不出现在数据库管理系统中.
一个InMemory table 留在内存中,知道他的尺寸达到128KB. 该数据集然后被写到服务器层的一个磁盘文件. InMemory表的磁盘文件具有命名约定 $tmp<nnnnnnnn>.$$$.
当第一条记录插入后,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 { TmpCustLedger custTmpLedger; ; custTmpLedger.Name = 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 { CustTable custTable; CustTable custTmpLedger; custTmpLedger.setTmp(); custTable.recordLevelSecurity(true); while select * from custTable where custTable.AccountNum like '1*' custTmpLedger.doInsert(); info(strFmt("Inserted a row for AccountNum = %1",custTable.AccountNum)); } custTmpLedger = null; } |
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 方法是否可用.
Use the Table Browser to View, Add, Modify, or Delete Records
Temporary InMemory Tables [AX 2012]的更多相关文章
- Temporary TempDB Tables [AX 2012]
Temporary TempDB Tables [AX 2012] 1 out of 4 rated this helpful - Rate this topic Updated: November ...
- 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 ...
- Table Properties [AX 2012]
Table Properties [AX 2012] 1 out of 2 rated this helpful - Rate this topic Updated: July 20, 2012 Ap ...
- Select Statement Syntax [AX 2012]
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 ...
- View Properties [AX 2012]
View Properties [AX 2012] Other Versions This topic has not yet been rated - Rate this topic Updated ...
- Understanding the RelationshipType Enumeration [AX 2012]
Understanding the RelationshipType Enumeration [AX 2012] 3 out of 3 rated this helpful - Rate this t ...
- Table Groups [AX 2012]
Table Groups [AX 2012] 0 out of 1 rated this helpful - Rate this topic Updated: February 21, 2012 Ap ...
- Dynamics AX 2012 的工业物联网解决方案
Dynamics AX 2012 的工业物联网解决方案 物联网 物联网的概念在这两年非常火,包括近期很火的共享单车初创公司--摩拜单车,在产品中运用了Azure Iot物联网技术.但是,物联网并不是一 ...
- Dynamics AX 2012 在BI分析中建立数据仓库的必要性
AX系统已有的BI分析架构 对于AX 的BI分析架构,相信大家都了解,可以看Reinhard之前的译文[译]Dynamics AX 2012 R2 BI系列-分析的架构 . AX 的BI分析架构的优势 ...
随机推荐
- iOS 开发知识小集(1)
iOS 开发知识小集(1) 2015-05-15 iOS大全 (点击上方蓝字,快速关注我们) 一直想做这样一个小册子,来记录自己平时开发.阅读博客.看书.代码分析和与人交流中遇到的各种问题.之前有过 ...
- android AlarmManager 详解
在开发互联网应用时候,我们常常要使用心跳来保证客户端与服务器的连接.怎么完成心跳很关键,在说道客户端心跳功能时,如果使用Timer或者专门开起一个线程来做心跳的工作,会浪费CPU工作时间,而且也会更多 ...
- Centos 6.5系统下搭建Git服务器--失败历程
参考博客 http://www.51hei.com/bbs/dpj-28077-1.html http://www.linuxidc.com/Linux/2014-06/103885p2.htm ht ...
- Redis一些基本的操作
代码: using System; using System.Collections.Generic; using System.Linq; using System.Text; using Syst ...
- random模块使用
import random #print random.random() #0.522622274753 #print random.randint(,) 生成1-5之间的一个随机整数 #print ...
- Java多线程实现
1.继承Thread类,由于Java单继承特性,此方法并不推荐. 2.实现Runnable接口,代码如下 class MyThread implements Runnable { private St ...
- spring4 文件下载功能
需要准备的工具和框架 Spring 4.2.0.RELEASE Bootstrap v3.3.2 Maven 3 JDK 1.7 Tomcat 8.0.21 Eclipse JUNO Service ...
- C# 匿名方法
每次写博客,第一句话都是这样的:程序员很苦逼,除了会写程序,还得会写博客!当然,希望将来的一天,某位老板看到此博客,给你的程序员职工加点薪资吧!因为程序员的世界除了苦逼就是沉默.我眼中的程序员大多都不 ...
- IntelliJ IDEA 下的版本控制介绍
不管是个人开发或是团队开发,版本控制都是可以很好地被使用的,目前我找不到任何开发者不使用版本控制的理由.而且对于 IDE 来讲,集成版本控制的本身就是它最大的亮点之一,很多开发者也是为此而使用它. 在 ...
- linux文件编码
linux下新建一个文件,或采用fopen新建,那么文件的编码是什么? 怎么查看文件编码格式: 查看文件编码file命令file ip.txt ip.txt: UTF-8 Unicode text, ...
Note