8000 Move live memory to Postgres and keep vector search in ClickHouse · Issue #142 · ClickHouse/loom · GitHub
[go: up one dir, main page]

Skip to content

Move live memory to Postgres and keep vector search in ClickHouse #142

Open

Description

@zlareb1

Component

Memory and search

Use case

Loom needs to support frequent point reads and writes alongside tenant-scoped retrieval and scans over billions of records. These workloads should not all use the same write path.

A memory write needs ordered versions, compare-and-set, locks and pin checks. ClickHouse serves retrieval and analytics, but its part creation and merge costs make individual committed inserts a poor fit for this workload. #129 batches several request-path tables; it leaves the main memory tables committed.

The sizing assumptions are 5,000 tenants, 50,000 namespaces, 1,000–50,000 memory writes/sec and up to 10,000 user searches/sec. These are design inputs, not measured capacity or production traffic. If all 50,000 writes need a semantic conflict check, that adds 50,000 retrievals/sec before user search, extra retrieval legs or background work. At a sustained 50,000 writes/sec, the system also produces 4.32 billion write events/day.

Quality is the highest priority: retrieval and admission verdicts must use the right revisions, preserve tenant and access boundaries, and retain the evidence needed for recovery. Scalability and low end-to-end latency are required alongside that quality. Optimize cost and component count only within those guarantees; do not trade away recall, durability or access checks to meet a throughput number.

The goals are point reads without a second database lookup, transactional writes, fresh search results, and bounded ingest and retention costs. Postgres and ClickHouse are the only databases. All stored vectors and vector search stay in ClickHouse. The sizing inputs describe a deployment spread across placement units; they are not a promise that one Postgres primary or one namespace sustains the aggregate peak.

Describe the solution you'd like

Storage ownership

Postgres stores current memory content, not just its latest version and hash.

Workload Storage
Current memory content, metadata, versions, locks, pins and compare-and-set Postgres
Working memory, task state, idempotency and delivery claims Postgres
Identity, grants, revocation and mutable namespace configuration Postgres
Revision journal and enrichment jobs Postgres, retained until their required deliveries complete
Embeddings, lexical and vector retrieval, searchable metadata and derived graph projections ClickHouse
Historical revisions, conversation archives, audit queries, usage and rollups ClickHouse
Large immutable code-index artifacts and compiler graph generations ClickHouse

Every live record has one authority. Preserve (org, namespace, agent, user_id, session_id), stable record identity, source revision, actor, source class and attestation through both stores. The server derives provenance from the authenticated writer and operation. Org-wide identifiers must still pass the same scope checks without revealing another tenant's records. A ClickHouse projection cannot grant access to a record Postgres refuses.

The Postgres transaction atomically records current content, the complete immutable revision, required delivery jobs, the idempotency state and a hash-only mutation audit event. Keep mutable delivery progress separate from revision payloads so job updates do not replicate the content again. A search document is a derived serving representation, not the revision journal or the audit record. Required audit events are durable before the audited operation completes; best-effort usage metrics have a separate delivery contract.

Keep the existing ClickHouse-only install path for smaller deployments. This proposal defines the Postgres+ClickHouse path. Record the selected authority and reject replicas configured for a different one; an outage must not silently switch a deployment between them.

WalShadow replication and enrichment have different jobs

Use ClickHouse Managed Postgres with WalShadow for selected database mirrors and revision events. WalShadow is the first implementation path. Loom should not build a general WAL transport or run two writers into the same destination projection.

Build and test the replication path with WalShadow. Judge it by source load, replication lag, payload correctness and recovery under Loom workloads. Its private-preview status alone is not a reason to defer implementation or choose ClickPipes. A documented or reproduced limitation that blocks a required guarantee is a release blocker, not an accepted reduction in quality. Replication benchmarks are not a latency guarantee for a Loom operation.

