Tutorial: Change Data Capture (CDC) with HeliosDB
Tutorial: Change Data Capture (CDC) with HeliosDB
Level: Intermediate | Time: 10 minutes | Version: 7.2.0
Every INSERT, UPDATE, DELETE is automatically captured in the CDC event log.
Viewing CDC Events
-- Last 100 events (default)SHOW CDC EVENTS;
-- Last 10 eventsSHOW CDC EVENTS LIMIT 10;
-- Returns: timestamp_ms | table | operation | summaryGenerating Events
CREATE TABLE orders (id SERIAL PRIMARY KEY, product TEXT, amount DECIMAL);
INSERT INTO orders (product, amount) VALUES ('Widget', 29.99);INSERT INTO orders (product, amount) VALUES ('Gadget', 49.99);UPDATE orders SET amount = 34.99 WHERE product = 'Widget';DELETE FROM orders WHERE product = 'Gadget';
-- Now check:SHOW CDC EVENTS LIMIT 10;-- Shows: INSERT on 'orders' (1 rows), INSERT, UPDATE, DELETEStorage Tiering + CDC
-- Move old data to cold storageALTER TABLE orders SET STORAGE COLD;
-- Check tier distributionSHOW STORAGE TIERS;-- Returns: hot | warm | cold tier counts with latency estimatesCDC via Redis Streams
With Redis enabled (--enable-redis), CDC events are also available via Redis Streams:
redis-cli XREAD COUNT 10 STREAMS heliosdb:cdc:orders 0CDC Connectors
-- Create a CDC connectorCREATE CDC CONNECTOR my_connector TYPE kafka;
-- View connectorsSHOW CDC CONNECTORS;
-- Remove connectorDROP CDC CONNECTOR my_connector;