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 1tTsj6-00Bbt7-Vv for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jan 2025 01:13:17 +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 1tTsj5-006teb-RT for pgsql-hackers@arkaria.postgresql.org; Sat, 04 Jan 2025 01:13:15 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tTsj5-006teT-Gi for pgsql-hackers@lists.postgresql.org; Sat, 04 Jan 2025 01:13:15 +0000 Received: from mail-lj1-x233.google.com ([2a00:1450:4864:20::233]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tTsj3-001yYE-1M for pgsql-hackers@postgresql.org; Sat, 04 Jan 2025 01:13:14 +0000 Received: by mail-lj1-x233.google.com with SMTP id 38308e7fff4ca-303548a933aso106873791fa.3 for ; Fri, 03 Jan 2025 17:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735953191; x=1736557991; darn=postgresql.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=ZI95Q5LHyykwKs/KOCy0yiAd66lblyurkkfPS26ZlDY=; b=I61Jgu1skgKz61BodivsqWpZ4lhGMvnFMJXQeH3OysSbZwocn+N2ucQkAiTJBYYHLi dLpQEc+SFfeDvitFh2wnhgErRBQYLJzAfes9OdMDmg/WyC1f6d0+5KbdXG5xoIByoHZc l5yUEVnpzMT0CfCTJlRNI7r42OnMKGM/BmxN64UCLg2vbidfIDEEY/K7nlFkYAb92MbH tVenDYijoHBs+WtvGqHZ2R8K5BFGGp8o+mwlgJckqk7h/0BMl+PVwQBV1OOqhg66/Ei9 SEbY3lZFyhOIGLrz0iWYf/I8ymda9rC8OHdkJRCOtvQ/FqgLAV0a80aR7wFtQ9L9NFRE sDyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735953191; x=1736557991; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZI95Q5LHyykwKs/KOCy0yiAd66lblyurkkfPS26ZlDY=; b=A4nruO0hl/HlgCyReLOIyxBCSQj1z7WgDSV9+CU4G9+ggD0H3liTVmFj+/cEqbdapI C9s5Zut4IoFqrFxadwKl/+c3rPCwTanDWkBklrg+BG8Ev4//tGd6+qpCb9VR1gcGaov0 hIoKtlJPOOVSLcxtEc0Vm1bqG3Pia6h4Ufx/J4h6W1W1q2ccsC7Jn4l7sqSocpc0SYjZ NDGU73QqFIoDsxsFQXSIR3AFWPpFmycZmntDGYL+Hfzy+jzTJs27ogtSYmhvd4AjAC4o cdJBWoJvvSFKqi2uSgUs4s6q+36OS9TpsJ7vPVIpNWJi3OidD7vFzXeql8mZ/vlhtsqh j0CQ== X-Forwarded-Encrypted: i=1; AJvYcCWUMiRYWZGftzVn5dbFP+4Mh6Qajefxqh4h4Iy5GG/W4m8a9okn/ApavXNAY0ZX1snPmPWqSu4DIK2/jy/p@postgresql.org X-Gm-Message-State: AOJu0YyP2Yxz3X4jAvjlqG25a+hOfFjykN/LRdZBbdk9DirJ/9nSKRG0 chcdigBoH9nMUIzK7j5JKERJ6fzmO4oeuieWm1NtYcYdeuLFEgxd8xGN+vQd/Wtd2fl7Vswe8Ql +A/sd6aOXTlbBsbH2xhgOImH3ZqIt5sPb X-Gm-Gg: ASbGncvvGHMtVCKomv42EwspkKP+yZW4phIfUeDy0UyjiblDan2OefgB6mRaIaoKh/H 1x//S7YlG2R6uABY7nis1BkNhaOamNJ5t3/FNHw== X-Google-Smtp-Source: AGHT+IEUyn+1YNmjnQ+VFk3iKeR9HRUyVtA8eIl2KjS3DWQmaU1/X9cbzjtP7BWSN9dVqn7Zm7Q7JazyuUoH2p+COyI= X-Received: by 2002:a2e:a682:0:b0:302:4115:acd with SMTP id 38308e7fff4ca-304685974e2mr138559791fa.22.1735953191207; Fri, 03 Jan 2025 17:13:11 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: From: Matthias van de Meent Date: Sat, 4 Jan 2025 02:12:58 +0100 Message-ID: Subject: Re: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements To: Michail Nikolaev Cc: Michael Paquier , PostgreSQL Hackers , Andrey Borodin , Melanie Plageman Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, 1 Jan 2025 at 17:17, Michail Nikolaev wrote: > > Hello, everyone! > > I=E2=80=99ve added several updates to the patch set: > > * Automatic auxiliary index removal where applicable. > * Documentation updates to reflect recent changes. > * Optimization for STIR indexes: skipping datum setup, as they store only= TIDs. > * Numerous assertions to ensure that MyProc->xmin is invalid where necess= ary. > > I=E2=80=99d like to share some initial benchmark results (see attached gr= aphs). > This involves building a B-tree index on (aid, abalance) in a pgbench set= up with scale 2000 (with WAL), while running a concurrent pgbench workload. > > The patched version built the index in 68 seconds, compared to 117 second= s with the master branch (mostly because of a single heap scan). > There appears to be no effect on the throughput of the concurrent pgbench= . > The maximum snapshot age remains near zero. Thank you for continuing working on this, these are some nice results. I'm sorry I can't spend the time I want on this every time, but I still think it's important this can eventually get committed, so thank you for your work. > (mostly because of a single heap scan). Isn't there a second heap scan, or do you consider that an index scan? > I am going to continue to benchmark with different options: different HOT= setup, unique index, different index types and DB size (100+ GB). > If someone has some ideas about possible benchmark scenarios - please sha= re. I think a good benchmark could show how bloat is actually prevented, i.e. through result table size comparisons on an update-heavy workload, both with and without the patch. I think it shouldn't be too difficult to show how such workloads quickly regress to always extending the table as no cleanup can happen, while patched they'd have much more leeway due to page pruning. Presumably a table with a fillfactor <100 would show the best results. Kind regards, Matthias van de Meent Neon (https://neon.tech)