Pin the evaluated WalShadow build and replication configuration. Its documented limits include failure to continue after an unplanned primary promotion and unresolved large-value reconstruction cases. Validate complete revision payloads, including large text and JSON values, against source hashes through initial load, updates, cleanup and restart. A selected value mode that can substitute missing or incorrect bytes does not qualify for archival delivery. Keep WalShadow as the first implementation path, resolve blocking limitations, and reconsider the transport if it cannot satisfy the required guarantees (limits, failover protocol).

Replicate an explicit allowlist of tables and columns. Destination identities must distinguish source placement units, databases and tenants, including during a tenant move. Mutable configuration mirrors serve analytics, not authorization. Account for WalShadow recovery state and large-value mirrors in capacity, access control, backup and erasure inventories.

Loom still needs enrichment jobs. CDC does not generate embeddings or decide when a revision is searchable. These jobs read committed revisions directly from Postgres and publish search documents into ClickHouse without first waiting for the CDC mirror.

A search document carries its source revision, content hash, embedding-model and preprocessing versions, chunk identity, text and filter metadata. Reuse an embedding only when its input and model contract match. A worker can rebuild the document from a retained revision or its confirmed archive. Vectors never pass through Postgres tables or its revision journal.

Readiness is recorded only after every projection required by that operation is delivered and visible. Optional graph or analytics work does not delay a write unless its contract requires it. Lexical publication can precede embedding completion, but it must not mark semantic search ready or weaken ordinary memory.set success semantics.

Writes and point reads

For a semantic memory.set:

  1. Validate the value and access scope. Start embedding work and the required search-freshness check concurrently.
  2. Check duplicates, conflicts and protected memories against sufficiently fresh state.
  3. In a short Postgres transaction, recheck the key version and relevant guards, update current content, and record the complete revision and required jobs.
  4. Publish the required search projection directly into ClickHouse.
  5. Return success after the operation's promised visibility is satisfied.

Do not hold a database transaction open during inference or ClickHouse queries. Reuse embeddings computed during admission, and reuse existing embeddings for metadata-only changes.

Postgres handles same-key compare-and-set atomically. For cross-key semantic admission, capture a generation for every scope whose state can change the verdict and wait for its required search projections. Every relevant creation, update, pin, blacklist, access-policy or model-manifest change advances the corresponding generation in the mutation transaction. After inference and retrieval, compare those generations again in the short commit transaction and advance them with the write. Checking only returned candidate versions misses a peer created while the check was running. A Postgres isolation level alone does not track predicates evaluated in ClickHouse. Recheck time-based expiry and lock leases at commit; a generation does not track the passage of time.

Enforce pinned and blacklist protections separately from approximate result ranking. A contract that refuses peers above a similarity threshold needs a complete check over eligible protected peers; an ANN or quantized shortlist alone cannot prove that no protected peer matches. Evaluate the false-accept and false-refusal rates of semantic verdicts as well as retrieval recall.

Use a deterministic lock order across affected scopes, bounded retries and one request deadline. Batch admissions within busy conflict scopes, including interactions between writes in the batch; vector comparisons still execute in ClickHouse. A namespace-wide invariant still needs namespace-wide coordination; do not split that scope or omit checks to claim horizontal scalability. Measure its sustainable rate and reject excess work explicitly before queues grow without bound.

memory.set and bulk_set keep their inline verdicts, including pinned refusals. Deferred ingestion is a separate contract that reports pending enrichment. Ordinary transactional operations that need no semantic work finish at the Postgres commit.

A crash after that commit leaves a durable revision and a repairable job. Scope idempotency to the authenticated caller and operation, bind it to a request digest, and replay it only after current authorization. Reusing a key with different input is rejected. A projection timeout returns the committed revision, operation identity and pending state; a retry resumes that revision instead of admitting a second mutation. Specify status lookup, cancellation after commit, idempotency retention, expired-key behavior and the HTTP, MCP and SDK responses before changing the write path.

memory.get reads current content directly from Postgres. Strict current reads, final authorization and admission guards use the primary; replicas serve other reads only when their replay position meets the request's consistency requirement.

Retrieval and visibility

