Latest Posts

Tree structure query with PostgreSQL

When dealing with hierarchical data, we usually use recursion for constructing the tree structure. It would be a performance problem if you query the tree node data from the database every time the recursion happens. Also, if you work with languages which are heavily based on callback like Javascript, you will find it is very […]

Embracing SQL In Postgres

Having the ability to work SQL in your favorite database engine is a life-long, good skill to have. In this post I’ll show you some of the favorite things I use in Postgres.

Staying Hungry, Staying Foolish

I’m finally recovering from the longest period of burnout I’ve had – it’s lasted almost an entire year! The secret? Forgetting what I know and jumping first, thinking second.

Thank You For That Pull Request, However

I love working on Open Source projects – lending a hand or starting one up myself. I also love when people want to help, however it’s no fun when their pull request is just not helpful. No fun for them because no one likes rejection, and no fun for me because I don’t want to offend! So, this is a reference post that can be used for that occasion.

Using Custom Types in Postgres

Using Types For Fun and Profit In my last post about pulling documents from queries I showed an interesting way to return a result set using row_to_json to crunch down 1-many records into a JSON array. This works pretty well and is really fast – but it’s not exactly pretty: create or replace function get_member(member_id […]

Pulling Documents From a Relational Query in Postgres

JSON, JSONB and Postgres 9.4 Upfront: Postgres isn’t the only database system in town to formally support JSON; SQL Server, MySQL, and Oracle do as well. Really – JSON is just text so there’s no miracle when it comes to “supporting” it in a relational system. The fun comes with how a system supports JSON. […]

Being a Nomad for a Year

Traveling For a Year Without a Plan No, I’m not independently wealthy and yes, we’re homeschooling our kids (aged 12 and 9). Yes I’m still working as we travel and so far things are … kind of working out for us (more on that later). We decided to do this basically on the spur of […]