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 1kQnGe-00016W-QA for pgsql-sql@arkaria.postgresql.org; Fri, 09 Oct 2020 07:56:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kQnGd-0004ek-Pb for pgsql-sql@arkaria.postgresql.org; Fri, 09 Oct 2020 07:56:43 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kQk4a-0001DJ-6J for pgsql-sql@lists.postgresql.org; Fri, 09 Oct 2020 04:32:04 +0000 Received: from einhorn-mail-out.in-berlin.de ([217.197.80.21]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kQk4S-0003YT-SO for pgsql-sql@lists.postgresql.org; Fri, 09 Oct 2020 04:32:02 +0000 X-Envelope-From: ftimmer@ft-c.de X-Envelope-To: Received: from authenticated.user (localhost [127.0.0.1]) by einhorn.in-berlin.de with ESMTPSA id 0994VoTp031762 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT) for ; Fri, 9 Oct 2020 06:31:52 +0200 From: Franz Timmer Reply-To: ml@ft-c.de To: pgsql-sql@lists.postgresql.org Subject: send query in background Message-ID: <44c27f2a-d010-fb71-5410-359f75475660@ft-c.de> Date: Fri, 9 Oct 2020 06:31:49 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: de-DE Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk hallo, I have one pg function (a long running sql query), it is running few minutes. I start it from webserver via PHP. My question: Is there a possibility, that this function runs in background. PG send back a immidiately return and do the work after this answer. like linux/bash commands with an ampersand "&" at the and of the line. The user get a prompt and can prozess his work. When the user push the button on the website to start the sql-script, he can process his work. I work with v11.8, but it is possible to update to v12. (google found some answers, but these a 10 years old) Franz