Liquid Table
Liquid Table is a table storage mode introduced in Hologres V4.2.0 that lets you change a table's Table Group (and therefore its shard count) online after creation, with no table rebuild, no downtime, and no manual data migration.
Overview
What is Liquid Table
Liquid Table is a new table storage mode in Hologres. Its defining capability:
Dynamically reassign a table to a different Table Group (i.e., change its shard count) online after creation, with no table rebuild, no service interruption, and no manual data migration.
This addresses long-standing pain points in traditional data warehouses where adjusting shard granularity after data growth is prohibitively expensive:
|
Pain point (traditional mode) |
How Liquid Table solves it |
|
Wrong initial shard count requires a full table rebuild |
Run |
|
Data doubles but query concurrency hits a ceiling, forcing migration |
Scale out shards online; data is redistributed automatically in the background |
|
Scale-in requires rebuilding the table to reclaim resources |
Scale in online; background compaction consolidates data into fewer shards |
|
Service downtime during scaling operations |
Reads and writes continue throughout (write latency may spike briefly; read latency is unaffected) |
Key capabilities
-
Online Resharding: Use
ALTER TABLEto change the shard count at any time, transparent to applications. -
Multiple storage formats: Supports columnar (
column), row-oriented (row), and hybrid (row,column). -
Controlled data redistribution: Choose between automatic background redistribution or skipping redistribution for faster metadata switching.
-
Partition window control: Limit redistribution to the most recent N days/months of partitions, reducing I/O overhead.
-
Broad feature compatibility: Works with Dynamic Table, GSI, full-text index, vector index (HGraph), Time Travel (MVCC), Binlog, and logical partition tables.
Typical use cases
-
Data growth outpaces the initial shard estimate: Start with 16 shards, scale to 64 six months later.
-
Temporary scale-out for traffic events: Add shards before a sales event for higher query concurrency, then scale in afterward to reclaim resources.
-
Hot/cold partition management: Scale in cold historical partitions while keeping hot partitions scaled out.
-
AI vector search with elastic scaling: Dynamically scale vector tables as recall volume grows; indexes remain available throughout.
Prerequisites
Your Hologres instance must be running V4.2.0 or later. To check your instance version, see List of SQL statements.
Quick start
Create a Liquid Table
Add WITH (liquid_table = 'true') to your CREATE TABLE statement:
-- Columnar storage (default, for OLAP workloads)
CREATE TABLE my_table (
id INT NOT NULL,
name TEXT,
ts TIMESTAMPTZ,
PRIMARY KEY(id)
) WITH (liquid_table = 'true');
-- Row-oriented storage (for point lookups / high-frequency updates)
CREATE TABLE my_row_table (
id INT NOT NULL,
name TEXT,
PRIMARY KEY(id)
) WITH (liquid_table = 'true', orientation = 'row');
-- Hybrid storage (for mixed point-lookup + OLAP workloads)
CREATE TABLE my_hybrid_table (
id INT NOT NULL,
name TEXT,
PRIMARY KEY(id)
) WITH (liquid_table = 'true', orientation = 'row,column');
Change the shard count (Resharding)
Resharding is performed by reassigning the table to a different Table Group:
-- Create a target Table Group if one does not already exist
CALL hg_create_table_group('tg_64', 64);
-- Scale out (takes effect synchronously)
ALTER TABLE my_table SET (table_group = 'tg_64');
-- Scale in
ALTER TABLE my_table SET (table_group = 'tg_16');
The ALTER command returns immediately once the metadata switch is complete. New writes and queries use the new shard layout right away; existing data is redistributed asynchronously in the background.
Verify the current shard configuration
-- Check the Table Group and shard count for a table
SELECT property_key, property_value
FROM hologres.hg_table_properties
WHERE table_name = 'my_table'
AND property_key = 'table_group';
-- Check Table Group metadata
SELECT * FROM hologres.hg_table_group_properties
WHERE tablegroup_name = 'tg_64';
Table properties reference
Creation-time properties
|
Property |
Type |
Default |
Description |
|
liquid_table |
BOOLEAN |
false |
Enables Liquid Table mode. Must be specified at table creation time; cannot be enabled later via ALTER TABLE. |
|
orientation |
STRING |
column |
Storage format: |
|
liquid_table_enable_data_reorganization |
BOOLEAN |
true |
Whether to automatically redistribute existing data in the background after Resharding. |
|
liquid_table_reorganization_partition_window |
STRING |
All partitions |
Limit redistribution to partitions within a specified time window, e.g. |
Choosing the right value for liquid_table_enable_data_reorganization
|
Value |
Behavior |
Best for |
|
true (default) |
Background redistribution runs after Resharding, incurring I/O overhead until complete. |
Long-lived active tables where stable query performance matters. |
|
false |
No background redistribution. Query performance on old data may degrade. |
Tables about to be archived or truncated; temporary scenarios where minor performance degradation is acceptable. |
Performance note for false mode: Hologres uses up to 8x internal oversharding to mitigate performance loss. In typical 2-4x scaling scenarios, the impact is near-zero. However, when the scaling factor significantly exceeds the oversharding limit (e.g. 16x or more), old-data query performance can degrade proportionally.
Partition window example
-- Redistribute only the most recent 30 days of partitions (requires a time-type partition key)
ALTER TABLE order_log SET (
table_group = 'tg_64',
liquid_table_reorganization_partition_window = '30 day'
);
This is ideal for long-retention log or fact tables where historical cold partitions are rarely accessed — only the hot partitions need redistribution.
Feature compatibility
Compatibility matrix (V4.2.0)
|
Feature combination |
Supported |
Remarks |
|
Dynamic Table as a Liquid Table |
Yes |
After Resharding, the Dynamic Table undergoes a one-time full rebuild with longer refresh latency, then resumes incremental computation. |
|
Liquid Table as a source table for Dynamic Table |
Yes |
After Resharding, the Dynamic Table undergoes a one-time full rebuild with longer refresh latency, then resumes incremental computation. |
|
Global Secondary Index (GSI) |
Yes |
Tables with GSI can be resharded in V4.2. |
|
Full-text inverted index |
Yes |
Index remains usable after Resharding. |
|
Vector index (HGraph) |
Yes |
Index remains usable; approximate search results stay stable. |
|
Logical partition table |
Yes |
Resharding is supported; auto-partitioning works normally. |
|
Time Travel (MVCC) |
Yes |
Historical data remains queryable after Resharding. |
|
Binlog |
Requires experimental GUC |
Requires an experimental GUC and has specific requirements for downstream consumers. |
|
Physical partition table |
No |
Use logical partition tables instead. |
|
Materialized view (MV) |
No |
|
|
Converting an existing table to Liquid Table via ALTER |
No |
Must use the rebuild migration approach. |
|
MaxCompute direct read of Liquid Table |
No |
Not yet supported. |
Index coexistence examples
-- Full-text index
CREATE INDEX ft_idx ON my_table USING FULLTEXT (content)
WITH (tokenizer = 'jieba');
-- GSI (Global Secondary Index)
CREATE GLOBAL INDEX gsi_name ON my_table(name) INCLUDE (ts);
-- Vector index (via the vectors property)
ALTER TABLE my_table SET (vectors = '{
"embedding": {
"algorithm": "HGraph",
"distance_method": "Cosine"
}
}');
After creating indexes on a Liquid Table, you can perform Resharding via ALTER TABLE ... SET (table_group = '...') directly. All indexes remain usable on the new shards automatically.
Impact of Resharding on workloads
This chapter is required reading for data warehouse developers and DBAs before executing ALTER TABLE ... SET (table_group = ...).
Resharding consists of two internal phases:
-
Metadata switch (synchronous): The
ALTER TABLEcommand itself. Completes in seconds; the new shard topology takes effect when the command returns. -
Data redistribution (asynchronous background): Migrates/compacts existing data from old shards to new shards. Duration depends on data volume, scaling factor, and available I/O.
Throughout the process, reads and writes are expected to continue without failures or blocking. However, write latency and old-data query performance will be observably affected. Plan your maintenance window and rollback strategy assuming visible impact — do not assume zero impact.
Impact summary
|
Dimension |
Metadata switch phase (seconds) |
Data redistribution phase (async background) |
|
Service availability |
No interruption expected |
No interruption expected |
|
Request failures |
No failures expected (in edge cases, a small number of transient errors may occur — rely on client retries) |
No failures expected |
|
Write latency |
Observable spikes, typically milliseconds to seconds, potentially longer in some cases |
May increase slightly due to background I/O contention |
|
Write throughput |
Observable decrease before and after the switch |
Highly dependent on instance I/O headroom; may be throttled |
|
New-data query performance |
Largely unaffected |
Largely unaffected (already written to new shards) |
|
Old-data query performance |
May degrade immediately |
May continue to degrade until redistribution completes; degradation can be significant, but typical scenarios (e.g. 2x scaling) can largely avoid it |
|
Index availability |
Remains available |
Remains available (performance may be affected by underlying I/O contention) |
|
Transaction consistency |
Guaranteed |
Guaranteed |
The "no interruption expected" and "no failures expected" statements in the table above indicate behavior under common conditions and are not absolute guarantees. Actual behavior depends on instance specifications, data volume, concurrent load, and scaling factor. We strongly recommend rehearsing in a test environment before performing Resharding in production.
Impact on writes
1) Writes are not expected to fail, but configure client retries. During the metadata switch, a small number of concurrent requests may encounter transient errors (e.g. connection timeouts). Connectors should have automatic retries enabled. There will be no prolonged write unavailability.
2) Write latency will spike observably — this is not "zero impact". In-flight writes must wait for the new topology to take effect. Spikes are typically in the millisecond-to-second range but may be longer when:
-
Long-running transactions are active on the table.
-
Instance I/O utilization is already high.
-
The scaling factor is very large (e.g. 8 shards directly to 128 shards).
3) During the redistribution phase, writes are not blocked but latency may increase slightly.
-
Background data migration consumes instance I/O and may compete with foreground writes for resources.
-
On instances with high I/O utilization, write latency during redistribution may be slightly higher than steady state, and throughput may also decrease slightly.
-
We recommend continuously monitoring instance I/O and write RT metrics during the redistribution phase.
4) For COPY / bulk import workloads: start bulk imports only after Resharding and redistribution are fully complete. Importing large volumes during Resharding significantly extends redistribution time and amplifies write latency fluctuations.
Impact on queries
1) Queries are not expected to fail or be blocked.
-
During the metadata switch, new queries execute against the new topology.
-
In-flight queries complete normally.
-
In rare cases, queries issued at the exact switch instant may time out due to route rerouting. Client retries should handle this.
2) Read latency impact at the switch instant is typically minimal, but not zero.
-
Compared to writes, the read path is less affected by the switch.
-
Queries hitting the switch moment undergo route rerouting; latency-sensitive real-time APIs may observe millisecond-level jitter.
-
For high-QPS point-query scenarios, plan upstream timeout settings assuming brief jitter will occur.
3) Old-data query performance may degrade significantly until redistribution completes:
|
Scenario |
Old-data query performance impact |
|
Power-of-2 scale-out with a power-of-2 shard count (32 → 64) |
Minimal degradation due to internal oversharding optimization |
|
Power-of-2 scale-out but shard count not a power of 2 (20 → 40) |
Internal oversharding optimization still applies, but the performance degradation is greater than when the shard count is a power of 2 |
|
Non-power-of-2 or non-integer-multiple scale-out |
Moderate degradation, generally no more than 2x |
|
Very large scale-out (16x+ from the original shard count) |
Degrades proportionally to scaling_factor/8; worst case: queries effectively unusable until redistribution completes |
|
Integer-multiple scale-in (32 → 16) |
Lower query parallelism; mild to moderate performance degradation |
|
Non-integer-multiple scale-in, or shard count not a power of 2 |
Moderate degradation, generally no more than 2x |
Internal oversharding optimization: Hologres asynchronously applies 8x oversharding to data in the background by default. When the shard count is a power of 2, the following table shows the expected query performance loss for data that has been fully oversharded at each scaling factor.
|
Scaling factor (k) |
Performance loss |
|
Scale-in 50% (0.5x) |
0% |
|
1x |
0% |
|
1.5x (50% scale-out) |
12.5% |
|
2x |
0% |
|
2.5x |
15% |
|
3x |
25% |
|
4x |
0% |
|
5x |
40% |
|
6x |
50% |
|
7x |
75% |
|
8x |
0% |
In most cases, data has been fully oversharded, so typical scaling scenarios (2x, 4x) have near-zero performance loss. However, oversharding is mitigation, not a guarantee —
-
If the shard count is not a power of 2, typical scaling scenarios still incur some performance loss.
-
When the scaling factor exceeds the oversharding capacity (e.g. beyond 8x), oversharding can no longer effectively prevent performance loss.
-
When the data volume per shard is too small, oversharding optimization may not be applied.
-
Under heavy write pressure, a significant portion of newly written data may not yet have oversharding applied.
-
When data distribution or shard key selection is suboptimal, performance degradation may still be significant.
-
Do not rely on oversharding as a guarantee of zero degradation.
4) Queries on newly written data are largely unaffected.
-
New data is written to the new shard topology; query performance is consistent with steady state.
-
However, if a query spans both new and old data (e.g. time-range scans), the overall RT is still dragged down by the degraded old-data performance.
5) Index queries (GSI / full-text / vector) remain functional but may not have stable performance. Indexes remain usable after Resharding, but physical I/O for index lookups may contend with background redistribution, causing elevated response times until redistribution completes. Monitor P99 and long-tail queries closely.
Recommendations for latency-sensitive workloads
If your workload falls into any of the following categories, treat Resharding as a risky change and follow your change management process:
|
Workload type |
Recommended mitigations |
|
Real-time dashboards / ad-hoc BI queries |
Execute during off-peak hours; prefer power-of-2 scaling; coordinate with stakeholders on the maintenance window. |
|
Online point lookups (CRM / risk control / account APIs) |
Row-oriented tables have lower Resharding impact — prefer them for this use case. Increase client timeouts; prepare degradation strategies (rate limiting, cache fallback). |
|
Flink real-time writes |
Increase connector retry and backpressure parameters; monitor source-side lag; plan for upstream buffering during the maintenance window. |
|
Binlog consumers |
Follow the Binlog-specific procedure in this document; notify all downstream consumers to perform stateless restarts; allow time for consumers to catch up. |
|
High-frequency UPSERT jobs |
Execute strictly during off-peak hours; prefer power-of-2 scaling factors. |
|
SLA-critical OLAP reports |
Assess the expected query performance degradation before proceeding; consider splitting into multiple smaller scaling steps if necessary. |
Estimated impact duration (conservative)
|
Phase |
Conservative duration estimate |
Scope of impact |
|
Metadata switch |
Seconds; may take minutes if waiting for long transactions |
Observable write latency spikes; a few requests may need retries |
|
Redistribution (small tables <100 GB) |
Tens of minutes |
Sustained old-data query degradation; writes may be affected by I/O contention |
|
Redistribution (medium tables 100 GB – 1 TB) |
Hours to half a day |
Sustained old-data query degradation; schedule during off-peak hours |
|
Redistribution (large tables >1 TB) |
One day or more; potentially multiple days |
Extended old-data query degradation; strongly recommend using |
Bottom line
Resharding keeps the service running and requests succeeding, but plan for observable impact: write latency will spike (milliseconds to seconds, potentially longer in edge cases); old-data query performance degrades until redistribution finishes — the severity correlates with the scaling factor and whether it is a power-of-2 multiple; worst case, degradation may persist for an extended period; in typical scenarios (2x scaling), internal oversharding optimization can largely mitigate the impact.
Binlog-specific considerations (important)
If your Liquid Table has Binlog enabled (binlog_level = 'replica'), Resharding behavior differs from regular tables. Read this entire section before proceeding.
Default behavior
Liquid Tables with Binlog enabled do not allow Resharding by default. Running ALTER TABLE ... SET (table_group = ...) directly returns an error.
Forced Resharding procedure
-- Step 1: Enable the experimental GUC (session-level only)
SET hg_experimental_enable_liquid_resharding_for_table_with_binlog = on;
-- Step 2: Perform Resharding
ALTER TABLE my_binlog_table SET (table_group = 'tg_64');
-- Step 3: Clean up delta data on old shards
CALL hg_liquid_resharding_drop_non_current_delta('my_binlog_table');
Impact on Binlog consumers
|
Event |
Description |
|
During Resharding |
Binlog consumers (connectors) will encounter errors and trigger failovers. However, offsets become invalid and the job enters an unusable state. |
|
After scale-out (shard count increases) |
Failover will likely succeed, but the state is unreliable — a stateless restart is required. |
|
After scale-in (shard count decreases) |
Failover will always fail. |
|
After Resharding completes |
All consumers must perform a stateless restart (reset offsets and re-consume from the beginning). |
|
SQL-based Binlog queries |
Only Binlog entries generated after the most recent Resharding are visible; historical entries are lost. |
DBA checklist: 1) Notify all Binlog downstream consumers (Flink / connectors / custom subscribers); 2) During the maintenance window: pause consumers → perform Resharding → call the cleanup procedure → restart all consumers statelessly; 3) Never reshard a Binlog-enabled Liquid Table without coordinating with downstream consumers.
Migrate existing tables to Liquid Table
Existing tables cannot be converted to Liquid Tables via ALTER. Use one of the following two approaches.
Approach 1: Convert via REBUILD (recommended)
Starting from Hologres V4.2, you can use ASYNC REBUILD TABLE to rebuild an existing table into a Liquid Table in place, with no new table, no manual data migration, and the table name unchanged. For details about REBUILD, see REBUILD.
-- Convert an existing table into a Liquid Table in place (table name unchanged)
ASYNC REBUILD TABLE my_table
SET (
liquid_table = 'true'
);
Approach 2: New-table migration
Create a new Liquid Table, migrate the data from the existing table, and switch over using an atomic transactional rename.
-- 1. Create a new Liquid Table with the same schema
CREATE TABLE my_table_new (
id INT NOT NULL,
name TEXT,
ts TIMESTAMPTZ,
PRIMARY KEY(id)
) WITH (liquid_table = 'true');
-- 2. Copy data
INSERT INTO my_table_new SELECT * FROM my_table_old;
-- 3. Recreate indexes (if any)
CREATE INDEX ... ON my_table_new ...;
-- 4. Atomic swap using a transaction
BEGIN;
ALTER TABLE my_table_old RENAME TO my_table_bak;
ALTER TABLE my_table_new RENAME TO my_table;
COMMIT;
-- 5. Drop the backup after verification
DROP TABLE my_table_bak;
Limits
-
Hologres V4.2.0 or later is required. Upgrade your instance first if you are running an earlier version.
-
The
liquid_tableproperty can only be set at table creation time. Existing regular tables cannot be converted to Liquid Tables viaALTER TABLE. Use the rebuild migration approach instead. -
Physical partition tables are not supported. Attempting to use physical partition syntax on a Liquid Table returns the error
Physical partitioned table of liquid table is not supported. Use logical partition tables instead. -
Materialized views cannot be created on Liquid Tables. Use Dynamic Table as an alternative.
-
MaxCompute direct read of Liquid Tables is not yet supported. If your downstream depends on MaxCompute direct read, Liquid Table is not applicable in the current version.
-
An instance that contains Liquid Tables cannot be downgraded to a version that does not support the feature. Ensure you do not need to roll back your instance version before creating Liquid Tables.
-
During Resharding (Table Group change), write latency will spike observably (milliseconds to seconds, potentially longer in edge cases) and old-data query performance may degrade significantly.
-
ALTER TABLE ... SET (table_group = ...)must wait for all in-progress DML operations on the table to complete before execution begins. Long DML operations or open transactions will block the ALTER command. -
The
liquid_table_reorganization_partition_windowparameter only works with a single time-type partition key. Multiple partition keys or non-time-type partition keys are not supported. -
Liquid Tables with Binlog enabled cannot be resharded by default. You must enable the experimental GUC
hg_experimental_enable_liquid_resharding_for_table_with_binlogand ensure downstream Binlog consumers can tolerate stateless restarts. -
After Resharding, SQL-based Binlog queries only return entries generated since the most recent Resharding. Historical Binlog is no longer visible.
-
A Table Group cannot be deleted while tables are still attached to it.
-
Resharding is a non-reversible operation — once the metadata switch completes, there is no "rollback" shortcut. To revert, you must run ALTER again to move the table to the original Table Group.
-
The current version does not provide a Resharding progress query interface. There is no way to check the exact percentage of data redistribution in real time.
Best practices
When to enable Liquid Table
Strongly recommended:
-
Data volume is expected to grow 5x or more over the table's lifetime.
-
Traffic has seasonal spikes or sales events requiring elastic shard scaling.
-
Core fact or wide tables in a real-time data warehouse.
-
AI vector search tables.
Can defer:
-
Small dimension tables with stable data volume.
-
Workloads that depend on physical partition tables.
-
Workloads that depend on MaxCompute direct read.
Shard count planning guidelines
|
Data per shard |
Recommended action |
|
< 10 GB |
May be over-sharded; consider scaling in |
|
10 GB – 50 GB |
Healthy range |
|
50 GB – 100 GB |
Monitor query performance; prepare to scale out |
|
> 100 GB |
Scale out immediately |
Resharding execution tips
-
Run during off-peak hours: Execute ALTER during a low-traffic maintenance window.
-
Quiesce large DML: Ensure no bulk INSERT/UPDATE/DELETE jobs are running.
-
Prefer power-of-2 multiples: e.g. 16 → 32 → 64 yields smoother performance than 16 → 50.
-
Use partition window for large tables: Set
liquid_table_reorganization_partition_windowto limit the redistribution scope on long-lifecycle partition tables. -
Rehearse Binlog tables end-to-end: Test the complete Resharding + downstream restart flow in a staging environment first.
Monitoring recommendations
-
Before redistribution completes: periodically compare query response times across old and new shards to gauge progress.
-
Instance resource utilization: Resharding incurs additional I/O overhead — monitor CPU and I/O usage.
-
Binlog cursor lag: for Binlog-enabled tables, monitor downstream consumer lag.
FAQ
Q1: What is the fundamental difference between a Liquid Table and a regular table?
A: Liquid Tables use a base + delta storage model that allows the shard layout to change without rewriting all data. Regular tables have their shard distribution fixed at creation time — changing shards requires a full table rebuild.
Q2: Can Resharding cause data loss?
A: No. Read and write requests maintain transactional consistency throughout Resharding. All committed data is preserved. Verification testing confirmed 100% data integrity before and after Resharding.
Q3: Does Resharding cause service downtime?
A: The service remains available throughout Resharding and requests are not expected to fail. However, write latency will exhibit observable spikes (milliseconds to seconds), and old-data query performance may degrade until redistribution completes. See the "Impact of Resharding on workloads" section for details.
Q4: How long does Resharding take?
A: The ALTER TABLE command itself returns in seconds (synchronous metadata switch). Actual data redistribution runs asynchronously in the background, with duration proportional to data volume and scaling factor.
Q5: Can I reshard a table multiple times?
A: Yes. However, each Resharding triggers a new round of background redistribution. Plan your target shard count carefully to avoid frequent changes.
Q6: Can I monitor Resharding progress?
A: The current version does not provide a dedicated progress API. You can infer progress by monitoring background compaction tasks and query response times. This capability is on the product roadmap.
Q7: Does scaling in immediately free storage?
A: Scale-in consolidates data into fewer shards immediately, but storage space is actually reclaimed only after background compaction completes.
Q8: Does Liquid Table incur additional storage overhead?
A: The base + delta model may have minor overhead while delta data has not yet been compacted. Background compaction eliminates this automatically. Overall storage usage is comparable to regular tables.
Q9: Can multiple index types (GSI + full-text + vector) coexist on one Liquid Table?
A: Yes. V4.2 supports Resharding Liquid Tables that have multiple index types simultaneously.
Q10: Can I convert a Liquid Table back to a regular table?
A: Yes, via reverse rebuild: create a regular table, use INSERT INTO ... SELECT to migrate data, then RENAME to swap. Note that once an instance contains Liquid Tables, it cannot be downgraded to a version that does not support the feature.
Quick reference
-- Create a Liquid Table
CREATE TABLE t (...) WITH (liquid_table = 'true');
-- Resharding
ALTER TABLE t SET (table_group = 'tg_xxx');
-- Disable background redistribution
ALTER TABLE t SET (liquid_table_enable_data_reorganization = 'false');
-- Redistribute only the last 30 days of partitions
ALTER TABLE t SET (
table_group = 'tg_xxx',
liquid_table_reorganization_partition_window = '30 day'
);
-- Reshard a Binlog-enabled table (experimental; requires downstream restart)
SET hg_experimental_enable_liquid_resharding_for_table_with_binlog = on;
ALTER TABLE t SET (table_group = 'tg_xxx');
CALL hg_liquid_resharding_drop_non_current_delta('t');