{"id":36790563,"url":"https://github.com/cecobask/timescale-coding-challenge","last_synced_at":"2026-01-12T13:25:14.097Z","repository":{"id":236380263,"uuid":"792494910","full_name":"cecobask/timescale-coding-challenge","owner":"cecobask","description":null,"archived":false,"fork":false,"pushed_at":"2024-04-30T11:28:48.000Z","size":2003,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2024-05-02T14:22:30.948Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","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/cecobask.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}},"created_at":"2024-04-26T19:38:08.000Z","updated_at":"2024-06-19T08:12:48.034Z","dependencies_parsed_at":"2024-06-19T08:12:47.076Z","dependency_job_id":"1804fdba-7269-41e3-989f-a495f973ae14","html_url":"https://github.com/cecobask/timescale-coding-challenge","commit_stats":null,"previous_names":["cecobask/timescale-coding-challenge"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/cecobask/timescale-coding-challenge","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cecobask%2Ftimescale-coding-challenge","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cecobask%2Ftimescale-coding-challenge/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cecobask%2Ftimescale-coding-challenge/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cecobask%2Ftimescale-coding-challenge/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cecobask","download_url":"https://codeload.github.com/cecobask/timescale-coding-challenge/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cecobask%2Ftimescale-coding-challenge/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28338997,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-12T12:22:26.515Z","status":"ssl_error","status_checked_at":"2026-01-12T12:22:10.856Z","response_time":98,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: 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":[],"created_at":"2026-01-12T13:25:13.983Z","updated_at":"2026-01-12T13:25:14.074Z","avatar_url":"https://github.com/cecobask.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# timescale-coding-challenge\nThis is a command line tool that can be used to benchmark `SELECT` query performance across multiple workers against a\nTimescaleDB instance. The tool takes as its input either a CSV-formatted file or standard input and a flag to specify\nthe number of concurrent workers. It starts processing queries as soon as each line from the CSV input is consumed.\nAfter processing all the queries, the tool outputs a summary with the following statistics:\n- Number of queries\n- Total query time\n- Minimum query time\n- Maximum query time\n- Average query time\n- Median query time\n\n## Input\nThe tool accepts input in the form of a CSV file or standard input. The input must be in CSV (comma-separated values)\nformat with the following columns:\n- hostname (`host_000001`)\n- start_time (`2017-01-01 08:59:22`)\n- end_time (`2017-01-01 09:59:22`)\n\n## Prerequisites\n- [ ] Install [Git](https://git-scm.com/downloads) + [Go](https://go.dev/doc/install)\n- [ ] Install [Docker Engine](https://docs.docker.com/engine/install)\n- [ ] Create `.env` file in the root directory, using the [.env.example](.env.example) file as a template\n- [ ] Prepare a CSV file with input data in the format specified [here](#input)\n\n## Usage\n### Docker Compose\nTo run the tool using Docker Compose, execute the following command:\n```\nmake start\n```\nThis command will perform the following steps in detached mode:\n- Build a Docker image of the application\n- Start the TimescaleDB container\n- Perform database migrations\n- Run the application with the configuration specified in the `.env` file and the input data from the CSV source\n\nAfter the application has finished processing the input data, the results can be printed by executing the following command:\n```\nmake print-results\n```\n\nTo stop the database and remove all associated containers, execute the following command:\n```\nmake stop\n```\n\n### Local\nTo use the tool locally, execute the following command:\n```\nmake start-db\n```\nThis command will perform the following steps in detached mode:\n- Start the TimescaleDB container\n- Perform database migrations\n\nAfter starting the database, you can build the tool locally by executing the following command:\n```\nmake build\n```\nThis command will build the application binary in the `build` directory.\n\nIn order for the application to connect to the database container, you need to override the application configuration.\nThis can be done by creating a `.env.dev` file in the root directory with the following content:\n```\nPOSTGRES_HOST=localhost\n```\nThe application will merge the configuration from the `.env` file with the configuration from the `.env.dev` file.\n\nAfter building the binary, you can perform the query benchmarks by executing the following command:\n```\n# Replace the flags with the desired values\nENV=DEV ./build/ts benchmark --workers=3 --config=query_params.csv\n```\nThis command will perform the query benchmarks with 3 workers and the config specified in the `query_params.csv` file.\nFinally, it will output the sorted benchmark results and query statistics in table format:\n```\n┏━━━━━┳━━━━━━━━━━━━━┓\n┃     ┃    DURATION ┃\n┣━━━━━╋━━━━━━━━━━━━━┫\n┃   1 ┃   811.042µs ┃\n┣━━━━━╋━━━━━━━━━━━━━┫\n┃   N ┃         ... ┃\n┣━━━━━╋━━━━━━━━━━━━━┫\n┃ 200 ┃ 27.842125ms ┃\n┗━━━━━┻━━━━━━━━━━━━━┛\n┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓\n┃       QUERY STATISTICS      ┃\n┣━━━━━━━━━━━━━━┳━━━━━━━━━━━━━━┫\n┃ Count        ┃          200 ┃\n┣━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━┫\n┃ Total Time   ┃ 258.889377ms ┃\n┣━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━┫\n┃ Minimum Time ┃    811.042µs ┃\n┣━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━┫\n┃ Maximum Time ┃  27.842125ms ┃\n┣━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━┫\n┃ Average Time ┃   1.294446ms ┃\n┣━━━━━━━━━━━━━━╋━━━━━━━━━━━━━━┫\n┃ Median Time  ┃    896.229µs ┃\n┗━━━━━━━━━━━━━━┻━━━━━━━━━━━━━━┛\n```\n\nTo stop the database and remove all associated containers, execute the following command:\n```\nmake stop\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcecobask%2Ftimescale-coding-challenge","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcecobask%2Ftimescale-coding-challenge","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcecobask%2Ftimescale-coding-challenge/lists"}