Strict search captures a finite committed barrier for its authorized scopes when admitted, including any caller-supplied write dependencies, then checks that the selected ClickHouse reader can serve the required projections. Later writes do not keep moving that barrier. This promises coverage through the captured barrier, not an atomic snapshot across the two databases. Current access and deletion checks still apply, and concurrent content changes can require bounded refill or an explicit incomplete result. Any weaker consistency mode is an explicit API contract, never an automatic timeout fallback.

Several writes share one visibility wait at a dependent search. Track a completed prefix with gaps or an equivalent durable manifest; event allocation order and the largest observed revision do not prove that earlier work committed or finished. A superseded revision can be resolved only when the protocol proves that its required serving effect is covered. An insertion acknowledgement or a readiness row on one replica is not proof for every reader. Bind the proof to the actual tables, serving generation and reader; re-establish it after rerouting or replica changes (ClickHouse read consistency).

Track committed state and searchable readiness separately. Readiness includes the source revision, model version and reader visibility. A replication cursor or max(event_id) is not enough. WalShadow documents that different tables from one Postgres transaction can become visible in ClickHouse at different times (consistency limits).

Retrieve lexical, semantic, entity and temporal candidates in ClickHouse. Apply tenant and known eligibility filters inside every retrieval leg, then batch-check candidate revisions, permissions, expiry and deletion state in Postgres before exposing snippets or sending content to an external reranker or answer model. Never attach current content to a score computed from an older revision. Apply the same checks to graph expansion, context assembly, caches, traces, exports and history APIs; an analytical mirror is not an access authority.

Candidate validation cannot recover a relevant revision absent from the search projection. Discard obsolete candidates, deduplicate by source identity and revision, and refill within bounded rounds, rows, bytes and time. Report readiness failures, refill exhaustion and missing required retrieval legs as explicit unavailable or incomplete outcomes. Do not label a truncated pool a complete empty result or let an answer model present it as complete evidence. Define authorization and revision check points for external dispatch and final response, and revalidate when the relevant access generation changes during a long request.

Tenant policy controls external model use and content egress. Partition result and model caches by access scope, source revisions, model and serving generation. Revocation and erasure invalidate affected entries; raw ClickHouse tables and pg_clickhouse must not expose an alternative route around these checks.

Keep the existing retrieval path as the baseline. Small eligible sets use tenant-scoped exact scans or an evaluated quantized shortlist with original-vector rescoring. Large tenants get dedicated placement and serving capacity.

#131 found that the tested HNSW layout did not serve tenant reads and had recall and stale-version problems. Adding the same index is not the solution. Evaluate immutable indexed generations plus recent changes for large tenants, but require evidence that the index is used and that filtered recall holds before making that layout part of the serving path. ClickHouse documents both filter trade-offs and index-building cost during inserts and merges.

Version the complete retrieval contract: embedding input and dimensions, lexical tokenization and ranking, filters, fusion, candidate budgets, reranking and temporal rules. Evaluate exact identifiers and phrases, semantic paraphrases, multilingual queries, negation, conflicting revisions, expiry and sparse tenants. Model size or exact vector-neighbor recall alone is not evidence of better final relevance or agent outcomes. Compare candidate generators, embedding and reranking choices on the same evaluation set; the existing path is a control, not a quality ceiling. Choose the strongest measured end-to-end quality that meets the declared capacity and latency requirements, then optimize p99 without lowering the quality gates. Keep citations tied to the validated source revision and test abstention when evidence is insufficient.

Build model and index changes as separate ClickHouse serving generations. Backfill, replay intervening changes and erasures, compare quality against the baseline, prove reader visibility, then atomically switch the Postgres serving manifest. A request pins one compatible model and generation until completion or timeout; retire a generation only after its readers drain. Never compare vectors from incompatible models. Retain a verified generation for rollback only within erasure and retention rules. Measure concurrent rebuild load and bound the recent-change set so it cannot become an unbounded exact scan.

Use pg_clickhouse for unified SQL and analytical queries where the installed version pushes the work down. Keep native ClickHouse queries for the initial serving path. Check EXPLAIN before routing a query through Postgres: unsupported filters can prevent limit pushdown, and SQL compatibility alone says nothing about the cost.

