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 1rEDXH-004cfR-ER for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Dec 2023 19:07:47 +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 1rEDXG-004ljZ-6V for pgsql-hackers@arkaria.postgresql.org; Fri, 15 Dec 2023 19:07:46 +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 1rEDXF-004ljQ-SY for pgsql-hackers@lists.postgresql.org; Fri, 15 Dec 2023 19:07:45 +0000 Received: from mail-ej1-x631.google.com ([2a00:1450:4864:20::631]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rEDXD-00CB2l-9U for pgsql-hackers@postgresql.org; Fri, 15 Dec 2023 19:07:45 +0000 Received: by mail-ej1-x631.google.com with SMTP id a640c23a62f3a-a22ed5f0440so135116266b.1 for ; Fri, 15 Dec 2023 11:07:43 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1702667261; x=1703272061; darn=postgresql.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=lh7GzRWnNMQ+20N1aXGjKunGunnpzPyO7yknefnhPgo=; b=jo2DuaU5g0WAfBqHMiFqDc5HpOXEESU0YGLQ3Q3gpIenB2XpEw+OUINglTnrb29teY qWYVAUhbE64fnjas8oXAlwEBZpaX5ILs7q5r+0pZlxN7WqvsJo2Rd04jStEgvAtwNH9Y Avw5IkCgM+D+AxfQcn39zFKZlRCm8uxYPkOGNpIk79kBh47kDUKfCenGW9YwssvJCs3r 5gW6CTOHEKkiDvgMG9f5ifW5nHs0uKCTk5AbQBsftgis89nWwewodWPv6ZjtMGm56by8 vL4JxQhSmHtPV7JU+7ZLzi3Q0cXBdtb4gQyiyfgjqJR6LDW8MWqwk5lHDzGG09u5BfuE oYVA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702667261; x=1703272061; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=lh7GzRWnNMQ+20N1aXGjKunGunnpzPyO7yknefnhPgo=; b=GFmty+pYUyjkfooRzsmVzxQgRQDStf7dH2D4qiGctu1imi8byqyMtn/M9sQ8H5gIsd 125cthAircUKRrrSNUHeydr9WqFRCaN6wzQasvFii0ktCND1KhurwMjy693+ededmPGM fVY5NvD5K6OECgh9zh3MFHG/mrOaXMzgfWx4YDUCn/BOi9cwMeTqk5XF7XxGRdBAr6k+ +1gpO2JNCel6aaHmaZAMJZTAF21JP5EjfgASF6jpffhySKenSZH0ay/0+8Kqns2T4qI5 8I9C3UOYOvkPJhNnpwcynz+abIo7gz/2kMR+3WZJt5JqOScHyx0PWlREMqTdtRIj3nie hk1g== X-Gm-Message-State: AOJu0Yx+nuevUjv8tiYVvTUkS73KmK8HnPe5cdFyfIdyPRi3xPXZqZhg qeN0T7Rbn+dZV/rcJwBRzlDzIHPQjDONCdiMc5oYyVOeyF8= X-Google-Smtp-Source: AGHT+IEg8u5+hqy7SmqAIPBy30IGlnx4IKKzPgopMmF9YoeloVdFQYJeD3B89BxBNTLZMh2XENbetHHh+dY1CWQIqQI= X-Received: by 2002:a17:907:2d12:b0:a19:9b79:8b45 with SMTP id gs18-20020a1709072d1200b00a199b798b45mr6068773ejc.86.1702667261291; Fri, 15 Dec 2023 11:07:41 -0800 (PST) MIME-Version: 1.0 From: Michail Nikolaev Date: Fri, 15 Dec 2023 20:07:29 +0100 Message-ID: Subject: Revisiting {CREATE INDEX, REINDEX} CONCURRENTLY improvements To: PostgreSQL Hackers , Alvaro Herrera Content-Type: text/plain; charset="UTF-8" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Hello, hackers! I think about revisiting (1) ({CREATE INDEX, REINDEX} CONCURRENTLY improvements) in some lighter way. Yes, a serious bug was (2) caused by this optimization and now it reverted. But what about a more safe idea in that direction: 1) add new horizon which ignores PROC_IN_SAFE_IC backends and standbys queries 2) use this horizon for settings LP_DEAD bit in indexes (excluding indexes being built of course) Index LP_DEAD hints are not used by standby in any way (they are just ignored), also heap scan done by index building does not use them as well. But, at the same time: 1) index scans will be much faster during index creation or standby reporting queries 2) indexes can keep them fit using different optimizations 3) less WAL due to a huge amount of full pages writes (which caused by tons of LP_DEAD in indexes) The patch seems more-less easy to implement. Does it worth being implemented? Or to scary? [1]: https://postgr.es/m/20210115133858.GA18931@alvherre.pgsql [2]: https://postgr.es/m/17485-396609c6925b982d%40postgresql.org