TiDB is a production-grade, open-source distributed SQL database with MySQL compatibility, horizontal scalability, strong consistency (ACID), and HTAP capabilities via TiKV (row store) and TiFlash (columnar store). The architecture separates compute (TiDB Server) from storage (TiKV/TiFlash) with PD for cluster management. Key entry points: cmd/tidb-server (SQL layer), lightning/cmd/tidb-lightning (TB-scale import), br/cmd/br (backup/restore), dumpling/cmd/dumpling (export). The codebase demonstrates exceptional craftsmanship with a modular design: the parser (pkg/parser) is a standalone MySQL-compatible SQL parser used by external projects; pkg/objstore provides a unified storage abstraction (S3/GCS/Azure/local/HDFS) with compression/encryption; pkg/dxf/framework implements a distributed execution framework with scheduler/task-executor/planner; pkg/timer provides distributed cron/interval scheduling with persistence; pkg/extension enables plugin-based authentication/session-hooks/custom-functions; pkg/util/chunk/arena/zeropool/mvmap/intset/bitmap provide high-performance columnar processing and memory management; pkg/expression uses code generation for vectorized SIMD evaluation; pkg/planner implements a Cascades-based cost-based optimizer with plan caching; pkg/ddl executes online schema changes via job-based distributed backfill with schema versioning; pkg/statistics maintains histograms/CMS/FM-sketch with auto-analyze priority queues. The repo includes comprehensive testing (unit, integration, realtikv, chaos) and modern Go practices (generics, interfaces, DI).
ClickHouse is a high-performance, column-oriented OLAP database management system written primarily in C++. It is designed for real-time analytics on large datasets, supporting SQL queries, distributed execution, and various storage engines (MergeTree, ObjectStorage, etc.). The architecture is monolithic but modular, with distinct layers for parsing (Parsers), planning (Analyzer/Planner), execution (Processors), and storage (Storages). Key entry points include the server binary (`clickhouse-server`) and client tools (`clickhouse-client`). It relies heavily on C++ templates, RAII, and a plugin-like registration system for functions and storage engines. It supports distributed queries via ZooKeeper/Keeper and integrates with various cloud storage providers (S3, Azure, GCS).
ParadeDB is a PostgreSQL extension that provides full-text search, vector search, and analytics directly within the database, eliminating the need for a separate search service. The core engine is `pg_search`, which implements a custom index access method (`paradedb`/`bm25`) using Tantivy for search indexing and DataFusion for analytic aggregations. It supports BM25 scoring, phrase/term/boolean queries, fuzzy matching, proximity search, hybrid search (combining full-text and vector), and a rich set of tokenizers (including jieba, ICU, Lindera, ngram). The extension integrates deeply with PostgreSQL's planner through custom scan nodes (BaseScan, AggregateScan, JoinScan, MPP) to push down search, aggregation, and join operations into the index. It also offers columnar storage via fast fields, parallel query execution, and WAL-level integration for crash safety. Architecturally, the system is a Rust library compiled as a shared library loaded by PostgreSQL, using the `pgrx` framework for FFI. Entry points include SQL functions for search (e.g., `paradedb.query`, `pdb.score`), DDL for index creation, and custom plan/exec hooks. Data flows: user SQL queries are intercepted by the planner, which decides whether to use a custom scan path; if so, Tantivy or DataFusion executes the search/aggregation/join, producing tuples that are optionally post-processed by PostgreSQL (e.g., heap fetches, visibility checks). The extension relies on external dependencies: Tantivy (forked for block storage), DataFusion (for aggregate execution), ICU (for Unicode tokenization), Lindera (for Japanese tokenization), and Apache Arrow (for columnar data exchange).