Category Archives: Computers

Illustrating write skew in Postgres with Repeatable Read (Snapshot Isolation)

In this post we will see write skew in action using Node.js, Postgres and Sequelize. We will use the example given in wikipedia where there are two accounts (tables) V1 and V2 with a single balance column. The tables are … Continue reading

Posted in Computers, programming, Software | Tagged , , | Leave a comment

Handling Postgres Serialization errors in Sequelize

When using the REPEATABLE READ or SERIALIZABLE isolation levels, you should be prepared to handle serialization (error code 40001) and deadlock failures (error code 40P01) in your code. Well this is how you do it: where That’s it for this … Continue reading

Posted in Computers, programming, Software | Tagged , | Leave a comment

Understanding transformers internals

Posted in Computers, programming, Software | Tagged , , | Leave a comment

SQL Antipatterns: Then and Now

I am an absolute fan of Bill Karwin’s SQL Antipatterns book. I rate it amongst my top 3 database books together with Martin Kleppmann’s Designing Data-Intensive Applications. However, its good to think twice about some of the advice in the … Continue reading

Posted in Computers, programming, Software | Tagged , | Leave a comment

Understanding concurrency control in Postgres and comparing with MySQL

Concurrency control is one of the key things to understand in any database. It is the I in ACID. From MySQL docs (applies to Postgres as well): the isolation level is the setting that fine-tunes the balance between performance and … Continue reading

Posted in Computers, programming, Software | Tagged | Leave a comment

Do we need NUMERIC data type to store financial data in Postgres?

TL;DR: Conventional wisdom dictates that one should use the NUMERIC data type to store financial data to protect from rounding errors that happen with floating point arithmetic (refer IEEE 754 standard). And on JS side we should use a library … Continue reading

Posted in Computers, programming, Software | Tagged | Leave a comment

If you could only install 10 applications on your Mac

what would they be? here is my list: let me know yours.

Posted in Computers, programming, Software | Tagged | Leave a comment

Guide to using Sequelize with Postgres

Note that you can JOIN tables with Sequelize without creating foreign keys. Refer this. Further Reading

Posted in Computers, programming, Software | Tagged | Leave a comment

Postgres Command Line Reference

Posted in Computers, programming, Software | Tagged | Leave a comment

Copying data from BigQuery to Postgres (Cloud SQL)

Google provides a database migration service but at time of this writing it does not support copying data from BigQuery to Postgres (Cloud SQL). You can DIY in a couple of ways. Here I describe a way to do it … Continue reading

Posted in Computers, programming, Software | Tagged , | Leave a comment