Tenant placement and database branching

Tenant placement belongs to this architecture; #157 consumes its routing and isolation contract. A tenant is the customer organization represented by org. A contract requiring a separately isolated workspace can register its owned namespace set as an explicit placement unit. Neither a user nor an agent/session automatically creates a new database.

Boundary Responsibility
Tenant or registered workspace placement Region, capacity, authority epoch, and shared or dedicated Postgres service
Namespace and collection Project/content scope and sharing within the tenant
User and agent Grants, private content and permitted actions within those scopes

Use shared Postgres shards for ordinary tenants and a dedicated always-on service when measured load, residency or the isolation contract requires it. Dedicated placement means an independently sized service with the required HA configuration, not merely CREATE DATABASE inside the same resource pool. Personal accounts may have one user and one tenant; that does not make database-per-user the organization model. Keep users who collaborate on documents and memory within the same transactional placement unless an explicit isolation contract requires otherwise.

Route ordinary tenant transactions to one Postgres shard and colocate their transactional dependencies. Promote large tenants to dedicated services when measured load requires it. Managed Postgres offers vertical scaling and read replicas; horizontal write sharding remains a Loom placement decision (scaling). Keep APIs, authoritative transactions, retrieval and validation in the tenant's home region to avoid inter-region round trips in ordinary requests.

Tenant placement includes a durable authority epoch. A move or shard split copies a consistent state, catches up required deliveries, fences and drains the old writers, verifies the destination and switches the route under a bounded write pause. Stale routers and workers cannot write through the old epoch. Split a large tenant only along independent transaction and admission scopes; cross-scope invariants do not become safe merely because the rows moved to separate shards.

Dedicated Postgres does not replace application isolation. Continue to bind every query and job to the identity tuple, current grants and placement epoch. ClickHouse, object storage and caches keep their own scoped access and placement contracts; a Postgres endpoint does not automatically isolate the rest of the product.

Evaluate Xata for dedicated-service provisioning, migration/CI environments and tenant sandboxes. Xata describes copy-on-write branches with independent compute (branching). That is a candidate capability, not a decision to replace ClickHouse Managed Postgres or a reason to create an instance for every tenant. Keep the first implementation path above until a provider comparison establishes the required guarantees.

Production services with interactive latency SLOs stay warm. Permit hibernation only for profiles whose declared SLO includes wake-up and cache warming; test reconnection storms and whether replication/background connections prevent idling (scale-to-zero lifecycle). Copy-on-write reduces the cost of cloned unchanged blocks, not the compute and distinct data of thousands of independently active tenants.

Create new tenants from a clean schema/template. Never clone a shared multi-tenant production database into a new customer's security boundary. Data-bearing test branches stay within their tenant's authorized boundary, with anonymization or synthetic fixtures where required.

A Postgres branch is not a complete Loom fork. Register an environment/branch identity and pin a consistent baseline of database revisions, ClickHouse serving generations and artifact manifests. Use separate writable projection destinations, job claims and external-effect destinations. Cloned outbox rows, credentials or erasure jobs must not execute against production. An older copy of grants cannot restore revoked production access. Branch promotion uses the same fenced, reconciled cutover as any other authority change; do not assume automatic merging of business-state mutations.

Manage the fleet with bounded active-tenant connection pools, migration orchestration, credential rotation, per-source CDC progress, backups, failover and retirement. Budget source/replication connections, compute including HA, storage divergence and catch-up capacity at the expected number of concurrently active tenants. Database-per-tenant improves isolation and placement options; it does not remove a hot namespace's semantic coordination limit or establish better retrieval relevance.

Before changing the provider or placement default, qualify durability and failure-domain behavior, primary failover/fencing, PITR, regional availability, fleet limits, and the selected CDC path. A PostgreSQL-compatible endpoint does not prove access to the physical WAL and recovery state WalShadow requires. Report warm and wake-up latency, sustained mixed load, noisy-neighbor effects and full operating cost against the shared-shard baseline. Track all retained branches in erasure and backup recovery inventories.

