Posted about 1 month ago. Visible to the public. Repeats. Linked content.

Heads up: counting may be slow in PostgreSQL

The linked article points out that COUNT queries might be unexpectetly slow in psql.
If you just need to know "are there any records" use any? or present? instead. The latter uses SELECT 1 AS one FROM ... LIMIT 1 under the hood.

In short: Replace foo.count > 0 with foo.any?

Does your version of Ruby on Rails still receive security updates?
Rails LTS provides security patches for old versions of Ruby on Rails (3.2 and 2.3).

Owner of this card:

Avatar
Michael Leimstädtner
Last edit:
about 1 month ago
by Henning Koch
About this deck:
We are makandra and do test-driven, agile Ruby on Rails software development.
License for source code
Posted by Michael Leimstädtner to makandra dev
This website uses short-lived cookies to improve usability.
Accept or learn more