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 1lQNMq-0004SR-G8 for pgsql-admin@arkaria.postgresql.org; Sun, 28 Mar 2021 04:49:40 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lQNMm-0005qO-Sa for pgsql-admin@arkaria.postgresql.org; Sun, 28 Mar 2021 04:49:36 +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 1lQNMm-0005qF-H8 for pgsql-admin@lists.postgresql.org; Sun, 28 Mar 2021 04:49:36 +0000 Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lQNMe-00023E-6s for pgsql-admin@lists.postgresql.org; Sun, 28 Mar 2021 04:49:35 +0000 Received: by mail-ed1-x529.google.com with SMTP id h13so10640028eds.5 for ; Sat, 27 Mar 2021 21:49:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:cc:date:in-reply-to:references :user-agent:mime-version:content-transfer-encoding; bh=H5V1Q7nqmHQ+QXpQWp0cA2b0u3g8uwBbkDg6pzL87O0=; b=qT0d0FUiX/RITHj27daXcqkCU0Do+fMufkaKHzVPkSj340GEf4f+4Tl1/tsBAdVRBP PflnDYgAX3i8iy1PbfwPxccoowPbmHobHAI6jwzXn7tLkJYMIQc3F05+KRtQ2BfGLEtr EGRNvZQUG6bCJt0KtEKwyXqNbIGtcusduk6BEex6HbHvK+lBxRACgds19fplxFyfqleb 4Xu51DULX8ba9rmYiclreWwm6p8UVwsVXx3muape1Byn5JKxd5GE5MsG9abU5Y94fK1T T9R0mfP29CKbXe8i00yq1il7lWaH8LO2ydYfZtBTkks2U3Pg4YtpVMXz3Nme4GMN0DpJ LnlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=H5V1Q7nqmHQ+QXpQWp0cA2b0u3g8uwBbkDg6pzL87O0=; b=f2vcob/EPTij7adFNuCllLTjBbJydCMV0fYOUtotwuS7KhjfTuh2px0MjH6j2xGTkQ qV2g/qUyR0aNFqtwbULPVpiIW+AOgoHWGRXCZfrY5taKyqaGV3YqpQO7iDoYgvgj/JZA gcV+P74PtRW7vHpeJdTuJOBwsnFqUIqTJLgD4WEexo2WWRLBn7ZK/UEHs9ZygRvzlr7f aySjfWTjNHf3MhmKHmIx6brqJVUnDkkAbT0jIs3squ1SPENw1RhfFKkRwkVi2WCtGHyj 37c/jMVTdsf6POzCW3zVqX5Qpqrp7PzgLRuSKq++O/XafzRnW3mLkJVfQtYv/Ut0imkv C9LA== X-Gm-Message-State: AOAM532wkgi1Eg5u+EV76RzO92Bw1IK3MEtddb57H7QyR6G/hmha8WvO 0t0Wk1iiN4Pd9Gfcd54an/CmLA== X-Google-Smtp-Source: ABdhPJzfSIytOggLgHCxHSDUye0dE38IcPDxWqgoRoMKYLBr9RtMcMuICvIrrmVSacuhCQrabmaDzA== X-Received: by 2002:a05:6402:3593:: with SMTP id y19mr22829702edc.317.1616906965569; Sat, 27 Mar 2021 21:49:25 -0700 (PDT) Received: from localhost.localdomain (91-115-151-185.adsl.highway.telekom.at. [91.115.151.185]) by smtp.gmail.com with ESMTPSA id la15sm6066724ejb.46.2021.03.27.21.49.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 27 Mar 2021 21:49:25 -0700 (PDT) Message-ID: <5d3f776063f41977df5910c6cdaef6b963342023.camel@cybertec.at> Subject: Re: Native Foreign Keys housekeeping time intensive for Relational Model From: Laurenz Albe To: Tom Lane Cc: Jacque Edmund , pgsql-admin@lists.postgresql.org Date: Sun, 28 Mar 2021 06:49:24 +0200 In-Reply-To: <2002503.1616856201@sss.pgh.pa.us> References: <2002503.1616856201@sss.pgh.pa.us> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.36.5 (3.36.5-2.fc32) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Sat, 2021-03-27 at 10:43 -0400, Tom Lane wrote: > Laurenz Albe writes: > > > On Fri, 2021-03-26 at 14:00 -0400, Jacque Edmund wrote: > > > I've already seen that my current set of FK relationships between < 100 tables and data footprint > > > has yielded very large lookup times for the underlying referential integrity of the FKs to vet > > > whether it can DELETE a row or not based on its FK relationships. > > > I would be surprised if correctly indexed foreign keys would slow deletes down so that > > the performance becomes intolerable. > > Deletes being slow often means that you don't have an index on the > referencing column(s). PG requires you to have an index on the referenced > columns, but not on the other side of the FK relationship. Exactly, that's what I wanted to say: I suspect that such indexes are missing or not created correctly. Otherwise, the performance should be good. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com