Batching, capacity and retention

Use a bounded number of enrichment writers per ClickHouse destination shard and table, shared across API replicas. Batch by rows, bytes and a bounded deadline. Avoid stacking a long application timer on top of a long ClickHouse async-insert timer. Prioritize work that a caller is waiting to search.

Validate vector dimensions and partition counts before sending a block. Isolate bad rows, retry ambiguous inserts with stable identities, and apply backpressure when queues or merges fall behind. Leased job claims carry fencing generations so overlapping workers cannot advance progress for a newer claim. Use stable revision, chunk, model and destination identities for logical deduplication: ClickHouse insert-deduplication windows are finite and are not a permanent exactly-once guarantee. Verify retry behavior after the window, across rebatching and with dependent materialized views (insert retry limits).

Use separate concurrency limits, connection pools and scheduling shares for interactive admissions, searches, archival delivery, imports and rebuilds. Enforce per-tenant and global bounds on outstanding work and provider calls; reserve capacity for interactive work without starving repair and erasure. Count overload rejections and timeouts in service-level results. Bulk work must not exhaust interactive capacity, and overload must not silently select a weaker model or skip a quality check.

Separate ClickHouse retrieval compute from analytics and heavy index construction. Avoid one partition per namespace in shared tables. Keep historical revisions out of ordinary live retrieval. High-volume best-effort telemetry can be buffered directly into ClickHouse; it should not require a Postgres transaction for each metric.

The revision journal has bounded retention after required delivery, not a time-based permission to drop undelivered data. Confirm archive completeness and payload hashes before removing source payloads. Reconciliation detects missing revisions, not just duplicate rows. Retain enough delivery state to rebuild serving data from the journal or confirmed archive. If archival delivery stalls, apply backpressure before storage or WAL retention is exhausted rather than discard history.

The archive consumes immutable revision events with a key that includes source identity and revision; a current-row mirror cannot preserve every revision. Routine source cleanup is not erasure. Configure and test archival handling of source DELETE, partition retirement, TRUNCATE and DROP: WalShadow tees also receive destructive DDL, so mirroring a journal and truncating it can remove the archive. Keep archive lifetime independent of source cleanup, with explicit erasure through Loom's erasure workflow (destination behavior). Durable memory and retained history expire only under writer-authorized deletion or retention policy.

Size journal, WAL/archive retention, vector writes and ClickHouse merges from sustained rates, payload bytes, chunk fan-out, content-changing fraction, model rebuilds and outage recovery time. Include per-shard validation lookups, all retrieval legs, generation retries and reranker concurrency. Report normal and catch-up capacity with headroom; peak API throughput alone does not establish sustained capacity.

Failure, erasure and rollout

  • With ClickHouse unavailable, point reads and operations independent of semantic retrieval continue. Semantic admissions and strict search fail explicitly.
  • With Postgres unavailable, authoritative mutations and access decisions fail closed. Do not serve a stale ClickHouse copy as current content.
  • Worker restarts replay versioned jobs. Late enrichment cannot overwrite a newer revision. Readiness and job completion survive lost acknowledgements and overlapping claims.
  • Deletes and access changes take effect through Postgres authority. Erasure first fences the affected generation, then drains all in-flight publishers or rejects their writes at the destination before cleanup and the final residue check. Expiring a worker lease alone does not establish that quiescence. A check immediately before an unfenced insert cannot prevent a worker from writing after erasure completes. Apply the fence to imports, index builds, CDC recovery and restore as well as enrichment.
  • The erasure inventory includes Postgres content, revisions, jobs, idempotency payloads, ClickHouse vectors, graph and text projections, archives, replication recovery state and caches. Preserve deletion evidence across the backup recovery window. Restore in quarantine and apply erasures before serving or replaying jobs. State backup expiry or cryptographic-erasure rules and distinguish live-data completion from backup retention obligations.
  • Use synchronous Postgres HA across failure domains for acknowledged-write durability. For Managed Postgres, select two HA standbys; its documented one-standby configuration is asynchronous. Verify the actual commit and promotion policy, including fencing the old primary and choosing a standby that preserves acknowledged commits (HA options). Replica count alone is not a durability proof.
  • Test automatic source failover with the selected WalShadow build. Its planned switchover procedure does not cover abrupt primary loss. Define a bounded recovery or rebootstrap procedure for replication, while retaining all source revisions not confirmed in the archive; a fresh snapshot of current content cannot reconstruct revisions already removed from the source journal. Quarantine or remove abandoned-timeline output before trusting the recovered archive; a larger replication cursor is not proof of valid history. Production acceptance requires that procedure to meet the history durability and recovery objectives.
  • Restore both stores with compatible authority epochs and serving manifests. Reconcile source revisions, erasure state and delivery gaps before advertising readiness. Define separate recovery-point and recovery-time objectives for primary/AZ failure and regional disaster; do not present a regional backup policy as zero-loss synchronous HA.

