{"id":13411957,"url":"https://github.com/akrylysov/pogreb","last_synced_at":"2025-05-13T21:04:27.680Z","repository":{"id":44470704,"uuid":"116522453","full_name":"akrylysov/pogreb","owner":"akrylysov","description":"Embedded key-value store for read-heavy workloads written in Go","archived":false,"fork":false,"pushed_at":"2025-01-16T01:59:45.000Z","size":131,"stargazers_count":1332,"open_issues_count":16,"forks_count":94,"subscribers_count":33,"default_branch":"main","last_synced_at":"2025-04-28T12:06:35.522Z","etag":null,"topics":["go","hash-table","key-value","key-value-store"],"latest_commit_sha":null,"homepage":"","language":"Go","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/akrylysov.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"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}},"created_at":"2018-01-06T23:16:36.000Z","updated_at":"2025-04-17T01:55:39.000Z","dependencies_parsed_at":"2023-12-01T01:31:34.037Z","dependency_job_id":"fff03c59-15ae-4df6-a9b7-f60da0c2f62b","html_url":"https://github.com/akrylysov/pogreb","commit_stats":{"total_commits":68,"total_committers":10,"mean_commits":6.8,"dds":"0.16176470588235292","last_synced_commit":"794a326c8aff6768b2485338e6db8e80c30f9dc9"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akrylysov%2Fpogreb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akrylysov%2Fpogreb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akrylysov%2Fpogreb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akrylysov%2Fpogreb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akrylysov","download_url":"https://codeload.github.com/akrylysov/pogreb/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251311330,"owners_count":21569009,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["go","hash-table","key-value","key-value-store"],"created_at":"2024-07-30T20:01:19.205Z","updated_at":"2025-04-28T12:06:40.772Z","avatar_url":"https://github.com/akrylysov.png","language":"Go","readme":"\u003cp align=\"center\"\u003e\u003cimg src=\"https://akrylysov.github.io/pogreb/logo.svg\" width=\"300\"\u003e\u003c/p\u003e\n\n# Pogreb\n[![Docs](https://godoc.org/github.com/akrylysov/pogreb?status.svg)](https://pkg.go.dev/github.com/akrylysov/pogreb)\n[![Build Status](https://github.com/akrylysov/pogreb/actions/workflows/test.yaml/badge.svg?branch=master)](https://github.com/akrylysov/pogreb/actions)\n[![Go Report Card](https://goreportcard.com/badge/github.com/akrylysov/pogreb)](https://goreportcard.com/report/github.com/akrylysov/pogreb)\n[![Codecov](https://codecov.io/gh/akrylysov/pogreb/branch/master/graph/badge.svg)](https://codecov.io/gh/akrylysov/pogreb)\n\nPogreb is an embedded key-value store for read-heavy workloads written in Go.\n\n## Key characteristics\n\n- 100% Go.\n- Optimized for fast random lookups and infrequent bulk inserts.\n- Can store larger-than-memory data sets.\n- Low memory usage.\n- All DB methods are safe for concurrent use by multiple goroutines.\n\n## Installation\n\n```sh\n$ go get -u github.com/akrylysov/pogreb\n```\n\n## Usage\n\n### Opening a database\n\nTo open or create a new database, use the `pogreb.Open()` function:\n\n```go\npackage main\n\nimport (\n\t\"log\"\n\n\t\"github.com/akrylysov/pogreb\"\n)\n\nfunc main() {\n    db, err := pogreb.Open(\"pogreb.test\", nil)\n    if err != nil {\n        log.Fatal(err)\n        return\n    }\t\n    defer db.Close()\n}\n```\n\n### Writing to a database\n\nUse the `DB.Put()` function to insert a new key-value pair:\n\n```go\nerr := db.Put([]byte(\"testKey\"), []byte(\"testValue\"))\nif err != nil {\n\tlog.Fatal(err)\n}\n```\n\n### Reading from a database\n\nTo retrieve the inserted value, use the `DB.Get()` function:\n\n```go\nval, err := db.Get([]byte(\"testKey\"))\nif err != nil {\n\tlog.Fatal(err)\n}\nlog.Printf(\"%s\", val)\n```\n\n### Deleting from a database\n\nUse the `DB.Delete()` function to delete a key-value pair:\n\n```go\nerr := db.Delete([]byte(\"testKey\"))\nif err != nil {\n\tlog.Fatal(err)\n}\n```\n\n### Iterating over items\n\nTo iterate over items, use `ItemIterator` returned by `DB.Items()`:\n\n```go\nit := db.Items()\nfor {\n    key, val, err := it.Next()\n    if err == pogreb.ErrIterationDone {\n    \tbreak\n    }\n    if err != nil { \n        log.Fatal(err)\n    }\n    log.Printf(\"%s %s\", key, val)\n}\n```\n\n## Performance\n\nThe benchmarking code can be found in the [pogreb-bench](https://github.com/akrylysov/pogreb-bench) repository.\n\nResults of read performance benchmark of pogreb, goleveldb, bolt and badgerdb\non DigitalOcean 8 CPUs / 16 GB RAM / 160 GB SSD + Ubuntu 16.04.3 (higher is better):\n\n\u003cp align=\"center\"\u003e\u003cimg src=\"https://akrylysov.github.io/pogreb/read-bench.png\" width=\"609\"\u003e\u003c/p\u003e\n\n## Internals\n\n[Design document](/docs/design.md).\n\n## Limitations\n\nThe design choices made to optimize for point lookups bring limitations for other potential use-cases. For example, using a hash table for indexing makes range scans impossible. Additionally, having a single hash table shared across all WAL segments makes the recovery process require rebuilding the entire index, which may be impractical for large databases.","funding_links":[],"categories":["Uncategorized","Repositories","Database","About The Project","Go","Generators","Key-Value Store","数据库","数据库  `go语言实现的数据库`","Data Integration Frameworks"],"sub_categories":["Databases Implemented in Go","Built With","Go中实现的数据库","Advanced Console UIs","标准 CLI"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakrylysov%2Fpogreb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakrylysov%2Fpogreb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakrylysov%2Fpogreb/lists"}