{"id":51065433,"url":"https://github.com/frectonz/pg-sqlite-heap","last_synced_at":"2026-06-23T06:02:04.502Z","repository":{"id":357922812,"uuid":"1238947547","full_name":"frectonz/pg-sqlite-heap","owner":"frectonz","description":"Store Postgres tables in SQLite files.","archived":false,"fork":false,"pushed_at":"2026-05-14T21:08:57.000Z","size":188,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-05-14T22:23:05.677Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://frectonz.github.io/pg-sqlite-heap/","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/frectonz.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2026-05-14T15:56:18.000Z","updated_at":"2026-05-14T21:09:01.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/frectonz/pg-sqlite-heap","commit_stats":null,"previous_names":["frectonz/pg-sqlite-heap"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/frectonz/pg-sqlite-heap","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Fpg-sqlite-heap","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Fpg-sqlite-heap/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Fpg-sqlite-heap/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Fpg-sqlite-heap/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/frectonz","download_url":"https://codeload.github.com/frectonz/pg-sqlite-heap/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/frectonz%2Fpg-sqlite-heap/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34677403,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-23T02:00:07.161Z","response_time":65,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2026-06-23T06:02:03.077Z","updated_at":"2026-06-23T06:02:04.497Z","avatar_url":"https://github.com/frectonz.png","language":"Rust","funding_links":[],"categories":[],"sub_categories":[],"readme":"# sqlite_heap\n\nA Postgres extension that stores table data in **SQLite files** instead of\nPostgres's built-in heap — while the table still behaves like any other\nPostgres table: transactions, MVCC, indexes, joins, `VACUUM`, `ANALYZE`, and\nthe planner all work.\n\nIt's a [Table Access Method](https://www.postgresql.org/docs/current/tableam.html)\nwritten in Rust with [pgrx](https://github.com/pgcentralfoundation/pgrx). Each\ntable gets its own file at `$PGDATA/sqlite_heap/\u003cdb-oid\u003e/\u003ctable-oid\u003e.sqlite`.\n\nSupports Postgres **17** and **18**.\n\n## Documentation\n\n- [Engineering Reference](https://frectonz.github.io/pg-sqlite-heap/EXPLAINER.html) — architecture and internals\n- [SQL Surface Reference](https://frectonz.github.io/pg-sqlite-heap/FUNCTIONS.html) — functions and SQL API\n\n## Usage\n\n```sql\nCREATE EXTENSION pg_sqlite_heap;\n\nCREATE TABLE t (id int primary key, label text) USING sqlite_heap;\nINSERT INTO t VALUES (1, 'a'), (2, 'b');\nSELECT * FROM t;          -- ordinary Postgres table from here on\n```\n\n## Inspecting the files\n\nThe extension exposes SQL functions for poking at what's on disk. Pass a table\nname with `::regclass`:\n\n| Function | Returns |\n|---|---|\n| `sqlite_heap_file_path(regclass)` | path of the table's SQLite file |\n| `sqlite_heap_file_size(regclass)` | its size in bytes |\n| `sqlite_heap_schema_version(regclass)` | the SQLite `PRAGMA user_version` |\n| `sqlite_heap_storage(regclass)` | raw row dump, including the MVCC header columns Postgres hides |\n| `sqlite_heap_files()` | every sqlite_heap file in the current database |\n| `sqlite_heap_physical_rows(regclass)` | row count including dead versions |\n| `sqlite_heap_live_rows(regclass)` | live (`xmax = 0`) row count |\n\n```sql\nSELECT * FROM sqlite_heap_storage('t'::regclass);\n```\n\n## Tests\n\n```sh\ncargo pgrx test                  # 51 in-process tests\n./tests/concurrency.sh           # multi-backend stress test (needs a running cluster)\n```\n\n## Project layout\n\n| File | What |\n|---|---|\n| `src/tam.rs` | the `TableAmRoutine` callbacks |\n| `src/sqlite.rs` | per-table SQLite backend, lazy transactions, schema migration, durability |\n| `src/visibility.rs` | snapshot visibility rules over the stored xmin/xmax |\n| `src/ffi.rs` | HeapTuple / slot / TID marshalling |\n| `src/lib.rs` | the handler, drop trigger, and inspection functions |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrectonz%2Fpg-sqlite-heap","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffrectonz%2Fpg-sqlite-heap","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffrectonz%2Fpg-sqlite-heap/lists"}