What is low-cost context storage (external columns)
An external column is a capability provided by PolarDB-X that offloads large fields in a table, such as AI conversation text, JSON snapshots, and binary attachments including images and PDFs, from the main table to OSS. When you create a table, add the EXTERNALIZE keyword after a large field. Your business SQL syntax requires zero changes, and you gain lower storage costs, more stable service performance, and better memory utilization.
Background
Agent and Copilot applications are becoming one of the fastest-growing and most resource-intensive workloads in OLTP databases. Take a typical chat_messages table as an example: structured metadata such as session_id / user_id / role / ts / token occupies only hundreds of bytes per row but handles most filtering and aggregation. Large content / tool_calls / context_snapshot / attachments fields in JSON format can range from several KiB to several MiB per row. A single RAG retrieval result, a lengthy tool-returned JSON payload, or a base64-encoded screenshot can easily push a row past hundreds of KiB. These payloads account for more than 95% of the total data volume, leading to high storage costs, Buffer Pool contention, and backup bloat.
PolarDB-X external columns offload large fields in a table (such as AI conversation text, reasoning chains, or binary attachments including images and PDFs) from the main table to OSS. After offloading, the main table keeps only an address pointer, and the payload itself resides in OSS. Using external columns in PolarDB-X requires no application changes: add the EXTERNALIZE keyword after a large field during table creation, and INSERT / UPDATE / DELETE / SELECT statements are written exactly as for regular tables.
Benefits
-
Lower cost: Large fields are migrated from the data node (DN) to OSS. With OSS unit storage cost estimated at approximately 1/50 of DN cost, combined with Page compression, storage costs for large text and the overall table can be significantly reduced. Actual savings should be recalculated based on the latest pricing.
-
More stable service: Offloading large fields from the DN main table reduces I/O and cache interference from large-column reads and writes on other TP workloads in the same database.
-
Better memory utilization: The Buffer Pool primarily caches frequently accessed small fields and indexes, achieving better cache efficiency with the same amount of memory.
-
Application transparency: Applications continue to use the original tables, columns, and SQL. The database manages OSS buckets, access credentials, object addresses, uploads, and lifecycle internally.
Typical scenarios
External columns are suitable for large fields that are written and read as whole segments by primary key or session ID, such as AI conversation text, agent context, JSON snapshots, reasoning chains, and binary content including images, PDFs, and audio/video files. Individual messages are typically several KiB, with longer content reaching tens of KiB. As data volumes grow from millions to hundreds of millions of rows, large fields gradually become the primary source of table space and cache pressure.
Scope of application
-
Only Enterprise Edition instances support external columns.
-
The instance version must be 2.6.0_5.4.21-20260830 or later.
NoteInstance version naming rules, see Version notes.
Instance version viewing method, see View the instance version.
Quick start
Add EXTERNALIZE after a large field to declare it as an external column during table creation:
CREATE TABLE chat_messages (
id BIGINT PRIMARY KEY AUTO_INCREMENT,
session_id BIGINT,
user_id BIGINT,
role ENUM('user','assistant','system'),
created_at DATETIME,
content LONGTEXT EXTERNALIZE,
KEY idx_session (session_id, created_at)
) PARTITION BY KEY(session_id);
Existing regular large fields can be migrated online to external columns through MCE. During migration, applications continue to use the original table, columns, and SQL without any downtime or code changes. For complete syntax, reverse migration, complex SQL, limitations, and FAQ, see Create and use external columns.
How it works

When a business transaction writes to an external column, the DN main table saves the external column address. The payload is first written to a transactional staging area to maintain write semantics. In the background, multiple small objects are compressed and aggregated into Pages and written to OSS, reducing the number of objects and request amplification.
-
Reading data: A four-level cache is used: local memory → local SSD → other compute node (CN) nodes → OSS origin. Recently written or frequently accessed data is typically served from the staging area or cache. Historical data may require cross-CN reads or OSS origin fetches on first access. Actual response time (RT) should be verified against the target version and business data.
-
Deleting data: Corresponding external objects are asynchronously cleaned up by version in the background. Physical space is gradually released as background cleanup tasks progress.
Usage considerations
-
Suitable scenarios: Large fields written and read by primary key or session ID, as well as file content that would otherwise require maintaining separate OSS and metadata systems. The access pattern is primarily "store as a whole, retrieve as a whole."
-
Scenarios to watch:
-
Frequent cold reads with strict RT requirements: Cache misses may require cross-CN reads or OSS origin fetches. Verify the first-read RT against the target version, actual object sizes, and access distribution.
-
Searching large fields: External columns do not support secondary indexes, full-text search, or LIKE fuzzy queries. Fields that need to be searched should remain as regular columns in the main table.
-
External column sync and migration: When using features such as MCE online migration or reversion to regular columns, GDNs external column replication, or DTS (data synchronization and migration), confirm that the target instance version supports the required capability before use.
-