See the best posts from any Bluesky account
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

Add ClickHouse firehose like tables and memory caps

Phase 1 schema for the firehose virality webhook: a lookup table mapping
like URI to subject URI (needed for unlike event resolution) and a daily
SummingMergeTree for per-post net like counts. Both have 8-day TTL — 7
days of query window plus one day of slack. Split across two files because
the ClickHouse migrator rejects multi-statement queries.

Also adds a clickhouse/config.d/memory.xml override capping server memory
at 3 GiB and per-query memory at 1 GiB so ClickHouse fails queries
gracefully instead of being OOM-killed inside the 4 GiB Docker limit.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+28
+11
clickhouse/config.d/memory.xml
··· 1 + <clickhouse> 2 + <!-- Cap total ClickHouse server memory at 3 GiB so it fails queries gracefully 3 + rather than being OOM-killed by Docker (the container limit is 4 GiB). --> 4 + <max_server_memory_usage>3221225472</max_server_memory_usage> 5 + <profiles> 6 + <default> 7 + <!-- Per-query cap: 1 GiB. --> 8 + <max_memory_usage>1073741824</max_memory_usage> 9 + </default> 10 + </profiles> 11 + </clickhouse>
+8
database/clickhouse/006_create_like_events_lookup.sql
··· 1 + CREATE TABLE IF NOT EXISTS like_events_lookup ( 2 + like_uri String, 3 + subject_uri String, 4 + created_at DateTime 5 + ) 6 + ENGINE = MergeTree 7 + ORDER BY like_uri 8 + TTL created_at + INTERVAL 8 DAY
+9
database/clickhouse/007_create_like_counts_daily.sql
··· 1 + CREATE TABLE IF NOT EXISTS like_counts_daily ( 2 + subject_uri String, 3 + day Date, 4 + count Int64 5 + ) 6 + ENGINE = SummingMergeTree 7 + ORDER BY subject_uri 8 + PARTITION BY day 9 + TTL day + INTERVAL 8 DAY