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 1o90ca-0005xa-Gm for pgsql-general@arkaria.postgresql.org; Wed, 06 Jul 2022 08:42:56 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1o90cY-0008V1-0M for pgsql-general@arkaria.postgresql.org; Wed, 06 Jul 2022 08:42:54 +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 1o90cX-0008UY-Jr for pgsql-general@lists.postgresql.org; Wed, 06 Jul 2022 08:42:53 +0000 Received: from mail-ed1-x52f.google.com ([2a00:1450:4864:20::52f]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1o90cV-0004fw-2n for pgsql-general@lists.postgresql.org; Wed, 06 Jul 2022 08:42:53 +0000 Received: by mail-ed1-x52f.google.com with SMTP id r6so6913475edd.7 for ; Wed, 06 Jul 2022 01:42:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:content-transfer-encoding:mime-version:subject:message-id:date :to; bh=1p71WUczdtrKqDWElc+DVbQQBqUcf0o/CJ4u/9baqIQ=; b=O+WODO41nS/xbNi4MljiwJXmr7ooswlldsFlTx28jTnjqXACrUq3e+q6ChZ8WRkdQ3 z6J3OUGXq4Y58Yl0vsfKnj4gDGPRZd+JG4ny/y1VTTAPdJJBxQzZecfvX9iU+0v0cKXZ o5rCIqqu3sozFVCfo1uRdrHfhp/TU2Lk16XQ8mBLUngvN1NYz7OCQ5TYjOPawV7Y/hQY EB3YkBrVRz1f31QZ1ZXRHrOxcBIEWpv8+yD8OfRRGv8dlxMTnXpfCh0xA/e84z+DJ7zK XDyJuz1J0Vq4dVxMULuHmkxdcAptOVe8YhZqAWaUfxkIHG+wlexktl++AEgydNrOS17j lA+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:content-transfer-encoding:mime-version :subject:message-id:date:to; bh=1p71WUczdtrKqDWElc+DVbQQBqUcf0o/CJ4u/9baqIQ=; b=oiLvhRe78GWNAedXMpkpRhc1qEpalzz2HK4P2VHAeAqe2+TcPGYDxcRyYhpNK15fhi 48jbOG6lUS72peJznFOTaNRfr8tnwGhwAfj9ozOGvlodYZklwE2T46Jge2iZlWEhpsTU tJ+M9Gl/A0vQoLGzMiVPWOrYl/ovqoAvuEY+Ppp6PApIt1Dvpk3qgfVptbckfY0BDxjl YFNTWc5bhHyIVS/+TBbv562g8vDchOjY5dQZU3nF1LJd19ModT4cZK9OkxA51t94j6Tm Q4t7ejbQT3Qh4gPjfG4ow+2JxvAPXxPi8e5lxX8/mcVuxoOq1dlkqNSlVH3O7RzLMxoD FCYQ== X-Gm-Message-State: AJIora9FhJp6HLrR9AxhRVNZSSxhmvOYhUBXmpG06pXoOCSHngfMiY9l ww08XpVwksyzmdRa80ejVB9+td4TEfcCDg== X-Google-Smtp-Source: AGRyM1tYWYJ8XrU0C7bQiolV2WL7LJViHerx+Qzc6ILJPflve1L1Wtsy+6BatahoM6EaK8Nx9RMV3w== X-Received: by 2002:a05:6402:5508:b0:43a:896e:8edd with SMTP id fi8-20020a056402550800b0043a896e8eddmr2853578edb.203.1657096969745; Wed, 06 Jul 2022 01:42:49 -0700 (PDT) Received: from smtpclient.apple (ppp-94-66-221-5.home.otenet.gr. [94.66.221.5]) by smtp.gmail.com with ESMTPSA id g1-20020a170906538100b0072a55ebbc77sm8989709ejo.66.2022.07.06.01.42.49 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 06 Jul 2022 01:42:49 -0700 (PDT) From: Florents Tselai Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 16.0 \(3696.100.31\)) Subject: ADD COLUMN ts tsvector GENERATED too slow Message-Id: <03C74523-7947-42CA-8392-B7CB8EFC16D2@gmail.com> Date: Wed, 6 Jul 2022 11:42:47 +0300 To: pgsql-general X-Mailer: Apple Mail (2.3696.100.31) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I have a beefy server (40+ worker processes , 40GB+ shared buffers) and = a table holding (key text, text text,) of around 50M rows. These are text fields extracted from 4-5 page pdfs each. I=E2=80=99m adding the following generated col to keep up with tsvectors=20= ALTER TABLE docs_text ADD COLUMN ts tsvector GENERATED ALWAYS AS = (to_tsvector(=E2=80=99simple', left(text, 1048575))) STORED=20 I expect this to be slow, but it=E2=80=99s been running for 18hrs = already and I certainly hope I=E2=80=99ve done something wrong and = there=E2=80=99s a smarter way. I thought about incremental updates and/or triggers but a generated col = is a cleaner solution.=