I am using psql to query a large database. and (understandably) many queries that I type in take a long time. I typically want to cancel these queries and so I enter `^C`, and psql responds with the message

```
Cancel request sent

```

This cancel request sometimes cancels queries quickly (milliseconds), but sometimes takes very long times (>10 minutes) to cancel the query and display a prompt where I can type in new commands. These long cancel times even happen on queries that have only been running less than a second.

Why does psql take so long to cancel some queries? And what can I do to make psql cancel the queries faster?

---

Version info:

```
$ psql --version
psql (PostgreSQL) 10.12 (Ubuntu 10.12-0ubuntu0.18.04.1)

```