Skip to content

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 events
SHOW CDC EVENTS LIMIT 10;
-- Returns: timestamp_ms | table | operation | summary

Generating 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, DELETE

Storage Tiering + CDC

-- Move old data to cold storage
ALTER TABLE orders SET STORAGE COLD;
-- Check tier distribution
SHOW STORAGE TIERS;
-- Returns: hot | warm | cold tier counts with latency estimates

CDC via Redis Streams

With Redis enabled (--enable-redis), CDC events are also available via Redis Streams:

Terminal window
redis-cli XREAD COUNT 10 STREAMS heliosdb:cdc:orders 0

CDC Connectors

-- Create a CDC connector
CREATE CDC CONNECTOR my_connector TYPE kafka;
-- View connectors
SHOW CDC CONNECTORS;
-- Remove connector
DROP CDC CONNECTOR my_connector;