Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pX0FE-0008Jb-9v for pgsql-general@arkaria.postgresql.org; Tue, 28 Feb 2023 13:42:16 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1pX0FD-0004u6-4O for pgsql-general@arkaria.postgresql.org; Tue, 28 Feb 2023 13:42:15 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pX0FC-0004t4-Q3 for pgsql-general@lists.postgresql.org; Tue, 28 Feb 2023 13:42:14 +0000 Received: from mail-qv1-xf31.google.com ([2607:f8b0:4864:20::f31]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1pX0F8-0005z6-Vj for pgsql-general@lists.postgresql.org; Tue, 28 Feb 2023 13:42:14 +0000 Received: by mail-qv1-xf31.google.com with SMTP id o3so6843734qvr.1 for ; Tue, 28 Feb 2023 05:42:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:from:to:cc:subject:date:message-id :reply-to; bh=2qLNnAVz4+y6WE58wVE8lYGJ8/8Qa4gTM5pKjOKUJc4=; b=JgbGBNqJHw12+mIPxYmnBglABCxKeqb5XV6M3u55HFY8K8RI8hDBsh/IzpZq6eOopK 68NC9dzf/Mr5YaA4qTCk6ed8wyfejr42pUxojl0AHSTNPkqCIpZN1FxM1F0jIrbD0v4A 89+XCIboUXOmvT5iFO4gdXcDHfbLOrjsgPbOQY2L4JDHpvgnVhK+MD7QQZdNecikOLpz MT1/zufdCXOiIvI3OSupBKK7HmV5iAKmrx1q54R0OBPMCabMJn9SpYAIU9PY+Lmn0Xis QKXXqyFIr3gxrHBWX4OewOAREWXdBiYi42oR+H5YX0sm+7NydDy4RnoP+Qug1kPwGhf9 OqZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:from:references:to:content-language:subject:user-agent :mime-version:date:message-id:x-gm-message-state:from:to:cc:subject :date:message-id:reply-to; bh=2qLNnAVz4+y6WE58wVE8lYGJ8/8Qa4gTM5pKjOKUJc4=; b=JK/3XkZl0BCUIesU3+IRT4pgaG9BJv74KfBrfvLNu2sksxxF8ShizbQKrUE+Ro6+yW TzpnPK/vLxrNl7QOeBtehQKwX7a1VajHxha9+nL5+4+sBWsYkpwKBz1g6DUEqn4id89n +FgsEBUupVla72C7m8z9nhBFxvOHv/9fMf37Ij5aZ7VnHp6giRZFTg6UeDU/aSkT85tS Jt7LSKEQX2U+fDeYn3G/r5PW4uNtu+c4ab+rniV2cGhzGKMCF66j/DJiVOl62Vc4huc5 5NJFGUfDUN8kMEIkdIRhH01bKifD6ond1NLkllMbZNWrWG/H7ETmDhDe6Pjao9kkzWIY TSkg== X-Gm-Message-State: AO0yUKV266QfbYWzp6lv3aWQ7UAUNq81ue7NtEJlYLI58nKxgwn+XGSC F+8OjLchAhS2GhJiT9+SuI+VpJshmiE= X-Google-Smtp-Source: AK7set/vilD1LEnMug/pkimq4mkOTe+1SELN93a+K9NddMnBUsC1B6U79xczV00azkKZ8tgdvBokPQ== X-Received: by 2002:a05:6214:23c5:b0:56e:a899:1605 with SMTP id hr5-20020a05621423c500b0056ea8991605mr5200163qvb.0.1677591729209; Tue, 28 Feb 2023 05:42:09 -0800 (PST) Received: from ?IPV6:2600:1700:bd2c:b810::43? ([2600:1700:bd2c:b810::43]) by smtp.googlemail.com with ESMTPSA id x21-20020a376315000000b007419eb86df0sm6883436qkb.127.2023.02.28.05.42.08 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 28 Feb 2023 05:42:08 -0800 (PST) Content-Type: multipart/alternative; boundary="------------PgECNobtICFdr7uNORGLYXBd" Message-ID: Date: Tue, 28 Feb 2023 07:42:08 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.2 Subject: Re: Quit currently running query Content-Language: en-US To: pgsql-general@lists.postgresql.org References: From: Ron In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk This is a multi-part message in MIME format. --------------PgECNobtICFdr7uNORGLYXBd Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2/28/23 04:53, Albert Cornelius wrote: > How can I quit a currently running query? I've issued a query and my > server does not respond anymore. Is there another solution than using kill -9? What *specifically* do you mean by "my server does not respond anymore"?  Because if "the server" /really/ doesn't respond anymore, you can't even issue "kill -9". I'd first try "|select pg_cancel_backend();".  If that doesn't work, try |"|select pg_*terminate*_backend();"|||, which is the Postgresql-aproved version of "kill -9". -- Born in Arizona, moved to Babylonia. --------------PgECNobtICFdr7uNORGLYXBd Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit On 2/28/23 04:53, Albert Cornelius wrote:
How can I quit a currently running query? I've issued a query and my server does not respond anymore. Is there another solution than using kill -9?

What specifically do you mean by "my server does not respond anymore"?  Because if "the server" really doesn't respond anymore, you can't even issue "kill -9".

I'd first try "select pg_cancel_backend(<pid>);".  If that doesn't work, try "select pg_terminate_backend(<pid>);", which is the Postgresql-aproved version of "kill -9".

--
Born in Arizona, moved to Babylonia.
--------------PgECNobtICFdr7uNORGLYXBd--