Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9twi-0003RT-DT for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Mar 2019 16:01:32 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1h9twh-0000e0-6s for pgsql-hackers@arkaria.postgresql.org; Fri, 29 Mar 2019 16:01:31 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9twg-0000dp-QS for pgsql-hackers@lists.postgresql.org; Fri, 29 Mar 2019 16:01:30 +0000 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1h9twe-0003Mn-33 for pgsql-hackers@lists.postgresql.org; Fri, 29 Mar 2019 16:01:30 +0000 Received: by mail-io1-xd30.google.com with SMTP id v10so2143961iom.8 for ; Fri, 29 Mar 2019 09:01:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=5P+ECmgWkl3uUMDAIYNQlJZIsdbQBQ9Bo5zTWa0thvY=; b=D9xP7jkwUPeUWh0txT+fz4HmmpjamPa4VfUxprkiHgpST4B17WgMbeKmdctOynpv1K q/zg+BIa37PgFSuhG9wJ89V5xYwHw3ZQBMLrVNktVkZlQwaDs+huCnmnZv1/q9qBIUj9 IGw8V8nsN6h1Zdm9eT1AjRrPsYoaxUNQM/sNV2Cm8k7qL+MHsCE4DqM7hMqISxe72R6G 4/2Ir9JLFtuwleZufKLUnAL0LpJ788CQBV5iIvb7DN9SPuR8fc2M/oz+YBBw57SDqnvh 7zmYvbyWhjQyd8V0tz5tCkWQRkdD2JC+tV10waw0TAT4p8tDVnkGE701yFUvsKJ10txo kx1Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=5P+ECmgWkl3uUMDAIYNQlJZIsdbQBQ9Bo5zTWa0thvY=; b=epr17+JbXI4MIxhdZk8GppKsJGvLAQ9CU9eVyu99gF1D/GtjvNOEdzx50VWfhowzQI o7kKn2YuQNOS+20fqygRTpMmueLIGM8EGJv7WyvNl8JDSoEBo4unQVgvzbp7DOzq8elK wodwxydF6Rm02wD++RKKA0vPArPPoZhu3OASOp2GsqNhFvk9+FJNj7JXwOfz9ULwY7EO ERioIkSCjyYqz1AC9PTAPE0PwHEtu3dcLr5UoXpxnwJSEMkK666chUDt8+nFwUtnRkmJ zPqZRDxCgIYD3ijYO+p+NwJ5VE4N9yKWlEgN2Y1XETmCESffaajB/vP88tJKaCJmTnKC 7MzA== X-Gm-Message-State: APjAAAXcI28jzbiEc4kD2hKIcz43ZOysFHa0dE6KSqUHqvj0fbLobxCT 2q66KkqyjocUpuNDSofW7nJxoA== X-Google-Smtp-Source: APXvYqyEqEWL5BgcTlx4iSkUVRalOqJiiyQMpBHcb+oupK4KJPxQ9Zb2qY6NCKJ/IG9nikdaPMT4lQ== X-Received: by 2002:a6b:3f86:: with SMTP id m128mr16881116ioa.275.1553875286175; Fri, 29 Mar 2019 09:01:26 -0700 (PDT) Received: from pryzbyj (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id d195sm1229174itc.21.2019.03.29.09.01.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 29 Mar 2019 09:01:25 -0700 (PDT) Received: by pryzbyj (Postfix, from userid 1000) id 18FE9800BA5; Fri, 29 Mar 2019 11:01:23 -0500 (CDT) Date: Fri, 29 Mar 2019 11:01:23 -0500 From: Justin Pryzby To: "Bossart, Nathan" Cc: Andres Freund , Robert Treat , Peter Eisentraut , Sergei Kornilov , "pgsql-hackers@lists.postgresql.org" Subject: Re: REINDEX CONCURRENTLY 2.0 Message-ID: <20190329160122.GJ5815@telsasoft.com> References: <154954968565.11785.6973123402105637191.pgcf@coridan.postgresql.org> <1730471552486423@myt1-cd60b8ae9bb9.qloud-c.yandex.net> <3b33640c-5493-4eea-fd5f-71d37626fe2f@2ndquadrant.com> <1907751553367887@myt6-23299ba78d64.qloud-c.yandex.net> <64744529-d34e-9aae-e7e3-e2263c24fb3b@2ndquadrant.com> <7380711553760479@iva5-0acfc31d2b43.qloud-c.yandex.net> <13fb3e06-3b66-e878-26d8-0d77e7d50160@2ndquadrant.com> <20190329154803.gfb4rvmflbniheh3@alap3.anarazel.de> <55DE37D6-984F-4EFE-9D5E-521906D8F032@amazon.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="oJ71EGRlYNjSvfq7" Content-Disposition: inline In-Reply-To: <55DE37D6-984F-4EFE-9D5E-521906D8F032@amazon.com> User-Agent: Mutt/1.5.23 (2014-03-12) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk --oJ71EGRlYNjSvfq7 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline On Fri, Mar 29, 2019 at 03:53:05PM +0000, Bossart, Nathan wrote: > I noticed a very small typo in the documentation for this feature. I submit a bunch more changes for consideration, attached. --oJ71EGRlYNjSvfq7 Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="v1-0001-Doc-review-for-REINDEX-CONCURRENTLY.patch" From dafdb15fb3e7c69de82a2206c9bf07588b5665ce Mon Sep 17 00:00:00 2001 From: Justin Pryzby Date: Fri, 29 Mar 2019 10:59:59 -0500 Subject: [PATCH v1] Doc review for REINDEX CONCURRENTLY --- doc/src/sgml/ref/reindex.sgml | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/doc/src/sgml/ref/reindex.sgml b/doc/src/sgml/ref/reindex.sgml index ccabb33..e05a76c 100644 --- a/doc/src/sgml/ref/reindex.sgml +++ b/doc/src/sgml/ref/reindex.sgml @@ -300,11 +300,11 @@ REINDEX [ ( VERBOSE ) ] { INDEX | TABLE | SCHEMA | DATABASE | SYSTEM } [ CONCURR - A new temporary index definition is added into the catalog + A new temporary index definition is added to the catalog pg_index. This definition will be used to replace the old index. A SHARE UPDATE EXCLUSIVE lock at - session level is taken on the indexes being reindexed as well as its - associated table to prevent any schema modification while processing. + session level is taken on the indexes being reindexed as well as their + associated tables to prevent any schema modification while processing. @@ -312,7 +312,7 @@ REINDEX [ ( VERBOSE ) ] { INDEX | TABLE | SCHEMA | DATABASE | SYSTEM } [ CONCURR A first pass to build the index is done for each new index. Once the index is built, its flag pg_index.indisready is - switched to true to make ready for inserts, making it + switched to true to make it ready for inserts, making it visible to other sessions once the transaction that performed the build is finished. This step is done in a separate transaction for each index. @@ -322,7 +322,7 @@ REINDEX [ ( VERBOSE ) ] { INDEX | TABLE | SCHEMA | DATABASE | SYSTEM } [ CONCURR Then a second pass is performed to add tuples that were added while the - first pass build was running. This step is also done in a separate + first pass was running. This step is also done in a separate transaction for each index. @@ -331,10 +331,10 @@ REINDEX [ ( VERBOSE ) ] { INDEX | TABLE | SCHEMA | DATABASE | SYSTEM } [ CONCURR All the constraints that refer to the index are changed to refer to the new index definition, and the names of the indexes are changed. At - this point pg_index.indisvalid is switched to + this point, pg_index.indisvalid is switched to true for the new index and to false for - the old, and a cache invalidation is done so as all the sessions that - referenced the old index are invalidated. + the old, and a cache invalidation is done causing all sessions that + referenced the old index to be invalidated. @@ -349,7 +349,7 @@ REINDEX [ ( VERBOSE ) ] { INDEX | TABLE | SCHEMA | DATABASE | SYSTEM } [ CONCURR The old indexes are dropped. The SHARE UPDATE - EXCLUSIVE session locks for the indexes and the table ar + EXCLUSIVE session locks for the indexes and the table are released. @@ -359,8 +359,8 @@ REINDEX [ ( VERBOSE ) ] { INDEX | TABLE | SCHEMA | DATABASE | SYSTEM } [ CONCURR If a problem arises while rebuilding the indexes, such as a uniqueness violation in a unique index, the REINDEX - command will fail but leave behind an invalid new index on top - of the existing one. This index will be ignored for querying purposes + command will fail but leave behind an invalid new index in addition to + the pre-existing one. This index will be ignored for querying purposes because it might be incomplete; however it will still consume update overhead. The psql \d command will report such an index as INVALID: @@ -387,7 +387,7 @@ Indexes: Regular index builds permit other regular index builds on the same table - to occur in parallel, but only one concurrent index build can occur on a + to occur simultaneously, but only one concurrent index build can occur on a table at a time. In both cases, no other types of schema modification on the table are allowed meanwhile. Another difference is that a regular REINDEX TABLE or REINDEX INDEX @@ -406,7 +406,7 @@ Indexes: concurrently. If such an index is named directly in this command, an error is raised. If a table or database with exclusion constraint indexes is reindexed concurrently, those indexes will be skipped. (It is possible - to reindex such indexes without the concurrently option.) + to reindex such indexes without the CONCURRENTLY option.) -- 2.1.4 --oJ71EGRlYNjSvfq7--