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 1hhwiH-0006nM-8H for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Jul 2019 13:51:21 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1hhwiG-0001zr-49 for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Jul 2019 13:51:20 +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 1hhwiF-0001vJ-QW for pgsql-hackers@lists.postgresql.org; Mon, 01 Jul 2019 13:51:19 +0000 Received: from mail-qk1-x744.google.com ([2607:f8b0:4864:20::744]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hhwiC-0006zZ-Jj for pgsql-hackers@lists.postgresql.org; Mon, 01 Jul 2019 13:51:19 +0000 Received: by mail-qk1-x744.google.com with SMTP id d15so11003482qkl.4 for ; Mon, 01 Jul 2019 06:51:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=2ndquadrant-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :content-transfer-encoding:in-reply-to:user-agent; bh=Brt/63km7uFVda/qULj7yAXLtjLGuyu/f1GtFWakD9M=; b=b07EwQp/v9RTPoADAA1hX8xacE7nmyT8I0Wn5DqY6yPqwelieUH91RV1d6eALNOFv6 +g/+VSUcaEoLrRBCAw2XRz5ETRmPvYk6fJpYqrUr7xDfBqrllTNk8wc6rPDwKnLCIkAv TAoIwBiSWC55uK2I/kqwBAhO4MLTQjd+W8GkdUToicw7Olu4scX3Km18Je4mcWuOzTtY DslcaVX1V4G1ZqckVnkcaYTHwD8AsAXDWraNJTIvYuizZakGeQvPXHVPY1gRd4tRy9BA 8UBsE+za4gpTmZDrw1a1V0CqJk1OCyqE9ol1ubXwpNquV7pD4iRkNTd1WCXXs+KC0P7f vzhQ== 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:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=Brt/63km7uFVda/qULj7yAXLtjLGuyu/f1GtFWakD9M=; b=lQY2TfgCEIIVxKr6gsojVItiqs1Vcx6IdINItfJpax4HRxTryQOJIyADZ/GsrFo+dV dIMLxLvsVTCXgfdu4Y5qDc242Y7FJDrHX192bo4TdCbj0ZgriGvX/ukRAzHg/oZHUMGk wfdAHqjZENcOno/FR0j8rOVCCjOJuB+YlT6WEWW+2B7JbH9EodZt/kMsxEGH+EPJSqYO C70giNk23tZMPBYlRIG3EOmrTC/q+54JPxsXDtLtudtFUtcDJOkQEB+IJ65r2R2vhyZD rEZQjrqt1BEIvp/hrOC/QyD/e+PVBGTRz+za91J/fa1YX8Z+dOnKAOyD+5kvlqL4AkG/ vr+g== X-Gm-Message-State: APjAAAWOpsCSt5WEtvyS6TtnUcZaskfQqvUUIrXHLiEkTm9w67gnkZhR 8uWY91PHpKrqZnzt/MaUBiVjaw== X-Google-Smtp-Source: APXvYqyTkj/mNT9WYJa0UpFTjXlB65x6cTcRIye0I9eTFwHKt0+8E73jVV0PbjsWgVBvbrNUbigVIw== X-Received: by 2002:a37:948:: with SMTP id 69mr19813951qkj.465.1561989074564; Mon, 01 Jul 2019 06:51:14 -0700 (PDT) Received: from nimloth.alvh.no-ip.org ([190.121.29.3]) by smtp.gmail.com with ESMTPSA id j19sm4487859qtq.94.2019.07.01.06.51.13 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 01 Jul 2019 06:51:14 -0700 (PDT) Received: by nimloth.alvh.no-ip.org (Postfix, from userid 1000) id 3BE97120AC7; Mon, 1 Jul 2019 09:51:12 -0400 (-04) Date: Mon, 1 Jul 2019 09:51:12 -0400 From: Alvaro Herrera To: Michael Paquier Cc: Julien Rouhaud , PostgreSQL Hackers , Kevin Grittner Subject: Re: Add parallelism and glibc dependent only options to reindexdb Message-ID: <20190701135112.GA6750@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20190701085453.GA1388@paquier.xyz> User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Now that we have REINDEX CONCURRENTLY, I think reindexdb is going to gain more popularity. Please don't reuse a file name as generic as "parallel.c" -- it's annoying when navigating source. Maybe conn_parallel.c multiconn.c connscripts.c admconnection.c ...? If your server crashes or is stopped midway during the reindex, you would have to start again from scratch, and it's tedious (if it's possible at all) to determine which indexes were missed. I think it would be useful to have a two-phase mode: in the initial phase reindexdb computes the list of indexes to be reindexed and saves them into a work table somewhere. In the second phase, it reads indexes from that table and processes them, marking them as done in the work table. If the second phase crashes or is stopped, it can be restarted and consults the work table. I would keep the work table, as it provides a bit of an audit trail. It may be important to be able to run even if unable to create such a work table (because of the numerous users that DROP DATABASE postgres). Maybe we'd have two flags in the work table for each index: "reindex requested", "reindex done". The "glibc filter" thing (which I take to mean "indexes that depend on collations") would apply to the first phase: it just skips adding other indexes to the work table. I suppose ICU collations are not affected, so the filter would be for glibc collations only? The --glibc-dependent switch seems too ad-hoc. Maybe "--exclude-rule=glibc"? That way we can add other rules later. (Not "--exclude=foo" because we'll want to add the possibility to ignore specific indexes by name.) -- Álvaro Herrera https://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services