Notre Dame of Paris seen from the Quai de la Tournelle (1863) - Johan Barthold Jongkind

Rails and PostgreSQL: Types

During nokul we’ve heavily implemented PostgreSQL features into our Rails application. Unfortunately, ActiveRecord doesn’t come with constraint support for PostgreSQL, but rein does a fantastic job covering what’s missing in ActiveRecord. We believe that, one shouldn’t rely on a web application, that is very prone for human-error, when it comes to data integrity. Therefore our PostgreSQL tables included various constraints and limits. Below you will find a set of rules that we’ve investigated, implemented and battle tested with various types....

November 9, 2018 · 5 min · Serhat M. Dündar
Le Treport, Le Matin, Normandie (1852) - Johan Barthold Jongkind

Rails and PostgreSQL: Constraints

During nokul we’ve heavily implemented PostgreSQL features into our Rails application. Unfortunately, ActiveRecord doesn’t come with constraint support for PostgreSQL, but rein does a fantastic job covering what’s missing in ActiveRecord. We believe that, one shouldn’t rely on a web application, that is very prone for human-error, when it comes to data integrity. Therefore our PostgreSQL tables included various constraints and limits. Below you will find a set of rules that we’ve investigated, implemented and battle tested with various types....

November 3, 2018 · 3 min · Serhat M. Dündar
The Church of Overschie (1866) - Johan Barthold Jongkind

Tuning PostgreSQL Configuration

Configuration File RAM amounts defined below doesn’t represent the total amount of memory available for your machine, instead, it represents what PostgreSQL can use maximum. Decribed configuration requires PostgreSQL >= 10. Remove max_parallel_workers for older versions. The configuration file is usually located at /etc/postgresql/$VERSION/main/postgresql.conf in Debian-derivatives. For locating the file in other operating systems, you can use psql as follows: psql -U postgres show config_file; Tracking Query Statistics Enable the pg_stat extension, if you are interested in tracking query statistics:...

November 2, 2018 · 1 min · Serhat M. Dündar