When you want to filter records in a model where a string column roughly matches a given term, you can...

Why Rails has multiple schema formats When you run migrations, Rails will write your current database schema into db/schema.rb. This...

PostgreSQL can cosplay as a full-text search engine. It doesn't have the features or fidelity of ElasticSearch or...

When debugging slow SQL queries, it’s helpful to understand the database engine's query plan. Whenever you execute a...

makandra dev

A lesser known fact about PG enums is that they are ordered. This can be really handy when values have...

While the main goal always is to prevent long-running queries in the first place, automatic timeouts can serve as...

I recently stumbled upon the Rails feature composed_of. One of our applications dealt with a lot of addresses and...

makandra dev
github.com

I was recently asked to optimize the response time of a notoriously slow JSON API endpoint that was backed by...

makandra dev

While most Rails Apps are tied to at least one external REST API, machine-to-machine communication via GraphQL is...

Debugging performance issues in your Rails app can be a tough challenge. To get more detailed insights consider using the...

You don't want sensitive user data in your logs. Background Rails per default filters sensitive data like...

When you allow file uploads in your app, a user might upload content that hurts other users. Our primary concern...

In Ruby on Rails ActiveRecord::Relation#merge overwrites existing conditions on the same column. This may cause the relation to...

blog.mastermind.dev

I found the linked article very helpful to refresh my understanding of database indexes. As a small bonus, it includes...

Let's say we have posts with an attribute title that is mandatory. Our example feature request is to tag...

The change_column method for rails migrations support casting with a custom SQL statement. This allows us to change a...

geekytidbits.com

To retrieve only unique combinations of the selected attributes: You can omit rows, where all selected columns are equal with...

DevOps Curriculum

Mit SQL spricht man mit relationalen Datenbanken. Ziele Verstehe die folgenden SQL Befehle SELECT WHERE ORDER INNER JOIN, LEFT JOIN...

When changing glibc versions, it's possible to end up with corrupt indexes in PostgreSQL. Are My Indexes Affected?

When paginating records, we usually need to know the number of total records in order to render pagination links. Popular...

joshmcarthur.com

I recently wanted to add a model for address information but also wanted to add a unique index to those...

There is a way to use multiple databases in Rails. You may have asked yourself how you're able to...

Sometimes we write plain SQL queries in migrations so we don't have to mock ActiveRecord classes. These two migrations...

Sometimes you want to find the inverse of an ActiveRecord scope. Depending on what you want to achieve, this is...