Moving write authority breaks the existing rolling-upgrade assumption that all shared state is in ClickHouse. Seed Postgres from a consistent snapshot, reconcile changes, verify identities and versions, then switch authority under a controlled write pause. Shadow comparisons must not repeat external side effects. Any duplicate inference needs an explicit benchmark budget. Old and new authorities must not accept writes for the same scope. Deploy and verify fencing-capable APIs and workers before cutover while the old authority is still active. Drain or deny storage writes from any older binary that cannot enforce the fence; a new configuration row cannot stop a binary that never reads it. Enforce the authority epoch at admission and commit on every remaining writer. Once the new authority accepts writes, rollback requires a fenced, reconciled reverse cutover; changing a configuration flag is not a rollback. Update the architecture and rolling-upgrade rules with the implementation.

Implementation and acceptance

Spl 8000 it the work into:

  1. Postgres current-content storage, provenance, atomic audit, admission generations and revision/job/idempotency contracts.
  2. Direct search projection, bounded batching, idempotent recovery, reader-visible barriers and explicit API outcomes.
  3. WalShadow qualification, retained history, reconciliation, erasure and failover/restore procedures.
  4. Search quality validation, model-generation rollout, SDK behavior and fenced authority cutover.
  5. Tenant placement, fair scheduling, capacity qualification and any large-tenant index changes justified by measurements.

These are implementation workstreams, not permission to cut over before history, erasure and recovery pass. Keep the existing serving path until the required gates pass for the intended deployment profile.

Define a deployment profile and numeric acceptance thresholds before capacity qualification: tenant and eligible-set distributions, content sizes, write mix, chunk counts, model versions, candidate limits, concurrency, freshness contract, failure domain, hardware and replicas. Keep the existing operation budgets, including the 200 ms p99 target for memory.set, as targets to test; they are not results of this proposal. Establish separate end-to-end SLOs for current point reads, semantic admission, strict search, deferred visibility, failover and archival recovery. Report provider-inclusive latency and service-only time separately without excluding queueing, visibility waits, retries or errors from the relevant SLO.

Release gates:

Gate Required evidence
Isolation and correctness No observed cross-tenant or unauthorized disclosure, lost acknowledged mutation, mismatched revision score, skipped protection, duplicate logical side effect or erased-content resurrection in the correctness and fault suites. Any occurrence blocks release.
Retrieval and answer quality Paired evaluation against the existing retrieval path and exact eligible-set vector results, plus labeled relevance, citation accuracy, abstention and downstream agent outcomes. Set minimum filtered recall and non-inferiority margins per required query and tenant slice before testing; aggregate averages cannot hide a failing slice.
Semantic admission Concurrent same-key and cross-key writes, new peers, pin/blacklist changes, intra-batch conflicts and model failures produce the promised inline verdicts; record false accepts, false refusals and retry rates.
Sustained capacity and latency Mixed traffic at each advertised rate, including admission retrievals, all query legs, validation and model calls. p95/p99 and error rates meet the declared SLOs while queues, journal/WAL storage, dead tuples and parts remain bounded. Include hot scopes, large tenants and small tenants sharing capacity.
Degraded operation Imports, model/index rebuilds, provider throttling, lost replicas, source failover and archive outages preserve correctness and tenant scheduling. Report degraded capacity, recovery backlog and catch-up time.
History and recovery Every required revision and audit event is reconciled across initial load, cleanup, duplicate delivery, restart, source promotion and restore. Validate payload hashes, source epochs and deletion evidence before readiness.
Placement and branches Shared and dedicated profiles pass the same isolation, durability and semantic tests. Tenant moves, stale routes, forked jobs, branch erasure and provider failover cannot cross tenant/environment boundaries. Qualify fleet-scale provisioning, migration, warm latency and any advertised wake-up profile before changing defaults.

