Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jIgjj-0001z7-Qz for pgsql-committers@arkaria.postgresql.org; Sun, 29 Mar 2020 22:48:59 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jIgjC-0004oK-RQ for pgsql-committers@arkaria.postgresql.org; Sun, 29 Mar 2020 22:48:26 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jIgjC-0004nu-Lf for pgsql-committers@lists.postgresql.org; Sun, 29 Mar 2020 22:48:26 +0000 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jIgj9-0007oq-0e for pgsql-committers@lists.postgresql.org; Sun, 29 Mar 2020 22:48:26 +0000 Received: from compute3.internal (compute3.nyi.internal [10.202.2.43]) by mailout.west.internal (Postfix) with ESMTP id C2F20578; Sun, 29 Mar 2020 18:48:20 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute3.internal (MEProxy); Sun, 29 Mar 2020 18:48:20 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=anarazel.de; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=fm1; bh=tOO96Yc7QViH5D4irLikUnqE0FQ dnL8C1CNLEcSZOyI=; b=IT7bfngLIBHuxaxY9sAemsL+3GLAQT+4Yva3SitWnKk ikbtftacsUqICuhB5H1+jqksxVJhy6VehgXYyaQnIt4ygLwNsbm8PuHxXDh7+tzf 6Oj8Eox3GGvwqWLig3JqPz5fyIyOPfnr+0vcEivzRsU+mp1FsQlcBp2ELIgB9Uji jcTkZE40zn2Z7ojN4XO26acpeLjyCYmbaQlCb/Lojh78afG20O8kzR5DAdGZZ8G1 Qqfqr9+t8iNdPxWPsqbTxpFHHoMz3z/j4Qq1xKkkHL5jEJ8VOWocKlFw93Lxn3F/ M2ppDEJ7WvDSeprZYVmkfdhD52tYJknsnO5V5Vp5ilA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=tOO96Y c7QViH5D4irLikUnqE0FQdnL8C1CNLEcSZOyI=; b=Rm276k/m2aHfcIm5aTRX5t yMycXLGdIU89FzDQFipHz8P7QAgQjaKQDTL1DbE1WPQR+cwk0E/fWtDn4D/+0MOh GFjSXPan8RQOhzZ+Voi8p+n5r1Y63XNwH4c6PjryUIg6EQHvQk9l3USKhLEWfEQg CkLjMSKtKowA3KcxPvzRZV+wRE+1zhxFHlVzJqMRWwe4H+EKuzTOk4LR+r47vEqh cocpYpar1tjw8rn5Je5neCF9LHVvp51nxcOP6Ksl3dtq4LFoxaLVS0RAMDb137WK YIe9+Jh8cNz7NLaLDE/6s6zhfjM/Jk9yaIdjAnUyOJPo7hgO3Ou1xDzabpF3HnfA == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedugedrudeigedgudefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfffhvffukfhfgggtuggjsehttdertddttddvnecuhfhrohhmpeetnhgurhgv shcuhfhrvghunhguuceorghnughrvghssegrnhgrrhgriigvlhdruggvqeenucffohhmrg hinhepphhoshhtghhrrdgvshenucfkphepieejrdduiedtrddvudejrddvhedtnecuvehl uhhsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomheprghnughrvghsse grnhgrrhgriigvlhdruggv X-ME-Proxy: Received: from intern.anarazel.de (c-67-160-217-250.hsd1.ca.comcast.net [67.160.217.250]) by mail.messagingengine.com (Postfix) with ESMTPA id D8102328005D; Sun, 29 Mar 2020 18:48:19 -0400 (EDT) Date: Sun, 29 Mar 2020 15:48:18 -0700 From: Andres Freund To: Amit Kapila Cc: pgsql-committers@lists.postgresql.org Subject: Re: pgsql: Allow vacuum command to process indexes in parallel. Message-ID: <20200329224818.6phnhv7o2q2rfovf@alap3.anarazel.de> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi, On 2020-01-20 02:33:34 +0000, Amit Kapila wrote: > Allow vacuum command to process indexes in parallel. > > This feature allows the vacuum to leverage multiple CPUs in order to > process indexes. This enables us to perform index vacuuming and index > cleanup with background workers. This adds a PARALLEL option to VACUUM > command where the user can specify the number of workers that can be used > to perform the command which is limited by the number of indexes on a > table. Specifying zero as a number of workers will disable parallelism. > This option can't be used with the FULL option. > > Each index is processed by at most one vacuum process. Therefore parallel > vacuum can be used when the table has at least two indexes. > > The parallel degree is either specified by the user or determined based on > the number of indexes that the table has, and further limited by > max_parallel_maintenance_workers. The index can participate in parallel > vacuum iff it's size is greater than min_parallel_index_scan_size. > > Author: Masahiko Sawada and Amit Kapila > Reviewed-by: Dilip Kumar, Amit Kapila, Robert Haas, Tomas Vondra, > Mahendra Singh and Sergei Kornilov > Tested-by: Mahendra Singh and Prabhat Sahu > Discussion: > https://postgr.es/m/CAD21AoDTPMgzSkV4E3SFo1CH_x50bf5PqZFQf4jmqjk-C03BWg@mail.gmail.com > https://postgr.es/m/CAA4eK1J-VoR9gzS5E75pcD-OH0mEyCdp8RihcwKrcuw7J-Q0+w@mail.gmail.com Coverity is complaining that: > ** CID ...: Incorrect expression (UNINTENDED_INTEGER_DIVISION) > /srv/coverity/git/pgsql-git/postgresql/src/backend/commands/vacuum.c: 2078 in compute_parallel_delay() > > > ________________________________________________________________________________________________________ > *** CID ...: Incorrect expression (UNINTENDED_INTEGER_DIVISION) > /srv/coverity/git/pgsql-git/postgresql/src/backend/commands/vacuum.c: 2078 in compute_parallel_delay() > 2072 shared_balance = pg_atomic_add_fetch_u32(VacuumSharedCostBalance, VacuumCostBalance); > 2073 > 2074 /* Compute the total local balance for the current worker */ > 2075 VacuumCostBalanceLocal += VacuumCostBalance; > 2076 > 2077 if ((shared_balance >= VacuumCostLimit) && > >>> CID ...: Incorrect expression (UNINTENDED_INTEGER_DIVISION) > >>> Dividing integer expressions "VacuumCostLimit" and "nworkers", and then converting the integer quotient to type "double". Any remainder, or fractional part of the quotient, is ignored. > 2078 (VacuumCostBalanceLocal > 0.5 * (VacuumCostLimit / nworkers))) > 2079 { > 2080 /* Compute sleep time based on the local cost balance */ > 2081 msec = VacuumCostDelay * VacuumCostBalanceLocal / VacuumCostLimit; > 2082 pg_atomic_sub_fetch_u32(VacuumSharedCostBalance, VacuumCostBalanceLocal); > 2083 VacuumCostBalanceLocal = 0; Which seems like a fair enough complaint? Greetings, Andres Freund