Settings: Difference between revisions

From MemCP
Jump to navigation Jump to search
No edit summary
(Refresh MemCP documentation: accuracy, operational guidance, performance profile and maintained API reference)
Line 1: Line 1:
Settings are changed by:
<!-- Copyright (C) 2026 Carl-Philip Haensch -->
(settings "key" "value")
And read by:
(settings "key")
The following settings are available:


* <code>"Backtrace"</code>: <code>true</code> or <code>false</code> whether to print backtraces from Scheme. Using true decreases the performance by ~10% but gives you better debugging capabilities.
<!-- SPDX-License-Identifier: GPL-3.0-or-later -->
* <code>"PartitionMaxDimensions"</code>: number from 0 to 10 how many partitioning dimensions are allowed at max. 0 means, don't partition shards for values (use it to workaround bugs), 1 means only one-dimensional partitioning.
 
* <code>"DefaultEngine"</code>: one of <code>"memory" "sloppy" "logging" "safe"</code> that defines which [[Persistency and Performance Guarantees|persistency level]] to choose if a CREATE TABLE statement is executed without the <code>ENGINE</code> parameter
<span id="settings"></span>
* <code>"ShardSize"</code>: default 60000, defines the size of a shard. Rule of thumb is that no shard scan should last longer than 100ms. For servers and workstations, a shard size of 60,000 is recommended. On Raspberry Pi, you should tend to 10,000 in order to get good use of parallelism.
= Settings =
 
Read, write, or list runtime settings from Scheme:
 
<syntaxhighlight lang="scheme">(settings "ShardSize")
(settings "ExplainWidth" 80)
(settings)</syntaxhighlight>
Settings are stored with the database catalog. Validate production changes in a staging workload; memory, planner, and durability-related values affect behavior.
 
{| class="wikitable"
|-
! Setting
! style="text-align: right;"| Default
! Purpose
|-
| <code>Backtrace</code>
| style="text-align: right;"| false
| Retain more Scheme source/backtrace information.
|-
| <code>Trace</code>, <code>TracePrint</code>
| style="text-align: right;"| false
| Runtime trace collection and printing.
|-
| <code>PartitionMaxDimensions</code>
| style="text-align: right;"| 10
| Maximum adaptive partition dimensions.
|-
| <code>DefaultEngine</code>
| style="text-align: right;"| <code>safe</code>
| One of <code>safe</code>, <code>logged</code>, <code>sloppy</code>, <code>memory</code>, <code>cache</code>.
|-
| <code>ShardSize</code>
| style="text-align: right;"| 60000
| Target rows used by shard/repartition decisions.
|-
| <code>AnalyzeMinItems</code>
| style="text-align: right;"| 50
| Minimum work before recording scan statistics.
|-
| <code>IndexThreshold</code>
| style="text-align: right;"| 5
| Minimum shard rows for a new adaptive index.
|-
| <code>MaxRamPercent</code>
| style="text-align: right;"| 50
| Overall MemCP RAM budget when byte override is zero.
|-
| <code>MaxRamBytes</code>
| style="text-align: right;"| 0
| Exact overall budget; zero uses percentage.
|-
| <code>MaxPersistPercent</code>
| style="text-align: right;"| 30
| Budget for reloadable persisted data.
|-
| <code>MaxPersistBytes</code>
| style="text-align: right;"| 0
| Exact persisted-data budget.
|-
| <code>MetricsTracing</code>
| style="text-align: right;"| false
| Periodically write performance metrics.
|-
| <code>MetricsTracingInterval</code>
| style="text-align: right;"| 60
| Metrics interval in seconds when zero/defaulted.
|-
| <code>ShutdownDrainSeconds</code>
| style="text-align: right;"| 10
| Wait for in-flight requests during shutdown.
|-
| <code>LogJIT</code>
| style="text-align: right;"| false
| Log native JIT compilation details.
|-
| <code>ScanDebugging</code>
| style="text-align: right;"| false
| Log scan boundaries, index selection, and scan details.
|-
| <code>ExplainWidth</code>
| style="text-align: right;"| 20
| Pretty-print width for EXPLAIN expressions.
|-
| <code>JoinReorderDPBudget</code>
| style="text-align: right;"| 256
| Connected subsets retained by exact join search.
|-
| <code>ErrorQueryLog</code>
| style="text-align: right;"| false
| Store failed queries in <code>system_statistic.errors</code>.
|-
| <code>MaxErrorQueryLog</code>
| style="text-align: right;"| 0
| Error-log row limit; zero is unlimited.
|-
| <code>PrintLog</code>
| style="text-align: right;"| false
| Store Scheme print/time output.
|-
| <code>MaxPrintLog</code>
| style="text-align: right;"| 0
| Print-log row limit; zero is unlimited.
|}
 
Use [[Memory_Management_and_Eviction|Memory Management and Eviction]], [[Query_Planner_and_Physical_Lowering|Query Planner and Physical Lowering]], and [[Dashboard_and_Operations|Dashboard and Operations]] for operational context.

Revision as of 11:59, 28 August 2026


Settings

Read, write, or list runtime settings from Scheme:

<syntaxhighlight lang="scheme">(settings "ShardSize") (settings "ExplainWidth" 80) (settings)</syntaxhighlight> Settings are stored with the database catalog. Validate production changes in a staging workload; memory, planner, and durability-related values affect behavior.

Setting Default Purpose
Backtrace false Retain more Scheme source/backtrace information.
Trace, TracePrint false Runtime trace collection and printing.
PartitionMaxDimensions 10 Maximum adaptive partition dimensions.
DefaultEngine safe One of safe, logged, sloppy, memory, cache.
ShardSize 60000 Target rows used by shard/repartition decisions.
AnalyzeMinItems 50 Minimum work before recording scan statistics.
IndexThreshold 5 Minimum shard rows for a new adaptive index.
MaxRamPercent 50 Overall MemCP RAM budget when byte override is zero.
MaxRamBytes 0 Exact overall budget; zero uses percentage.
MaxPersistPercent 30 Budget for reloadable persisted data.
MaxPersistBytes 0 Exact persisted-data budget.
MetricsTracing false Periodically write performance metrics.
MetricsTracingInterval 60 Metrics interval in seconds when zero/defaulted.
ShutdownDrainSeconds 10 Wait for in-flight requests during shutdown.
LogJIT false Log native JIT compilation details.
ScanDebugging false Log scan boundaries, index selection, and scan details.
ExplainWidth 20 Pretty-print width for EXPLAIN expressions.
JoinReorderDPBudget 256 Connected subsets retained by exact join search.
ErrorQueryLog false Store failed queries in system_statistic.errors.
MaxErrorQueryLog 0 Error-log row limit; zero is unlimited.
PrintLog false Store Scheme print/time output.
MaxPrintLog 0 Print-log row limit; zero is unlimited.

Use Memory Management and Eviction, Query Planner and Physical Lowering, and Dashboard and Operations for operational context.