YMatrix
Quick Start
Connecting
Benchmarks
Deployment
Data Usage
Manage Clusters
Upgrade
Global Maintenance
Expansion
Monitoring
Security
Best Practice
Technical Principles
Data Type
Storage Engine
Execution Engine
Streaming Engine(Domino)
MARS3 Index
Extension
Advanced Features
Advanced Query
Federal Query
Grafana
Backup and Restore
Disaster Recovery
Graph Database
Introduction
Clauses
Functions
Advanced
Guide
Performance Tuning
Troubleshooting
Tools
Configuration Parameters
SQL Reference
To accommodate diverse workload requirements, YMatrix supports three write modes. The active mode is determined by the table-level parameters prefer_load_mode and rowstore_size. The default mode is Normal.

In Single mode, data accumulates in local memory up to a maximum of 1 MB before being inserted directly into the rowstore. This process resembles traditional PostgreSQL Heap insertion. Data resides directly in Shared Buffers, the size of which is controlled by the shared_buffers parameter. In Single mode, consider increasing this parameter to prevent memory swapping.

Advantages:
Disadvantages:
\dt+) may appear inflated. Manually executing VACUUM or VACUUM FULL before checking can resolve this.In Bulk mode, data is copied to local memory until it reaches the rowstore_size limit. Once this threshold is met, the data is immediately converted to columnstore format and flushed to disk. Upon completion of the insert operation, any remaining data in local memory (even if below rowstore_size) is also converted to columnstore and flushed to disk.
Advantages:
Disadvantages:
Normal mode is an intelligent insertion strategy. Data is copied to local memory.
rowstore_size, the data is immediately converted to columnstore and flushed to disk.rowstore_size / 2, it is written to the current rowstore.This is the default mode.
pgbench -n -f single_insert.sql -c 1 -j 1 -t 100000 test| Test Type | Transactions per Client | Clients | Threads | Avg Latency (ms) | TPS (incl. connection) | TPS (excl. connection) |
|---|---|---|---|---|---|---|
| single_insert.sql | 100,000 | 1 | 1 | 1.98 | 505.03 | 505.06 |
| bulk_insert.sql | 100,000 | 1 | 1 | 15.282 | 65.44 | 65.44 |
| normal_insert.sql | 100,000 | 1 | 1 | 1.968 | 508.02 | 508.05 |
time for i in {1..2000}; do psql test -f batch_insert.sql; done| Mode | Total Duration | Total Seconds (s) | Rows per Second (rows/s) |
|---|---|---|---|
| single | 2m27s | 147 | ≈ 680 |
| normal | 2m28s | 148 | ≈ 676 |
| bulk | 4m55s | 295 | ≈ 339 |
COPY into tables configured with different modes.| Mode | Rows | Duration (seconds) |
|---|---|---|
| bulk | 50,000,000 | 69.287 |
| single | 50,000,000 | 50.868 |
| normal | 50,000,000 | 70.612 |
| Table Name | Compression Ratio | Storage Savings |
|---|---|---|
| fi_voucher | 7:1 | 86% |
| fi_voucher_b | 15:1 | 93% |
| aai_voucher | 4.5:1 | 78% |
| aai_voucher_record | 8.9:1 | 89% |
In a real-world scenario inserting identical data volumes, the WAL generation rate remains consistent across modes. However, the total WAL generated is approximately 1/3 of that produced by standard Heap tables. This significantly reduces storage space occupied by WAL files.

Return to previous section: Storage Engine Principles