Sometimes I want to move a commit between branches. This is easy with git cherry-pick.
However, sometimes I want this commit inserted into my branch at a specific point. This can be done with an interactive rebase.
An interactive rebase lists the commits to be applied to the branch with respect to, usually, the master branch. I usually use git rebase -i to squash commits. But there’s nothing magic about the list of commits provided by the rebase.
Read more
Ecto has a nice feature that allows a target migration to be specified.
The example is:
mix ecto.migrate --to 20080906120000 The ID above is the prefix of the migration file name.
I used this when I had a set of migrations to run, but needed to do intermediate work as each one was applied. This made it really easy.
I recently needed to partition a large table in Postgres. The table is approaching 600M rows. It had a sufficient number of rows that I was not able to create an index without running out of temporary storage on my cloud-hosted server.
Most of my reading on Postgres partitioning talked about partitioning by date. However, few of my queries are of the “recent rows” variety, so that didn’t seem like an optimal approach.
Read more
I don’t have a lot of experience in Rails. I’ve used it over the last year, but most of my time during that period has been in Elixir.
Recently, due to how Postgres partial indexes work, I wanted to replace some parameter markers in my queries with manifest (i.e., hard coded) values. This was only for things like processing states and the like. I still wanted values like keys and dates to be parameterized for DB efficiency.
Read more
I have a large Postgres database that backs some data services used by a few other apps. This database is not large by Postgres standards, having about 600M rows.
I did some reading on Postgres indexes and decided that a series of partial indexes would likely provide the best performance for our variety of queries. However, I was confused that while my analysis revealed that the indexes I created would serve those queries well, Postgres never seemed to use them.
Read more