I’m asked all the time “How can I learn all this stuff?". The simple answer is ‘build an app’
When time is critical, exclude large files from your Postgres restore and save the world at the same time.
PostgreSQL is an amazing RDBMS. Not only is has it been ACID compliant since 2001, it supports many data types and functions, putting it on par with Document Store systems like MongoDB. Postgres supports a wide range of JSON formats and methods to store, search, and transform JSON object data. For instance, the
to_json and related function
json_agg allow you to collect a row into a JSON object. Handy for when you have nested data and want PG to return an object with nested values.
I’ve been using Knex for a long time, closing in on two years. Just to clarify, Knex is NOT an ORM (Object Relation Model). ORM’s try to model your database into neat and logic classes, but I agree with Laurie Voss, and ORM is an anti-pattern. I’ve used Sequelize, Doctrine ORM, and others. Every. Single. Time. ORM’s will let you down and keep you from leveraging your database to its fullest potential. Developers like them because you can encapsulate all the logic in the code and treat your database as just a dumb data store. This is a mistake.
I’m embarrassed this took me longer than expected, but here is a
.gitlab-ci.yml that will fire up Docker in Docker (so you can build and run containers) and run Postgres to use in your contract tests.
A run down on the apps I use regularly and why. Caution, Mac specific drivel ahead.
I was curious, how many day’s old am I? I suppose I could solve this in many different programming languages, but thought “PG has really good date management features, let me try that”. So here it is.
This doesn’t happen every day, but once in a while you may find yourself needing to remove all the tables/functions/views from a PostgreSQL database. The key is you don’t want to delete the database itself. Maybe you are on a hosted solution where you don’t really have access to drop/restore a database. For example, I’m using Heroku’s Postgres service and dropping the database is not an option.
Let’s look at a few ways we can name our database fields. This is mostly subjective, with some personal opinion mixed in for added velocity.
Databases are magic from my perspective. They take in queries, find all the information you tasked it to find, and POOF. In the blink of an eye, there it is, all packaged up nice and neat. Or it blows up in your face, but that never happens, right? Let’s take a look at some steps we can take when things are not returned in the blink of and eye. What can we do to improve our database performance.