Active Record Preload

I have an app that retrieves 640 data points from a database (from the Series table) that are then rendered to JSON and sent to the client to be plotted on a chart. Active Record assembles an object from one or more database records. Since the Series class includes the Instrument class, each Series object […]

Active Model Serializers & JSON Sideloading

Depending on the application, JSON data transfers can be costly in terms of response time and data size. When your data model has nested associations, each association gets fully converted into JSON. This can lead to a lot of duplicated data being serialized and transmitted. Sideloading repetitive association data is a way to reduce JSON payloads and […]

Using Database Transactions

When we use a relational database, we are using database transactions. By default, every SQL statement (select, insert, update, etc.) executes within its own transaction. A transaction incurs a lot of overhead. When we need to process lots of SQL statements at a time, our application’s performance can suffer greatly. Background A database transaction represents […]