Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSeuA-0006xn-LR for pgsql-general@arkaria.postgresql.org; Tue, 12 Jun 2018 08:43:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fSeu9-0005az-NZ for pgsql-general@arkaria.postgresql.org; Tue, 12 Jun 2018 08:43:53 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fSeqL-0007Zj-3o for pgsql-general@lists.postgresql.org; Tue, 12 Jun 2018 08:39:57 +0000 Received: from mx2.mailbox.org ([80.241.60.215]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fSeqG-0002Rt-Tb for pgsql-general@postgresql.org; Tue, 12 Jun 2018 08:39:55 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx2.mailbox.org (Postfix) with ESMTPS id 00E6C4116B; Tue, 12 Jun 2018 10:39:48 +0200 (CEST) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by hefe.heinlein-support.de (hefe.heinlein-support.de [91.198.250.172]) (amavisd-new, port 10030) with ESMTP id 9pxIch8xFpS8; Tue, 12 Jun 2018 10:39:47 +0200 (CEST) Message-ID: <1528792786.2729.0.camel@cybertec.at> Subject: Re: Bad performance with cascaded deletes From: Laurenz Albe To: Haug =?ISO-8859-1?Q?B=FCrger?= , pgsql-general@postgresql.org Date: Tue, 12 Jun 2018 10:39:46 +0200 In-Reply-To: <5a4cfb77-6095-5230-8019-49f99c9ecefa@zalando.de> References: <5a4cfb77-6095-5230-8019-49f99c9ecefa@zalando.de> Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Haug Bürger wrote: > Delete on zpg_data.session (cost=190.51..4491.20 rows=500 width=46) > ... > Planning time: 0.222 ms > Trigger RI_ConstraintTrigger_a_16481 for constraint > availability_cache_ac_session_id_fkey: time=350.116 calls=500 > > For me this reads like the delete takes 0.2ms and the cascaded delete > takes 350ms. Could you share the complete plan? Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com