Difference between InMemory and TempDB tables in D365 F&O

The difference between InMemory and TempDB tables in D365 F&O is:


• InMemory tables are stored in the active memory of the tier where the process is running, either the client or the server tier. TempDB tables are stored in the SQL Server database as physical tables.


• InMemory tables are instantiated when the first record is inserted, and are de-allocated when the record buffer goes out of scope or is set to null. TempDB tables are instantiated when the table object is created, and are dropped when the record buffer goes out of scope.


• InMemory tables can be created by setting the TableType property of the table to InMemory, or by using the setTmp method on a record variable, or by setting the SourceTableTemporary property of a page. TempDB tables can be created by setting the TableType property of the table to TempDB.


• InMemory tables can be joined with regular tables, but cannot have foreign keys, indexes, or methods. TempDB tables can be joined with regular tables, and can have foreign keys, indexes, and methods, but cannot override methods.


• InMemory tables can be used for data that is not persisted in the database, such as calculations or aggregations. 






TempDB tables


We call them TempDB tables because their TableType property value is TempDB. This value comes from the TableType::TempDB enum value. The TableType property value can be set at AOT > Data Dictionary > Tables > MyTempDBTable > Properties > TableType.

All types of temporary tables are automatically dropped by the system when the table variable in X++ goes out of scope. A TempDB table is NOT dropped when you set its record buffer variable to null.



InMemory tables


The second type of temporary table is the InMemory table. We call them InMemory tables because their TableType property value is InMemory. This value comes from the TableType::InMemory enum value. 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.







Comments

Popular posts from this blog

How to customize electronic reporting in D365

Batch parallelism or multithreading in Dynamics 365 for Finance and Operations

How to Enable/Disable a Form Button with X++

How to create and run the Runbase batch class in D365

Build HTML and send email in D365 FO with X++

Conditional Statements in X++

How to apply a package in LCS Dynamics 365 F&O

Customize the standard excel template in D365FO

How to write the event handler in D365