Difference between revisions of "SET DCACHE"

From Recital Documentation Wiki
Jump to: navigation, search
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
=SET DCACHE=
 
 
 
==Class==
 
Performance and Optimization
 
 
 
 
==Purpose==
 
==Purpose==
 
Map table into memory
 
Map table into memory
Line 22: Line 15:
 
==Description==
 
==Description==
 
If SET DCACHE is ON when a table is used, then the table records will be ’cached’ in memory, and the records which are not held in memory will be read in when they are needed.
 
If SET DCACHE is ON when a table is used, then the table records will be ’cached’ in memory, and the records which are not held in memory will be read in when they are needed.
 +
 
The SET DCACHE TO <expN> command allows the number of records held in memory to be specified on a per table basis.  If the optional OPTIMUM keyword is specified, the optimum dcache size will automatically be set.  The table ’cache ’ area acts as a ’window’ into the table.  Each record referenced in the table is ’mapped’ into the table cache using the simple formula:
 
The SET DCACHE TO <expN> command allows the number of records held in memory to be specified on a per table basis.  If the optional OPTIMUM keyword is specified, the optimum dcache size will automatically be set.  The table ’cache ’ area acts as a ’window’ into the table.  Each record referenced in the table is ’mapped’ into the table cache using the simple formula:
  
Line 27: Line 21:
  
 
Using this formula with a table cache of 500, record 1 maps into slot 1, record 501 also maps into slot 1.  When a slot is referenced which already contains a record, and that record has been modified since it was read from the table, then the table is updated with the modified record and the required record is read into the cache slot.  When a table is closed, modified records held in memory are written into the table.
 
Using this formula with a table cache of 500, record 1 maps into slot 1, record 501 also maps into slot 1.  When a slot is referenced which already contains a record, and that record has been modified since it was read from the table, then the table is updated with the modified record and the required record is read into the cache slot.  When a table is closed, modified records held in memory are written into the table.
 +
 
The SET DCACHE command has no effect if a table is shareable, unless SET GCACHE is set ON.  When SET GCACHE is ON, SET DCACHE and SET ICACHE operate on a distributed basis.  The SET CACHELOAD command can be used in association with the SET DCACHE command.  This forcibly loads the table and index cache when the table is used exclusively.  The SET ICACHE command can be used to ’cache’ index keys in memory.  By default, DCACHE is OFF.
 
The SET DCACHE command has no effect if a table is shareable, unless SET GCACHE is set ON.  When SET GCACHE is ON, SET DCACHE and SET ICACHE operate on a distributed basis.  The SET CACHELOAD command can be used in association with the SET DCACHE command.  This forcibly loads the table and index cache when the table is used exclusively.  The SET ICACHE command can be used to ’cache’ index keys in memory.  By default, DCACHE is OFF.
  
  
 
==Example==
 
==Example==
<pre>
+
<code lang="recital">
 
// Open up payroll system
 
// Open up payroll system
 
set exclusive on
 
set exclusive on
Line 42: Line 37:
 
use employees index name, emp_code
 
use employees index name, emp_code
 
set dcache off
 
set dcache off
use wages index emp_code</pre>
+
use wages index emp_code</code>
  
  
 
==Products==
 
==Products==
Recital Database Server, Recital Mirage Server, Recital Terminal Developer
+
Recital Server, Recital  
 
[[Category:Documentation]]
 
[[Category:Documentation]]
 
[[Category:Commands]]
 
[[Category:Commands]]
 
[[Category:Set_Commands|DCACHE]]
 
[[Category:Set_Commands|DCACHE]]
 +
[[Category:Performance and Optimization]]
 +
[[Category:Performance and Optimization]]
 +
[[Category:Performance and Optimization Set Commands]]

Latest revision as of 15:32, 23 November 2009

Purpose

Map table into memory


Syntax

SET DCACHE TO [<expN>] [OPTIMUM]

SET DCACHE ON | OFF | (<expL>)


See Also

SET CACHELOAD, SET GCACHE, SET ICACHE, SET PCACHE


Description

If SET DCACHE is ON when a table is used, then the table records will be ’cached’ in memory, and the records which are not held in memory will be read in when they are needed.

The SET DCACHE TO <expN> command allows the number of records held in memory to be specified on a per table basis. If the optional OPTIMUM keyword is specified, the optimum dcache size will automatically be set. The table ’cache ’ area acts as a ’window’ into the table. Each record referenced in the table is ’mapped’ into the table cache using the simple formula:

position = mod(<record number>, <cache size>)

Using this formula with a table cache of 500, record 1 maps into slot 1, record 501 also maps into slot 1. When a slot is referenced which already contains a record, and that record has been modified since it was read from the table, then the table is updated with the modified record and the required record is read into the cache slot. When a table is closed, modified records held in memory are written into the table.

The SET DCACHE command has no effect if a table is shareable, unless SET GCACHE is set ON. When SET GCACHE is ON, SET DCACHE and SET ICACHE operate on a distributed basis. The SET CACHELOAD command can be used in association with the SET DCACHE command. This forcibly loads the table and index cache when the table is used exclusively. The SET ICACHE command can be used to ’cache’ index keys in memory. By default, DCACHE is OFF.


Example

// Open up payroll system
set exclusive on
set cacheload on
set icache to 3000
set dcache to 1000
use payroll index pay_date, emp_code
// Cache the employee records in memory
set dcache on
use employees index name, emp_code
set dcache off
use wages index emp_code


Products

Recital Server, Recital