{"id":27933446,"url":"https://github.com/timescale/postgresql-performance-for-rubyists","last_synced_at":"2025-05-07T04:58:46.314Z","repository":{"id":283564741,"uuid":"931772002","full_name":"timescale/postgresql-performance-for-rubyists","owner":"timescale","description":"Postgresql Performance Workshop for Rubyists","archived":false,"fork":false,"pushed_at":"2025-04-11T20:24:11.000Z","size":7889,"stargazers_count":15,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-05-07T04:58:40.944Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","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/timescale.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}},"created_at":"2025-02-12T20:39:11.000Z","updated_at":"2025-04-14T10:27:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"8751bfd3-c10d-4488-970d-98201ea3f1f4","html_url":"https://github.com/timescale/postgresql-performance-for-rubyists","commit_stats":null,"previous_names":["timescale/postgresql-performance-for-rubyists"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Fpostgresql-performance-for-rubyists","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Fpostgresql-performance-for-rubyists/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Fpostgresql-performance-for-rubyists/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/timescale%2Fpostgresql-performance-for-rubyists/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/timescale","download_url":"https://codeload.github.com/timescale/postgresql-performance-for-rubyists/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252816948,"owners_count":21808704,"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-05-07T04:58:45.598Z","updated_at":"2025-05-07T04:58:46.306Z","avatar_url":"https://github.com/timescale.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🚀 Ruby PostgreSQL Performance Workshop\n\nWelcome to an interactive journey into PostgreSQL optimization for Rubyists! This self-paced workshop will take you from understanding PostgreSQL internals to mastering TimescaleDB for time-series data. Get ready to level up your database skills! 🎯\n\n![img/intro.webp](img/intro.webp \" A kawaii felt craft scene_ An adorable chubby felt elephant (PostgreSQL mascot) with big sparkly eyes and rosy cheeks, wearing a tiny crown made of red felt\")\n\n## 📚 Workshop Structure\n\nThis workshop is organized into progressive modules, each building upon the previous ones:\n\n```mermaid\ngraph TD\n    A[PostgreSQL Internals] --\u003e|\"See: 01_storage/README.md\"| B[Transaction Management]\n    B --\u003e|\"See: 02_transactions/README.md\"| C[Query Optimization]\n    C --\u003e|\"See: 03_queries/README.md\"| D[TimescaleDB Extension]\n    D --\u003e|\"See: 04_timescale/README.md\"| E[Ruby Performance]\n    E --\u003e|\"See: 05_ruby/README.md\"| F[Performance Monitoring]\n```\n\nThe [troubleshooting section](TROUBLESHOOTING.md) is optional and can be accessed at any time.\n\nThe [glossary](GLOSSARY.md) is also optional and can be accessed at any time.\n\n## 🎯 Prerequisites\n\n```ruby\nknowledge = {\n  ruby: \"Comfortable with Ruby and ActiveRecord\",\n  postgres: \"Basic SQL knowledge\",\n  tools: [\"psql\", \"ruby 3.0+\", \"postgres 15+\"]\n}\n\nraise \"Need to level up first! 💪\" unless knowledge.values.all?(\u0026:present?)\n```\n\n## 🛠 Setup\n\n1. Clone this repository:\n```bash\ngit clone https://github.com/timescale/postgresql-performance-for-rubyists\ncd postgresql-performance-for-rubyists\n```\n\n2. Set up your database:\n\nYou can use Docker to setup a TimescaleDB database:\n\n```bash\ndocker run -d --rm -it -e POSTGRES_HOST_AUTH_METHOD=trust -e POSTGRES_USER=$USER -e POSTGRES_DATABASE=workshop_db -p 5432:5432 timescale/timescaledb-ha:pg17\n```\nThen test if it's working:\n\n```bash\npsql -h 0.0.0.0 -d workshop_db\n```\n\nAfter the test you can export the database URI that will be used for all\nexercises.\n\n```bash\n# In your terminal\nexport DATABASE_URL=\"postgres://${USER}@0.0.0.0:5432/workshop_db\"\n```\n\n3. Verify your setup running the first example:\n\n```ruby\nruby examples/01_storage/practice_storage.rb\n# If you see table creation outputs, you're good to go! 🎉\n```\n\n## 📖 Core Concepts\n\nBefore diving into specific modules, familiarize yourself with these fundamental concepts:\n\n### 1. PostgreSQL Architecture\n- **[Process \u0026 Memory Structure](examples/01_storage/README.md#process-structure)**\n- **[Storage Layout](examples/01_storage/README.md#storage-layout)**\n- **[Buffer Management](examples/01_storage/README.md#buffer-management)**\n\n### 2. Data Consistency\n- **[Transaction Management](examples/02_transactions/README.md#transaction-management)**\n- **[Concurrency Control](examples/02_transactions/README.md#concurrency-control)**\n- **[ACID Properties](GLOSSARY.md#acid)**\n\n### 3. Performance Foundations\n- **[Query Planning](examples/03_queries/README.md#query-planning)**\n- **[Index Types](examples/03_queries/README.md#index-types)**\n- **[Statistics Collection](examples/03_queries/README.md#statistics)**\n\nFor detailed definitions of terms used throughout the workshop, refer to our [Glossary](GLOSSARY.md).\n\n## 📚 Learning Path\n\n### 1. [PostgreSQL Internals](examples/01_storage/README.md)\nLearn how PostgreSQL physically stores and manages data:\n- Storage layout and TOAST\n- WAL mechanics\n- Buffer management\n- Table structure optimization\n\n### 2. [Transaction Management](examples/02_transactions/README.md)\nMaster concurrency control and transaction isolation:\n- ACID properties in practice\n- Isolation levels\n- Deadlock handling\n- Transaction patterns\n\n### 3. [Query Optimization](examples/03_queries/README.md)\nOptimize query performance:\n- Query planning and execution\n- Index selection and usage\n- Join optimization\n- Performance monitoring\n\n### 4. [TimescaleDB Extension](examples/04_timescale/README.md)\nHandle time-series data efficiently:\n- Hypertables and chunks\n- Continuous aggregates\n- Data retention policies\n- Compression strategies\n\n### 5. [Ruby Performance](examples/05_ruby/README.md)\nOptimize Ruby and ActiveRecord usage:\n- Batch processing\n- Memory management\n- Query optimization\n- Connection pooling\n\n## 🎮 Interactive Learning\n\n**Experiment Freely**\n\n```ruby\ndef learning_approach\n  loop do\n    try_something_new\n    break if it_works?\n    learn_from_failure\n  end\nend\n```\n\n## 🤝 Contributing\n\nFound a bug? Have an improvement idea? Want to add more examples? We love contributions!\n\n```ruby\nmodule Contributor\n  extend Enthusiasm\n  \n  def self.how_to_help\n    [\n      \"🐛 Report bugs\",\n      \"✨ Add new examples\",\n      \"📚 Improve documentation\",\n      \"🎨 Share your creative solutions\"\n    ]\n  end\nend\n```\n\n## 📘 Additional Resources\n\n- [PostgreSQL Documentation](https://www.postgresql.org/docs/)\n- [TimescaleDB Documentation](https://docs.timescale.com/)\n- [Ruby on Rails Active Record Query Interface](https://guides.rubyonrails.org/active_record_querying.html)\n- [Workshop Troubleshooting Guide](TROUBLESHOOTING.md) - For common issues, solutions, and performance comparisons\n\n## About this Workshop\n\nThis workshop is given at the following conferences:\n- [Ruby Community Conference 2025](https://rubycommunityconference.com/)\n- [Tropical On Rails 2025](https://tropicalonrails.com/)\n\nIf you're interested in running this workshop for your conference or meetup, please [contact me](mailto:jonatas@timescale.com).\n\nHappy learning! 🚀✨\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimescale%2Fpostgresql-performance-for-rubyists","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftimescale%2Fpostgresql-performance-for-rubyists","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftimescale%2Fpostgresql-performance-for-rubyists/lists"}