{"id":35826026,"url":"https://github.com/stoolap/stoolap","last_synced_at":"2026-02-15T11:01:01.229Z","repository":{"id":331995743,"uuid":"1114743664","full_name":"stoolap/stoolap","owner":"stoolap","description":"A Modern Embedded SQL Database written in Rust","archived":false,"fork":false,"pushed_at":"2026-02-12T08:23:29.000Z","size":5610,"stargazers_count":542,"open_issues_count":2,"forks_count":18,"subscribers_count":5,"default_branch":"main","last_synced_at":"2026-02-12T17:41:39.714Z","etag":null,"topics":["database","embedded-sql","mvcc","rust","sql"],"latest_commit_sha":null,"homepage":"https://stoolap.io","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stoolap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-12-11T20:26:42.000Z","updated_at":"2026-02-12T11:26:28.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/stoolap/stoolap","commit_stats":null,"previous_names":["stoolap/stoolap"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/stoolap/stoolap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoolap%2Fstoolap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoolap%2Fstoolap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoolap%2Fstoolap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoolap%2Fstoolap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stoolap","download_url":"https://codeload.github.com/stoolap/stoolap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stoolap%2Fstoolap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29476294,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-15T10:25:47.032Z","status":"ssl_error","status_checked_at":"2026-02-15T10:25:01.815Z","response_time":118,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["database","embedded-sql","mvcc","rust","sql"],"created_at":"2026-01-07T20:15:16.714Z","updated_at":"2026-02-15T11:01:01.214Z","avatar_url":"https://github.com/stoolap.png","language":"Rust","readme":"\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"logo.svg\" alt=\"Stoolap Logo\" width=\"360\"\u003e\n\n  \u003ch3\u003eA Modern Embedded SQL Database in Pure Rust\u003c/h3\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://stoolap.io\"\u003eWebsite\u003c/a\u003e •\n    \u003ca href=\"https://stoolap.io/docs\"\u003eDocumentation\u003c/a\u003e •\n    \u003ca href=\"https://github.com/stoolap/stoolap/releases\"\u003eReleases\u003c/a\u003e •\n    \u003ca href=\"BENCHMARKS.md\"\u003eBenchmarks\u003c/a\u003e\n  \u003c/p\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://github.com/stoolap/stoolap/actions/workflows/ci.yml\"\u003e\u003cimg src=\"https://github.com/stoolap/stoolap/actions/workflows/ci.yml/badge.svg\" alt=\"CI\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://codecov.io/gh/stoolap/stoolap\"\u003e\u003cimg src=\"https://codecov.io/gh/stoolap/stoolap/branch/main/graph/badge.svg\" alt=\"codecov\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/stoolap\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/stoolap.svg\" alt=\"Crates.io\"\u003e\u003c/a\u003e\n    \u003ca href=\"https://github.com/stoolap/stoolap/releases\"\u003e\u003cimg src=\"https://img.shields.io/github/v/release/stoolap/stoolap\" alt=\"GitHub release\"\u003e\u003c/a\u003e\n    \u003ca href=\"LICENSE\"\u003e\u003cimg src=\"https://img.shields.io/badge/license-Apache%202.0-blue.svg\" alt=\"License\"\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n---\n\n## Why Stoolap?\n\nStoolap is a **feature-rich embedded SQL database** with capabilities that rival established databases like PostgreSQL and DuckDB - all in a single dependency with zero external requirements.\n\n### Performance\n\nStoolap is optimized for OLTP workloads: point queries, transactional updates, and real-time analytics. It uses parallel execution via Rayon for large scans and a cost-based optimizer for query planning.\n\nSee [BENCHMARKS.md](BENCHMARKS.md) for detailed comparisons against SQLite and DuckDB.\n\n### Unique Features\n\n| Feature | Stoolap | SQLite | DuckDB | PostgreSQL |\n|---------|:-------:|:------:|:------:|:----------:|\n| **AS OF Time-Travel Queries** | ✅ | ❌ | ❌ | ❌* |\n| **MVCC Transactions** | ✅ | ❌ | ✅ | ✅ |\n| **Cost-Based Optimizer** | ✅ | ❌ | ✅ | ✅ |\n| **Adaptive Query Execution** | ✅ | ❌ | ❌ | ❌ |\n| **Semantic Query Caching** | ✅ | ❌ | ❌ | ❌ |\n| **Parallel Query Execution** | ✅ | ❌ | ✅ | ✅ |\n| **Pure Rust (Memory Safe)** | ✅ | ❌ | ❌ | ❌ |\n| **No C/C++ Required** | ✅ | ❌ | ❌ | ❌ |\n\n*PostgreSQL requires extensions for temporal queries\n\n---\n\n## Quick Start\n\n### Installation\n\nAdd to your `Cargo.toml`:\n\n```toml\n[dependencies]\nstoolap = \"0.3\"\n```\n\nOr build from source:\n\n```bash\ngit clone https://github.com/stoolap/stoolap.git\ncd stoolap\ncargo build --release\n```\n\n### Library Usage\n\n```rust\nuse stoolap::api::Database;\n\nfn main() -\u003e Result\u003c(), Box\u003cdyn std::error::Error\u003e\u003e {\n    // In-memory database\n    let db = Database::open_in_memory()?;\n\n    // Or persistent storage\n    // let db = Database::open(\"file:///path/to/data\")?;\n\n    // Create table\n    db.execute(\"CREATE TABLE users (\n        id INTEGER PRIMARY KEY,\n        name TEXT NOT NULL,\n        email TEXT UNIQUE,\n        created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n    )\", ())?;\n\n    // Insert with parameters\n    db.execute(\"INSERT INTO users (id, name, email) VALUES (?, ?, ?)\",\n        (1, \"Alice\", \"alice@example.com\"))?;\n\n    // Query with iteration\n    for row in db.query(\"SELECT * FROM users WHERE id = ?\", (1,))? {\n        let row = row?;\n        println!(\"User: {} \u003c{}\u003e\",\n            row.get::\u003cString\u003e(1)?,  // name\n            row.get::\u003cString\u003e(2)?   // email\n        );\n    }\n\n    Ok(())\n}\n```\n\n### Command Line Interface\n\n```bash\n# Interactive REPL (in-memory)\n./stoolap\n\n# Persistent database\n./stoolap --db \"file:///var/lib/stoolap/data\"\n\n# Execute query directly\n./stoolap -q \"SELECT version()\"\n\n# Execute SQL file\n./stoolap --db \"file://./mydb\" \u003c schema.sql\n```\n\n---\n\n## Features\n\n### MVCC Transactions\n\nFull multi-version concurrency control with isolation levels:\n\n```sql\n-- Read Committed (default)\nBEGIN;\nUPDATE accounts SET balance = balance - 100 WHERE id = 1;\nUPDATE accounts SET balance = balance + 100 WHERE id = 2;\nCOMMIT;\n\n-- Snapshot Isolation (repeatable reads)\nBEGIN TRANSACTION ISOLATION LEVEL SNAPSHOT;\nSELECT * FROM accounts;  -- Consistent view throughout transaction\nCOMMIT;\n```\n\n### Time-Travel Queries\n\nQuery historical data at any point in time - a feature typically only found in enterprise databases:\n\n```sql\n-- Query data as it existed at a specific timestamp\nSELECT * FROM orders AS OF TIMESTAMP '2024-01-15 10:30:00';\n\n-- Query data as of a specific transaction\nSELECT * FROM inventory AS OF TRANSACTION 1234;\n\n-- Compare current vs historical data\nSELECT\n    c.price AS current_price,\n    h.price AS old_price,\n    c.price - h.price AS change\nFROM products c\nJOIN products AS OF TIMESTAMP '2024-01-01 00:00:00' h ON c.id = h.id\nWHERE c.price != h.price;\n```\n\n### Smart Indexes\n\nAutomatic index type selection based on data characteristics:\n\n```sql\n-- B-tree (auto-selected for INTEGER, FLOAT, TIMESTAMP)\n-- Best for: range queries, sorting, prefix matching\nCREATE INDEX idx_date ON orders(created_at);\nSELECT * FROM orders WHERE created_at BETWEEN '2024-01-01' AND '2024-12-31';\n\n-- Hash (auto-selected for TEXT, JSON)\n-- Best for: O(1) equality lookups\nCREATE INDEX idx_email ON users(email);\nSELECT * FROM users WHERE email = 'alice@example.com';\n\n-- Bitmap (auto-selected for BOOLEAN)\n-- Best for: low-cardinality columns, efficient AND/OR\nCREATE INDEX idx_status ON orders(status) USING BITMAP;\n\n-- Multi-column composite indexes\nCREATE INDEX idx_lookup ON events(user_id, event_type);\nCREATE UNIQUE INDEX idx_unique ON orders(customer_id, order_date);\n```\n\n### Window Functions\n\nFull analytical query support:\n\n```sql\nSELECT\n    employee_name,\n    department,\n    salary,\n    ROW_NUMBER() OVER (PARTITION BY department ORDER BY salary DESC) AS dept_rank,\n    LAG(salary) OVER (ORDER BY hire_date) AS prev_salary,\n    AVG(salary) OVER (PARTITION BY department) AS dept_avg,\n    SUM(salary) OVER (ORDER BY hire_date\n        ROWS BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS running_total\nFROM employees;\n```\n\n### Common Table Expressions (CTEs)\n\nIncluding recursive queries for hierarchical data:\n\n```sql\n-- Recursive CTE: organizational hierarchy\nWITH RECURSIVE org_chart AS (\n    -- Base case: top-level managers\n    SELECT id, name, manager_id, 1 AS level\n    FROM employees\n    WHERE manager_id IS NULL\n\n    UNION ALL\n\n    -- Recursive case: employees under managers\n    SELECT e.id, e.name, e.manager_id, oc.level + 1\n    FROM employees e\n    JOIN org_chart oc ON e.manager_id = oc.id\n)\nSELECT * FROM org_chart ORDER BY level, name;\n```\n\n### Advanced Aggregations\n\n```sql\n-- ROLLUP: hierarchical subtotals\nSELECT region, product, SUM(sales)\nFROM sales GROUP BY ROLLUP(region, product);\n\n-- CUBE: all dimension combinations\nSELECT region, product, SUM(sales)\nFROM sales GROUP BY CUBE(region, product);\n\n-- GROUPING SETS: custom combinations\nSELECT region, product, SUM(sales)\nFROM sales GROUP BY GROUPING SETS ((region, product), (region), ());\n```\n\n### Subqueries\n\nScalar, correlated, EXISTS, IN, ANY/ALL:\n\n```sql\n-- Correlated subquery\nSELECT * FROM employees e\nWHERE salary \u003e (\n    SELECT AVG(salary) FROM employees\n    WHERE department = e.department\n);\n\n-- EXISTS with correlation\nSELECT * FROM customers c\nWHERE EXISTS (\n    SELECT 1 FROM orders o\n    WHERE o.customer_id = c.id AND o.amount \u003e 1000\n);\n```\n\n### Query Optimizer\n\nPostgreSQL-style cost-based optimizer with runtime adaptation:\n\n```sql\n-- Collect statistics for better query plans\nANALYZE orders;\nANALYZE customers;\n\n-- View query plan with cost estimates\nEXPLAIN SELECT * FROM orders WHERE customer_id = 100;\n\n-- View plan with actual execution statistics\nEXPLAIN ANALYZE\nSELECT o.*, c.name\nFROM orders o\nJOIN customers c ON o.customer_id = c.id\nWHERE c.country = 'US';\n```\n\n---\n\n## Data Types\n\n| Type | Description | Example |\n|------|-------------|---------|\n| `INTEGER` | 64-bit signed integer | `42`, `-100` |\n| `FLOAT` | 64-bit floating point | `3.14`, `-0.001` |\n| `TEXT` | UTF-8 string | `'hello'`, `'日本語'` |\n| `BOOLEAN` | true/false | `TRUE`, `FALSE` |\n| `TIMESTAMP` | Date and time | `'2024-01-15 10:30:00'` |\n| `JSON` | JSON data | `'{\"key\": \"value\"}'` |\n\n---\n\n## Built-in Functions (110)\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eString Functions\u003c/b\u003e\u003c/summary\u003e\n\n`UPPER`, `LOWER`, `LENGTH`, `CHAR_LENGTH`, `CHAR`, `TRIM`, `LTRIM`, `RTRIM`, `CONCAT`, `CONCAT_WS`, `SUBSTRING`, `SUBSTR`, `REPLACE`, `REVERSE`, `LEFT`, `RIGHT`, `LPAD`, `RPAD`, `REPEAT`, `POSITION`, `STRPOS`, `LOCATE`, `INSTR`, `SPLIT_PART`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eMath Functions\u003c/b\u003e\u003c/summary\u003e\n\n`ABS`, `CEIL`, `CEILING`, `FLOOR`, `ROUND`, `TRUNCATE`, `TRUNC`, `SQRT`, `POWER`, `POW`, `MOD`, `SIGN`, `GREATEST`, `LEAST`, `EXP`, `LN`, `LOG`, `LOG10`, `LOG2`, `SIN`, `COS`, `TAN`, `PI`, `RANDOM`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eDate/Time Functions\u003c/b\u003e\u003c/summary\u003e\n\n`NOW`, `CURRENT_DATE`, `CURRENT_TIMESTAMP`, `EXTRACT`, `DATE_TRUNC`, `TIME_TRUNC`, `DATE_ADD`, `DATE_SUB`, `DATEDIFF`, `DATE_DIFF`, `YEAR`, `MONTH`, `DAY`, `HOUR`, `MINUTE`, `SECOND`, `TO_CHAR`, `VERSION`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eJSON Functions\u003c/b\u003e\u003c/summary\u003e\n\n`JSON_EXTRACT`, `JSON_TYPE`, `JSON_TYPEOF`, `JSON_VALID`, `JSON_KEYS`, `JSON_ARRAY`, `JSON_ARRAY_LENGTH`, `JSON_OBJECT`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eAggregate Functions\u003c/b\u003e\u003c/summary\u003e\n\n`COUNT`, `SUM`, `AVG`, `MIN`, `MAX`, `MEDIAN`, `STDDEV`, `STDDEV_POP`, `STDDEV_SAMP`, `VARIANCE`, `VAR_POP`, `VAR_SAMP`, `STRING_AGG`, `GROUP_CONCAT`, `ARRAY_AGG`, `FIRST`, `LAST`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eWindow Functions\u003c/b\u003e\u003c/summary\u003e\n\n`ROW_NUMBER`, `RANK`, `DENSE_RANK`, `NTILE`, `LAG`, `LEAD`, `FIRST_VALUE`, `LAST_VALUE`, `NTH_VALUE`, `PERCENT_RANK`, `CUME_DIST`\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cb\u003eUtility Functions\u003c/b\u003e\u003c/summary\u003e\n\n`COALESCE`, `NULLIF`, `IFNULL`, `CAST`, `IIF`, `TYPEOF`, `COLLATE`, `SLEEP`\n\u003c/details\u003e\n\n---\n\n## Storage \u0026 Persistence\n\n```bash\n# In-memory (fastest, data lost on exit)\n./stoolap --db \"memory://\"\n\n# File-based (durable storage with WAL)\n./stoolap --db \"file:///var/lib/stoolap/data\"\n```\n\n**Durability features:**\n- **Write-Ahead Logging (WAL)**: All changes logged before applied\n- **Periodic Snapshots**: Fast recovery from crashes\n- **Index Persistence**: All indexes saved and restored automatically\n\n---\n\n## Architecture\n\n```\nsrc/\n├── api/           # Public API (Database, Connection, Rows)\n├── core/          # Core types (Value, Row, Schema, Error)\n├── parser/        # SQL lexer and parser\n├── optimizer/     # Cost-based query optimizer\n│   ├── cost.rs        # Cost model with I/O and CPU costs\n│   ├── join.rs        # Join optimization (dynamic programming)\n│   ├── bloom.rs       # Bloom filter propagation\n│   └── aqe.rs         # Adaptive query execution\n├── executor/      # Query execution engine\n│   ├── operators/     # Volcano-style operators\n│   ├── parallel.rs    # Parallel execution (Rayon)\n│   └── expression/    # Expression VM\n├── functions/     # 110 built-in functions\n│   ├── scalar/        # String, math, date, JSON\n│   ├── aggregate/     # COUNT, SUM, AVG, etc.\n│   └── window/        # ROW_NUMBER, RANK, LAG, etc.\n└── storage/       # Storage engine\n    ├── mvcc/          # Multi-version concurrency control\n    └── index/         # B-tree, Hash, Bitmap indexes\n```\n\n---\n\n## Development\n\n### Building\n\n```bash\ncargo build              # Debug build\ncargo build --release    # Optimized release build\n```\n\n### Testing\n\n```bash\ncargo nextest run        # Run all tests (recommended)\ncargo test               # Standard test runner\n```\n\n### Code Quality\n\n```bash\ncargo clippy --all-targets --all-features -- -D warnings\ncargo fmt --check\n```\n\n### Documentation\n\n```bash\ncargo doc --open         # Generate and open API docs\n```\n\n---\n\n## Contributing\n\nWe welcome contributions! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.\n\n---\n\n## License\n\nApache License 2.0. See [LICENSE](LICENSE) for details.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoolap%2Fstoolap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstoolap%2Fstoolap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstoolap%2Fstoolap/lists"}