tencent cloud

TDSQL Boundless

Release Notes
Product Introduction
Overview
Scenarios
Product Architecture
Instance Types
Compatibility Notes
Kernel Features
Kernel Overview
Kernel Version Release Notes
Functionality Features
Performance Features
Billing
Billing Overview
Purchase Method
Pricing Details
Renewal
Overdue Payments
Refund
Getting Started
Creating an Instance
Connect to Instances
User Guide
Data Migration
Data Subscription
Instance Management
Configuration Change
Parameter Configuration
Account Management
Security Group
Backup and Restoration
Database Auditing
Tag Management
Use Cases
Technical Evolution and Usage Practices of Online DDL
Lock Mechanism Analysis and Troubleshooting Practices
Data Intelligent Scheduling and Related Practices for Performance Optimization
TDSQL Boundless Selection Guide and Practical Tutorial
Developer Guide
Developer Guide (MySQL Compatibility Mode)
Developer Guide (HBase Compatibility Mode)
Performance Tuning
Performance Tuning Overview
SQL Tuning
DDL Tuning
Performance White Paper
Performance Overview
TPC-C Test
Sysbench Test
API Documentation
History
Introduction
API Category
Making API Requests
Instance APIs
Security Group APIs
Task APIs
Backup APIs
Rollback APIs
Parameter APIs
Database APIs
Data Types
Error Codes
General Reference
System Architecture
SQL Reference
Database Parameter Description
TPC-H benchmark data model reference
Error Code Information
Security and Compliance
FAQs
Agreements
Service Level Agreement
Terms of Service
Privacy Policy
Data Processing And Security Agreement
Contact Us
Glossary

Deletion of Expired Data

PDF
포커스 모드
폰트 크기
마지막 업데이트 시간: 2026-02-10 10:54:57
The system provides powerful data version control and lifecycle management features, mainly including:
Maximum versions: Controls the number of historical versions retained per cell.
Minimum versions: Used in conjunction with TTL to ensure a specified number of versions are retained when data expires.
Time To Live (TTL): Sets the data time-to-live for column families and automatically deletes expired data.
Note:
The current version only supports TTL/maximum versions/minimum versions at the ColumnFamily level, and does not support TTL/maximum versions/minimum versions at the Cell level.

Maximum Versions

Purpose: Sets the maximum versions retained per cell in each column family by using HColumnDescriptor .
Default Value: 1
Mechanism: The system does not overwrite data but appends new versions with timestamps. Old versions are deleted during Major Compaction.
Recommendation: Adjust the maximum versions based on application requirements. Avoid setting maximum versions too high (such as hundreds), as this may result in excessively large storage files.

Minimum Versions

Purpose: Sets the minimum versions retained per cell in each column family through HColumnDescriptor .
Default Value: 0 (indicating disabled).
Use Case: Used in conjunction with TTL to configure settings such as "retain data from the last T minutes, with a maximum of N versions, but keep at least M versions" (M < N).
Limitation: Applicable only when TTL is enabled for column families; must be less than the maximum versions.

TTL

Feature Description
Purpose: Sets the TTL (Time To Live) in seconds for column families. HBase automatically deletes all rows in the column family after data expiration, including both current and historical versions.
Time Basis: TTL time is based on UTC time.
Cleanup mechanism: During Minor Compaction, HBase will delete store files that contain only expired data.
Configuration Parameter
MIN_VERSIONS: If the minimum number of versions (MIN_VERSIONS) is set to a non-zero value, the TTL feature will be disabled.

Configuration Example

Set the TTL/min/maxVersions attributes for the ColumnFamily when creating a table.
TableName tableName = createTDSQLTableName("ht1");
byte[] CF1 = Bytes.toBytes("cf1");
byte[] CF2 = Bytes.toBytes("cf2");

// Create table descriptor
TableDescriptorBuilder tdb = TableDescriptorBuilder.newBuilder(tableName);

// Configure the first column family: TTL=2 seconds, minVersions=2, maxVersions=5
tdb.setColumnFamily(
ColumnFamilyDescriptorBuilder.newBuilder(CF1)
.setTimeToLive(2)
.setMinVersions(2)
.setMaxVersions(5)
.build()
);

// Configure the second column family: TTL=3 seconds, minVersions=4, maxVersions=10
tdb.setColumnFamily(
ColumnFamilyDescriptorBuilder.newBuilder(CF2)
.setTimeToLive(3)
.setMinVersions(4)
.setMaxVersions(10)
.build()
);

// Build table and create
try (Admin admin = connection.getAdmin()) {
admin.createTable(tdb.build());
}
Modify the TTL/min/maxVersions attributes of the ColumnFamily.
TableName tableName = TableName.valueOf("ht1");
byte[] CF2 = Bytes.toBytes("cf2");

try (Admin admin = connection.getAdmin()) {
// Obtain the current column family configuration
ColumnFamilyDescriptor currentDesc = admin.getDescriptor(tableName)
.getColumnFamily(CF2);
// Create a new configuration based on the existing one (retaining other settings)
ColumnFamilyDescriptor newDesc = ColumnFamilyDescriptorBuilder.newBuilder(currentDesc)
.setTimeToLive(10) // Modifying TTL=10 seconds
.setMinVersions(2) // Modify minVersions=2
.setMaxVersions(5) // Modify maxVersions=5
.build();
// Apply the modifications
admin.modifyColumnFamily(tableName, newDesc);
System.out.println("Column family configuration updated successfully");
}

도움말 및 지원

문제 해결에 도움이 되었나요?

피드백