{"id":24879305,"url":"https://github.com/dhcode/mongodb-timeseries-test","last_synced_at":"2025-03-27T05:14:31.440Z","repository":{"id":40947834,"uuid":"189548825","full_name":"dhcode/mongodb-timeseries-test","owner":"dhcode","description":"Testing different timeseries variants with MongoDB","archived":false,"fork":false,"pushed_at":"2023-01-05T02:25:31.000Z","size":853,"stargazers_count":0,"open_issues_count":15,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-01T10:15:53.681Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dhcode.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-05-31T07:29:38.000Z","updated_at":"2019-10-31T19:54:25.000Z","dependencies_parsed_at":"2023-02-03T06:02:12.449Z","dependency_job_id":null,"html_url":"https://github.com/dhcode/mongodb-timeseries-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhcode%2Fmongodb-timeseries-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhcode%2Fmongodb-timeseries-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhcode%2Fmongodb-timeseries-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dhcode%2Fmongodb-timeseries-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dhcode","download_url":"https://codeload.github.com/dhcode/mongodb-timeseries-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245785823,"owners_count":20671634,"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":[],"created_at":"2025-02-01T10:16:05.395Z","updated_at":"2025-03-27T05:14:31.417Z","avatar_url":"https://github.com/dhcode.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MongoDB Time series test\n\nA project to find the most efficient way to store time series data in MongoDB.\n\n## Run\n\nRun the database (mongod must be available in your PATH):\n\n    npm run mongodb\n\nTo let the test scenarios run:\n\n    npm run test1\n    \n## Buckets\n\n### Time series bucket simple\n\nEach document has a timestamp as _id that is floored to e.g. the base of an hour. Is has a static size.\nE.g. hourly bucket in second precision means 86400 entries per document per property.\n\n    {\n        _id: '2018-01-01T19:00:00Z',\n        prop1: [\n            0,\n            0,\n            ...\n            0\n        ]\n    }\n\n### Time series bucket variant\n\nSame as the time series bucket simple. But it has additional sum properties. This makes aggregation queries much more efficient.\n\n    {\n        _id: '2018-01-01T19:00:00Z',\n        _s: {\n            prop1: 0\n        },\n        prop1: [\n            0,\n            0,\n            ...\n            0\n        ]\n    }\n\n## Results\n\n### Hour bucket with seconds precision\n\n* 1 Year of data (simple bucket, 1 property)\n  * size: 291.7MB \n  * storage: 158.2MB \n  * index: 144.0KB\n  * Query times:\n    * 24h sec received: 86400 dur: 392\n    * 24h sec2 [2] received: 86400 dur: 205\n    * 48h min received: 2880 dur: 215\n    * 48h sec2 [2] received: 2880 dur: 92\n    * 30d hour received: 720 dur: 2900\n    * 30d hour [2] received: 720 dur: 1201\n\n\n* 1 Year of data (variant bucket, 1 property)\n  * size: 291.8MB \n  * storage: 152.9MB \n  * index: 136.0KB\n  * Query times:\n    * 24h sec received: 86400 dur: 323\n    * 48h min received: 2880 dur: 231\n    * 30d hour received: 720 dur: 6\n\n### Minute bucket with seconds precision\n\n* 1 Year of data (simple bucket, 1 property)\n  * size: 248.6MB \n  * storage: 44.4MB \n  * index: 5.9MB\n  * Query times:\n    * 24h sec received: 86400 dur: 338\n    * 24h sec2 [2] received: 86400 dur: 178\n    * 48h min received: 2880 dur: 217\n    * 48h sec2 [2] received: 2880 dur: 105\n    * 30d hour received: 721 dur: 3070\n    * 30d hour [2] received: 721 dur: 1214\n      \n* 1 Year of data (variant bucket, 1 property)\n  * size: 256.6MB \n  * storage: 42.8MB \n  * index: 5.9MB\n  * Query times:\n    * 24h sec received: 86400 dur: 325\n    * 48h min received: 2880 dur: 15\n    * 30d hour received: 721 dur: 152\n    \n[2] use find instead of aggregate and aggregate on application side\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhcode%2Fmongodb-timeseries-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdhcode%2Fmongodb-timeseries-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdhcode%2Fmongodb-timeseries-test/lists"}