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 1lPql2-0005sv-Gk for pgsql-admin@arkaria.postgresql.org; Fri, 26 Mar 2021 18:00:28 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lPqkz-0004Ib-5a for pgsql-admin@arkaria.postgresql.org; Fri, 26 Mar 2021 18:00:25 +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 1lPqky-0004IS-S3 for pgsql-admin@lists.postgresql.org; Fri, 26 Mar 2021 18:00:24 +0000 Received: from mail-ej1-x633.google.com ([2a00:1450:4864:20::633]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lPqkw-0003Fn-2A for pgsql-admin@lists.postgresql.org; Fri, 26 Mar 2021 18:00:23 +0000 Received: by mail-ej1-x633.google.com with SMTP id ce10so9711738ejb.6 for ; Fri, 26 Mar 2021 11:00:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=pdyL2ysUpqv5fdLD0HKCc0oK9aKvpdxdkRGVChlHsZc=; b=KPoTvmVadSUSRR9tZjEA+9JMSPRTInDNG0SW9fmGeYR0SQO5P1SWZkwzN25eI+qx0Q IaeFzvml4JNRVP+1TQab95M2+WUDP9wmhHiFMU29p2P6ZI+ksMIHOx9QlXOuEqmi4wlq 7zB9uvjJkbevRLdbMqVcSKEJ2z6I5vjxB4SCk60zcI3Yw/DJlbu7lrXfQEViP8LF66aa dGFPWs7CNg/tnbWFG5Vjlx2D6pzWtJ/XcaRPlVX45Fcan9/rVF0DL4iQQ5K7tzJfltOl KUWe76PwxOP5HtU9bjhid/loFpw9eQvVtU1LkPS8/XObBtQayf6oGw4CvJuJpx5Qwr3/ zwng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=pdyL2ysUpqv5fdLD0HKCc0oK9aKvpdxdkRGVChlHsZc=; b=mhYq+jIsGX71ZP93xuRp6UWqb8GRBvJUO63k/L5CU5VrdwUrBx1fSACcyYuYcM0hZJ aGiADM+y6CWYTzox4NIhQqcIFVazN1tZ9fLjCsqf8Y9CKK1PsD1PO0SWjv9dADyqn1hy rjuhhYp/Z1IM8Bl3t/S0XvXdvTgqJsZz74Ah/Qf5Qlpmu2j85iK5emaUAeWoeVcegSlP qlkhrmiWkBocI6M+SFZK7ZPtmIvtEOrQYcCpfil+ezoT2bM4LNIv/dtB7TOOPG7bXlmB NoneVZ/8VV/i7SkjF22yWWfmgUJHITFaDqfegCI1lv1DM5tc8NRJTmJiJqq23/7OHxl4 Ljkg== X-Gm-Message-State: AOAM530njb0ik+IY5tt4t9vkMeV/0De8oOikj3tTPa96ZWMdwotIjw7y y74p9OHtDaflkhpg6LkLW1DCCFFBSYNeRfK3bEDlvpKcoY9mTA== X-Google-Smtp-Source: ABdhPJxtuZZIhsjCSXgoYU7Os1A/ar3cGetEGw+R7Pu2XSrukz+gWumas2ooEqHLN6rFeZPrqDQu4QXjFzVY2EOMDL0= X-Received: by 2002:a17:906:86c6:: with SMTP id j6mr16080778ejy.197.1616781619606; Fri, 26 Mar 2021 11:00:19 -0700 (PDT) MIME-Version: 1.0 From: Jacque Edmund Date: Fri, 26 Mar 2021 14:00:08 -0400 Message-ID: Subject: Native Foreign Keys housekeeping time intensive for Relational Model To: pgsql-admin@lists.postgresql.org Content-Type: multipart/alternative; boundary="0000000000001db8d905be744ebd" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --0000000000001db8d905be744ebd Content-Type: text/plain; charset="UTF-8" I'm looking at a herculean project before me. 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. That same underlying vetting is performing a lot of "SELECT 1" statements across the related tables and its squeezing timelines. I have indexes on all the requisite columns participating in FKs. I don't think theres another way of speeding up lots of row DELETEs from the particular way I have the relationship implemented and I'm denying myself the "set session_replication_role = 'replica'" method so that I can be fully operational without the postgres userid (aka portable to cloud environments). Correction. Actually, I'm thinking I can take out the system implementation of FK's and use constraint triggers instead. That way I'd get to relax the triggers and gut the vetting that, with my wield relationships and data, is time intensive. Maybe even keep postgres as the owner of the constraint triggers so they can't be hacked by app users. I'm guessing that, while not often, this approach happens to folks every now and then? --0000000000001db8d905be744ebd Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
I'm looking at a herculean project before me.=C2=A0 = =C2=A0

I've already seen that my current set of= FK relationships between < 100 tables and data footprint has yielded ve= ry large lookup times for the underlying referential integrity of the FKs t= o vet whether it can DELETE a row or not based on its FK relationships.=C2= =A0 That same underlying vetting is performing a lot of "SELECT 1"= ; statements across the related tables and its squeezing timelines.=C2=A0= =C2=A0

I have indexes on all the requisite c= olumns participating in FKs.=C2=A0 I don't think theres=C2=A0another wa= y of speeding up lots of row DELETEs from the=C2=A0 particular way I have t= he relationship implemented and I'm denying myself the "set sessio= n_replication_role =3D 'replica'" method=C2=A0so that I can be= fully operational without the postgres userid=C2=A0(aka portable to cloud = environments).

Correction.=C2=A0 =C2=A0Actually, I= 'm thinking I can take out the system implementation of FK's and us= e constraint=C2=A0triggers instead.=C2=A0 That way I'd get to relax the= triggers and gut the vetting that, with my wield relationships and data, i= s time intensive.

Maybe even keep postgres as the = owner of the constraint=C2=A0triggers so they can't be hacked by app us= ers.

I'm guessing that, while not often,=C2=A0= this approach happens to folks every now and then?


--0000000000001db8d905be744ebd--