goflow-clickhouse
goflow-clickhouse copied to clipboard
ClickHouse Transporter Optimizations - Summary
1️⃣ Optimized Table Schema
Changed SrcAddr, DstAddr, and SamplerAddress to IPv4 (previously UInt32). Changed Proto to UInt8, SrcPort/DstPort to UInt16 (fixed type mismatch errors). Optimized partitioning to toYYYYMM(TimeReceived) (reduced excessive partitions). 2️⃣ Fixed Data Type Mapping
Ensured correct type conversions for all flow fields before insertion. Used IPv4 format for IPs and proper UIntX types for other values. Fixed "unexpected type" errors in ClickHouse inserts. 3️⃣ Added SamplerAddress (Router IP)
Now stores the router IP that sent the flow data (SamplerAddress field). Allows filtering flows by source router. 4️⃣ Improved Bulk Insert Performance
Used transaction-based batch inserts instead of inserting row-by-row. Reduced ClickHouse write overhead and improved query speed. This commit improves stability, compatibility, and performance of the ClickHouse transporter in GoFlow. 🚀