Stack: Golang + Postgres + Docker + Swagger
Configuration:
- dev config - for local running and testing
- deploy config - for deploying in a Docker container
Run locally:
go run cmd/main.go --config=config/dev.yml
Run in Docker:
docker compose up --build
This project uses cursor pagination. Compared to indexed pagination, this method is faster, reduces database load, and decreases response time.
The OFFSET
instruction is costly because, in a large database, it requires iterating through many records, increasing response time. This is mitigated by using ORDER BY id > cursor_id
.