In some cases, you need to prune long running statements to limit the consumption of resources, or just if the result is not relevant, or if the statement is running too long. Since Go 1.8, the canceling of queries is possible. This recipe explains how to use this feature.
Canceling the pending query
Getting ready
Verify if Go is properly installed by calling the go version command in your Terminal. If the command fails, follow the Getting ready section in the first recipe of this chapter.
Set up the PostgreSQL server, as mentioned in the first recipe of this chapter.