Talks
Speakers
Events
Topics
Sign in
Home
Talks
Speakers
Events
Topics
Leaderboard
Use
Analytics
Sign in
Suggest modification to this talk
Title
Description
As Rails developers, using ActiveRecord as our database library is a given. As our application grows, we start noticing that some of our new requirements aren't exactly supported by the ActiveRecord API. So, we pull up our sleeves and write that raw SQL snippet, re-create some queries without models to get that extra performance gain, or work around that bug in the library, and move on. But gaining this technical debt isn't necessary if you're using a library that supports your advanced use cases. Enter Sequel, an alternative ORM for Ruby. In this talk we will show some advantages that Sequel has over Active Record, covering topics like the query API, building SQL expressions (Arel), connection pools, immutability and more. rubyday 2020 - Virtual edition, September 16th 2020. https://2020.rubyday.it/ Next edition: https://2021.rubyday.it/
Date
Summarized using AI?
If this talk's summary was generated by AI, please check this box. A "Summarized using AI" badge will be displayed in the summary tab to indicate that the summary was generated using AI.
Show "Summarized using AI" badge on summary page
Summary
Markdown supported
In the talk "Sequel: When ActiveRecord is not enough," Janko Marohnic discusses the limitations of ActiveRecord, a commonly used ORM in Ruby on Rails, and introduces Sequel as an alternative ORM that addresses these limitations. Key points include: - **Complex Queries:** While ActiveRecord is user-friendly for common tasks, it can struggle with complex SQL queries that require raw SQL workarounds. Sequel offers a more straightforward approach to SQL. - **Connection Management:** ActiveRecord establishes connections lazily, which can lead to unpredictable behavior, while Sequel establishes connections immediately, leading to greater reliability. - **Query Handling:** ActiveRecord caches query results while Sequel uses frozen data sets, requiring users to consciously decide when to execute queries. - **Model and Data Set Decoupling:** Sequel separates models and datasets, allowing users to utilize one without the other. This decoupling enhances flexibility. - **Plugin System:** Sequel employs a plugin system for adding features, keeping the base layer lightweight and reducing complexity. In contrast, ActiveRecord comes with various features that may remain unused. - **Expression API:** Sequel's expression API is streamlined and reduces complexity compared to ActiveRecord’s Arel API, which can be verbose and is less documented. - **Eager Loading:** Sequel has a clearer approach to eager loading with fewer methods that are easier to understand compared to ActiveRecord’s options. - **Performance:** Benchmarks show that Sequel outperforms ActiveRecord, with lower memory usage and faster execution times. - **Connection Pool Management:** Sequel handles connection allocations more efficiently than ActiveRecord, which can struggle when thread count exceeds available connections. - **Integration with Rails:** Janko outlines how to integrate Sequel with existing Rails applications, suggesting a bridge gem that allows for SQL usage alongside ActiveRecord. In summary, Sequel offers a lighter and faster alternative to ActiveRecord, especially suitable for complex SQL operations. It maintains robust PostgreSQL support and simplifies the ORM design, making it a worthy consideration for Ruby developers seeking more advanced database interaction capabilities.
Suggest modifications
Cancel