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 1lD20n-0003Oj-Hy for pgsql-admin@arkaria.postgresql.org; Fri, 19 Feb 2021 09:23: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 1lD20l-0002AI-D0 for pgsql-admin@arkaria.postgresql.org; Fri, 19 Feb 2021 09:23:43 +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 1lD20l-0002AA-1k for pgsql-admin@lists.postgresql.org; Fri, 19 Feb 2021 09:23:43 +0000 Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lD20g-0007H7-Kd for pgsql-admin@lists.postgresql.org; Fri, 19 Feb 2021 09:23:42 +0000 Received: by mail-ed1-x535.google.com with SMTP id h10so8577602edl.6 for ; Fri, 19 Feb 2021 01:23:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cybertec-at.20150623.gappssmtp.com; s=20150623; h=message-id:subject:from:to:date:in-reply-to:references:user-agent :mime-version:content-transfer-encoding; bh=Gi4M6oZk2OM0y8psmMkWkt8NCE0lpYruDBhhd9aYT4M=; b=htIEZHd/7Uq2YqIlwjWn55GKea1hNMmEslOClDyOGsjepxdUDwTcJdNASqvy3L6H5t Oypby9O4h9HzQo52e7Ro41zaseHUhjb+chJ0VGR2va8u5Jq1rBi6hRooXmCHddRDpSAl 0FZdfr0M36qfAAtKdYRrAg14/lBK0ZT1SNj+Eu+OQ3xgzwGEAftHwP5OfPLouw8CIr/J 2mHMqrWToLg2dFqc1YR+ymf/5ldlgLBCS2jIyYNaCqtC4iZzZIM87upXT2t8dQqJgfj2 ui5zOApgcwJS2Fj42B2guNTRJdIKJEg21qomkLVT5kALhjSrcu0kyFuPsnRuGCg4VFPY 0Dug== 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:date:in-reply-to :references:user-agent:mime-version:content-transfer-encoding; bh=Gi4M6oZk2OM0y8psmMkWkt8NCE0lpYruDBhhd9aYT4M=; b=V+IvxqbOyEx3piqVqlcSaKvSMLfRhPY9w/WgzVNCHSoO/ZbXDRvbB6m2Sr8qW27x2G 4ZQNE1nRCOdsOUQXf88Fy8bShZLs/yvy2EKeKwq/rbjued3NrZ9oHuiHVyio0yR8oCRQ TrimkWINtT6nIfy+Ub4MwYkQoipXkHTAQfLxF2tsIMLQcU354771mM6nEKOq8jRZ20uw 9Z4+gEpx/rUKB5nIjPTdDUBc4rvJkIiqJ21vqnbQzke25PxA7umaW/R9djhn6AvY6ez7 BFNG1rjDJCfqUgiq1pk/o4zxsug/DZgAEKzHQB5yKILWWUJR7U6zoTts2LNqnm5nFJYF hzpA== X-Gm-Message-State: AOAM531DopQfbRVWOUMxAo1X799/fUXSMgMXOlLrTYamdGiDT0OmlYSN 1Jsvsv3aU/w4qAbJhyj3xy5bzw== X-Google-Smtp-Source: ABdhPJx6d1ee3fkwew+4A1/ZpgmKnbmLBwGwMI2H6PIbDvRgIQaMj9j9Al1VVW0ukjRqA0dafXmkLQ== X-Received: by 2002:a05:6402:1688:: with SMTP id a8mr8216494edv.227.1613726617280; Fri, 19 Feb 2021 01:23:37 -0800 (PST) Received: from localhost.localdomain (217-149-173-224.nat.highway.telekom.at. [217.149.173.224]) by smtp.gmail.com with ESMTPSA id r4sm4541540edv.27.2021.02.19.01.23.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 19 Feb 2021 01:23:37 -0800 (PST) Message-ID: <66028fd5cc301f5726d759e46903f88f8c18217f.camel@cybertec.at> Subject: Re: Disabling indexes on a table From: Laurenz Albe To: John Scalia , Pgsql-admin Date: Fri, 19 Feb 2021 10:23:36 +0100 In-Reply-To: <8D9636C9-D38E-4857-A542-1469A11A25FF@gmail.com> References: <8D9636C9-D38E-4857-A542-1469A11A25FF@gmail.com> 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: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, 2021-02-18 at 11:24 -0500, John Scalia wrote: > One of my developers asked me about this, and he suggested running the following update: > > UPDATE pg_index SET indisready=false > WHERE indrelid = (select oid from pg_class where release = ‘his_table’); > > I told him it’s never a good idea to update anything in a system catalog by hand, > but that I would reach out here for a better opinion. Am I correct that he > shouldn’t try this, or is he OK to do this? His table has approximately 8 > different indexes on it, and those really slow down his bulk loads. > Usually when I have to get involved, I just drop his indexes and rebuild > them afterwards, and I know that is always safe. https://www.postgresql.org/docs/current/catalog-pg-index.html says: indisready bool If true, the index is currently ready for inserts. False means the index must be ignored by INSERT/UPDATE operations. So that would indeed speed up a bulk load, but your indexes would be unusable afterwards. If you run a second update to "pg_index" to set "indisready" to TRUE, you would end up with corrupted indexes. The indexes will be useless and can only be dropped. So you are right that that is not a good idea. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com