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 1lfshB-0004oR-N5 for pgsql-admin@arkaria.postgresql.org; Sun, 09 May 2021 23:18:45 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lfshA-0006Vx-Jr for pgsql-admin@arkaria.postgresql.org; Sun, 09 May 2021 23:18:44 +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 1lfshA-0006Vp-7u for pgsql-admin@lists.postgresql.org; Sun, 09 May 2021 23:18:44 +0000 Received: from mail-qk1-x72d.google.com ([2607:f8b0:4864:20::72d]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lfsh8-0002S4-7N for pgsql-admin@postgresql.org; Sun, 09 May 2021 23:18:43 +0000 Received: by mail-qk1-x72d.google.com with SMTP id x8so13797105qkl.2 for ; Sun, 09 May 2021 16:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:date:subject:message-id :to; bh=5apBUpFXhB1Wh1MEgoMpZBSRV7HSzoHD6ToJHW1edbY=; b=fxn41FEbUoa6bg8ToF4UDr6ZDwbmkmuJ5JTE1Is0bTTAqyrbj58+py8RIcM30A+GGB xGNaQJSXrGv5Q3A/Gcz55XzdJrHQKYoflP93N7dGxmWV5FZr0v/HYka1uH9+SX2Pg83y A7P/8/a8JPc5DmN45ELlJUdggVQZ6uY5elN5vPCpzj2XcNK3JNeBNBFEDEXQEmlMQePy RqglcRhST/ELLY9NjAY+in8Rb9zWjolPYbIrye6riRcesnP+c2mytgeAyFezNbNt7kvf /2JxCDHCoYU+nJOxdAT1Wv6omKLrSwxDFWl8lYxtegkWL0OWwJ9YRVyAJxZt7IQb8P0g yNPQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version:date :subject:message-id:to; bh=5apBUpFXhB1Wh1MEgoMpZBSRV7HSzoHD6ToJHW1edbY=; b=kurBmoIR83VAmMU3f7hbCrnve17rrrfaUP4x8/1COhIGqtkU6RooFkn+dODx6a3TA3 M3J9itKXNGfi3b65mvsy1pmiWKFScFfEHtmocfLsLjYKwv4f24vrjEKLuGuU9zqY7feO K6qsnR8o6+/jCLCtV2ZR0Xo6WjmLBZe/VyQSr9mNCl1x++GYNUpHDKUmF0fzGv0rDbMr zbm8FOJrW7Y09wTmfOuQU7QEpzvYy7RSW7NcUZYKcjHeamVyi2PDBocoXNfvfMu6/jyx Udi7WOHe6PwmzX9D7iPgHvy9pTQjBoojjDM9HRL8xnq9DtywHM9eyDvvK5N+TskWcvZp cYPQ== X-Gm-Message-State: AOAM532WQ0JIKv34H3NzFSZThPwbrY9tgU9F9JlRFQyIVdiorTMtzNZ0 M+sBxBozCjpjV20edCn3yij7hRRfDhE= X-Google-Smtp-Source: ABdhPJyAqaO4Pf1RjDwD9GVLbMEAcQyp7R32SxIn48DsUR2jCkIPd333AELnDfFs35u5IywwhiAgaw== X-Received: by 2002:a37:7f01:: with SMTP id a1mr21180319qkd.219.1620602319967; Sun, 09 May 2021 16:18:39 -0700 (PDT) Received: from [192.168.0.6] (75-109-90-86.nlsncmtc01.res.dyn.suddenlink.net. [75.109.90.86]) by smtp.gmail.com with ESMTPSA id m190sm9999041qke.107.2021.05.09.16.18.39 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 09 May 2021 16:18:39 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: John Scalia Mime-Version: 1.0 (1.0) Date: Sun, 9 May 2021 19:18:38 -0400 Subject: Technical guidance for a large partition table Message-Id: To: pgsql-admin X-Mailer: iPad Mail (18D70) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hi all, I have a dev team requesting that I partition 3 very large tables with more 2= billion rows each. I=E2=80=99ve already got the partition key decided for e= ach with a script which will create a copy of original with the partition de= claration, along with the partition child tables. The problem will be that e= ach table has an API which updates each table fairly regularly, and the devs= say it cannot be turned off. So, I=E2=80=99m looking for the best way to do= this so that the partitioned version will match the original table. FYI, th= is is production instance that is regularly updated by field technicians. Qu= ite literally, I cannot perform two sequential select count(*) from any of t= hese tables which will return the same row counts. I=E2=80=99m thinking of i= nstalling a trigger on insert on the original tables, which would write any i= nsert to a third table, then copy the original table to another table name, d= o the partitioning on it to yet another table name, move the partition table= into the original table name, kill the trigger, then apply the updates from= the table where the insert trigger was being applied. Is there a better way= to do this, or am I missing something? =E2=80=94 Jay Sent from my iPad=