Run at a fixed offered load long enough to exercise checkpoints, autovacuum, merges, journal cleanup and archival delivery, then inject failures and measure catch-up. Report achieved throughput, rejection/timeout counts, CPU, memory, I/O, lock waits, generation retries, queue age, projection lag and parts/merge load. Use representative content and tenant filters as well as synthetic stress data; record queries, seeds, configuration and execution plans so comparisons can be repeated.

Test delivery on replicated ClickHouse tables and every supported serving engine. Cover ambiguous commit and insert responses, out-of-order completion, gaps in readiness, retry after deduplication expiry, replica rerouting, poison rows, expired leases, interrupted tenant moves, planned and abrupt source promotion, erasure racing a publisher, model-generation cutover and recovery from backup. No enterprise capacity, latency or durability claim is accepted from an untested configuration.

Describe alternatives you've considered

  • Postgres heads with content in ClickHouse. This keeps ClickHouse insertion on the write path and adds a second database lookup to each point read. Storing current content in Postgres removes both dependencies for point operations.
  • Waiting for CDC before enrichment starts. This adds replication lag before embedding and search publication. Enrichment can read the committed revision directly.
  • A custom general replication pipeline. WalShadow supplies the native replication path. Loom needs domain-specific enrichment and readiness, not another WAL transport.
  • ClickPipes. Reconsider it if a documented or reproduced WalShadow limitation blocks a required guarantee. Qualify WalShadow first and do not build both replication paths in parallel.
  • Vectors in Postgres or another search database. Out of scope. Vector storage and execution remain in ClickHouse.
  • One owner API replica per namespace. This ties availability to process placement. API replicas remain interchangeable; durable coordination belongs in Postgres.

Where the need comes from

The need is mine, an AI tool helped shape the proposal

Additional context

This is an architecture proposal. The review checks the contracts against the linked replication, HA and retrieval evidence; it does not establish measured capacity or production readiness. No new load or recall measurements were run for this revision. The sizing inputs remain assumptions. Implementation and release require the quality, isolation, durability, latency, capacity and recovery gates above.

Activity

  1. added
    enhancement
    on Oct 22, 2026
  2. changed the title [-]Optional Postgres store for leases, locks and rate limits, with ClickHouse-only as the default[/-] [+]Optional Postgres head store to decide memory writes at high write rates[/+] on Oct 22, 2026
  3. changed the title [-]Optional Postgres head store to decide memory writes at high write rates[/-] [+]Place each workload by shape for high write rates, with an optional Postgres for point and queue state[/+] on Oct 22, 2026
  4. changed the title [-]Place each workload by shape for high write rates, with an optional Postgres for point and queue state[/-] [+]Scale memory writes: batch ClickHouse inserts, then choose a coordination store[/+] on Oct 22, 2026
  5. changed the title [-]Scale memory writes: batch ClickHouse inserts, then choose a coordination store[/-] [+]Scale memory writes: batched ClickHouse inserts and an optional Postgres head store[/+] on Oct 22, 2026
  6. changed the title [-]Scale memory writes: batched ClickHouse inserts and an optional Postgres head store[/-] [+]Move live memory to Postgres and keep vector search in ClickHouse[/+] on Oct 29, 2026
  7. 2 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancement

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      0