Base (postgresql): Way to cancel query of statement


Is there a way to cancel a query (or the running statements) so that a query stops running?

When a long query is started, the application seems to stop responding (all instances of LibreOffice do in fact - e.g. Calc) so the only way I see to stop the process is to kill the application, which is not really clean (it does not instruct server to stop and kills all LibreOffice instances).