Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v6Enj-001RWN-QN for pgsql-admin@arkaria.postgresql.org; Tue, 07 Oct 2025 21:00:51 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1v6Enh-003c7x-KM for pgsql-admin@arkaria.postgresql.org; Tue, 07 Oct 2025 21:00:50 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1v6Enh-003c7j-97 for pgsql-admin@lists.postgresql.org; Tue, 07 Oct 2025 21:00:50 +0000 Received: from mail-yw1-x112e.google.com ([2607:f8b0:4864:20::112e]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1v6Enf-000vGD-2g for pgsql-admin@lists.postgresql.org; Tue, 07 Oct 2025 21:00:49 +0000 Received: by mail-yw1-x112e.google.com with SMTP id 00721157ae682-77f9fb2d9c5so56291307b3.0 for ; Tue, 07 Oct 2025 14:00:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1759870845; x=1760475645; darn=lists.postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=jkvyPWFzt/06c2otxz8SJrLIhiVsImcsO24feU12feM=; b=SeCUjcsOleD7ZDKgiEqup8YIhCaU401eO+VaLexYeHrT9QhjibR2WPQ5TEXCWl2/4P Wvf1XAKskNUWryvB89TdLP2WJEYYxqdLgcOfuPnYSkwipgSbM0mSMKgq7SUt7bZHbPOD /r+3EZCFDJyX2Yj8toVyaujF5bw0wKTGzUM6lCx4q2EiaDv+7uzsgvqW3XapOJJiRpxO SPOU2Ht6sBV+T2FgvfjmJ1cN0q3t/tom7Yf9ci76v+n4bQj2NTfkF1dfoDdiUDzImBjy T7fDf4qfMjsORJEe4SQ5lQHyGLb7pcbJywFew5BN7MjLoy7skwNt5ZyjkkHyZHpt4hWb ionw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759870845; x=1760475645; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=jkvyPWFzt/06c2otxz8SJrLIhiVsImcsO24feU12feM=; b=sn0NlRxcwqUYJqaIzWscp9wiaubg24WIZcdmhDajbxkbUVs7V7nucgcvYs1IPQjZGo 0RnOzdAyIkQxZlnVepMJaIzkvele1Nj3kvguxXTe55TnCia6izssXqLTmUoVMLbqGAlz xdjXHos5dzjLhBkD1IE2XIiDHIXYH8wzpz4+rz/PF5Yy7oqEskjuMzPz2PsJtD4Avuk5 dYXgAbEVqG+JarBMl0TM+6OyZesf9KWlRI+AwdwQMaX9nIF/HsvWmgQvX2p+XF8DFTWO TMbtgcdhp3gzZ+YUBZUGFYQPaSQV2DyNd/LiFDDgP9dSJoN7DbLCpZxWw4OkUOxij6G3 lDag== X-Gm-Message-State: AOJu0YyiOE594GnHWPDq0vFlK/p7HzrD6/g0+vOXLYU6bqCih7QwC3SC PKO1T7XcdLIGeMVk4HD4qugTKVbYGjnD44dkw+OoLgHoZP1+rpdxgbCV3Vr9SVU5h0/Op/DtMtw X7VPxgwTBhNUhYF+asPdfz3m52NvUUCid1g== X-Gm-Gg: ASbGncs3qi7/+vWMlOt/B/losobsy+Ll+5r7qtxKxDXX43XzU7/7kVxcTNDvNaQsMFa UTpF+9T46/Qu85MPbyHvAy+wnDQNiZnWHamqCvmFCb6mpf8CfjjKt99o/6Dg5pBXVgT6Gq355xo WnsOeMku/VuASxbrRsrc5/9Q3RDnSVqm66YngpqoBREbDjZmqhfb+tTTxM1CS+8Zdmutaape7dF apDe21+XtvhpuJ8w31KfRgdQEAYAVVh X-Google-Smtp-Source: AGHT+IHo14IF5hjUhnNiidqK2dc6Oqi4bfDXpkBadBerNc7h850SndUK1gNpUH8vZtvu6tr4LEZxRmrvX6LaIj5dhb8= X-Received: by 2002:a53:e947:0:b0:62c:70de:7c9a with SMTP id 956f58d0204a3-63ccb7fc3e7mr843400d50.11.1759870845017; Tue, 07 Oct 2025 14:00:45 -0700 (PDT) MIME-Version: 1.0 From: Matthew Planchard Date: Tue, 7 Oct 2025 17:00:34 -0400 X-Gm-Features: AS18NWCGPR4WOMn481bk9vJCtym3jdpH4qF_EFDv1Ws8PLhFHRDDMrGwAFMAPnI Message-ID: Subject: Dropping index from large, partitioned table To: pgsql-admin@lists.postgresql.org Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk I have a very active table with around 1,000 partitions. I would like to drop a GIN index on one of its columns. Unfortunately, this is a top-level index, and so it seems impossible to drop the indexes on each partition individually, which means a 'drop index' requires holding an access exclusive lock on the entire table until the process completes for all children. That process turns out to be much too slow, since it requires locking one of our most read and written to tables for the duration. In one of our larger environments, I attempted a drop with a two-minute timeout, with no success, and two minutes is really pushing what we're able to do without causing really obvious downtime. I have tried on a local database detaching each child partition, dropping its index, and reattaching it, all within a transaction, but the child index is recreated when the table is reattached. Some additional context is that our production deploys are in RDS, so even with an admin user I am not able to modify the postgres system tables to do things like marking indexes as invalid. Is there any way to manage this without requiring the massive global access exclusive lock for the duration of the drop on every child partition? Thanks!