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...

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

You can improve your LIKE / ILIKE search queries in PostgreSQL by adding a GIN index with an operate class ("opclass...

Recently I needed to benchmark an Active Record query for performance measurements. I wrote a small script that runs each...

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

Postgres works differently See PostgreSQL: Difference between text and varchar columns for PostgreSQL-specific info MySQL has 4 different column...

makandra dev

10.0.0 2024-03-07 Compatible changes console command: You can now globally disable the IRB multiline feature by setting irb...

edgeapi.rubyonrails.org

The linked article suggests an interesting way to speed up tests of Rails + Postgres apps: PostgreSQL allows the creation of...

In CI test runs I noticed that string sorting order changed after switching from a debian-based PostgreSQL docker image...

blog.mastermind.dev

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

Maintaining larger projects makes it more difficult to balance refactoring and upgrade tasks according to its actual value. Consider to...

geekytidbits.com

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

SELECT pg_size_pretty(pg_database_size('some-database')); Example SELECT pg_size_pretty(pg_database_size('cards_p')); ----------------

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...

moncefbelyamani.com

The linked article points out that COUNT queries might be unexpectedly slow in PostgreSQL. If you just need to know...

When you repeat a subpattern with a *, + or {...} operator, you may choose between greedy, lazy and possessive modes. Switching modes...

johnnunemaker.com

PostgreSQL has partial indexes. With a partial index you tell Postgres to only index rows matching a given query.

We currently test most of our gems on Travis CI, but want to migrate those tests to Github Actions. This...

When loading a database dump created with pg_dump into your database, you might run into an error like