This post is about the context package of golang and how to get started with it. We’ll also disucss the various use cases of it. After reading this blog user should have comprehensive understanding of context package of golang.


  • goroutines: goroutines are the light weight threads which can be used to execute functions concurrently with other functions. You can read more about goroutines at link
  • channels: channels can be thought of as a pipe that connect multiple concurrent goroutines. Read more about channels at link
  • defer: A defer statement postpones the execution of a function until the surrounding function returns…

Indexes are a common way to enhance database performance. An index allows the database server to find and retrieve specific rows much faster than it could do without an index. Without an index, the system would scan the entire table row by row to find all the matching records. But indexes also add overhead to the database system as a whole, so they should be used sensibly.

Following command can be used to create the index on one or more columns of a table.

CREATE INDEX index-name ON table-name (column-names);

While the creation of index only by default Postgres allows…

This post is in continuation to the previous post. This post deals with the problem of batch upserts in different child tables of same partition set created using pg_partman.

This uses ON CONFLICT clause. This clause specifies an alternative action for raising a unique violation or exclusion constraint violation error. The _createparent() function in partman schema allows us to specify the alternative action that ON CONFLICT clause will use in the case when insertion returns a violation error.

Specify an action for ON CONFLICT while creating partition set

following function creates partition set as in the previous post, but here an action is passed for ON CONFLICT to handle the…

Table partitioning is splitting of a large table in smaller tables based on values of some attribute in the table. This post is about partitioning tables using pg_partman. It provides the following two types of table partitioning,

  • Time-based table partitioning
  • Serial id based partitioning. Follow below sections to do time-based table partitioning. I will be using the postgres database to describe the example

Installing and setting up pg_partman

  • run following commands to install pg_partman
git clone
cd pg_partman
make install
make NO_BGW=1 install

After running above commands successfully, pg_partman should be installed on your machine. running the command in step 4 will provide plain…

I have been using vim for more than three months. Now I do most of my editing on vim. In this post, I shall be describing setting up vim for golang from scratch. Vim config that I shall be posting here is available here. I play with my vim configuration frequently to increase productivity and improve my experience with vim. Follow below sections to set up your vim.

Set up a plugin manager

There are many available plugin managers like pathogen, vim-plug, vim packages etc. I use pathogen.

  • Run the following command to install pathogen.vim.
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim

Asheet Bhaskar

Product Engineer at Gojek.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store