Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nhVMa-0001cr-1j for pgsql-performance@arkaria.postgresql.org; Thu, 21 Apr 2022 11:52:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nhVMY-0007qq-Lp for pgsql-performance@arkaria.postgresql.org; Thu, 21 Apr 2022 11:52:42 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nhVMY-0007nZ-9A for pgsql-performance@lists.postgresql.org; Thu, 21 Apr 2022 11:52:42 +0000 Received: from mail-il1-x136.google.com ([2607:f8b0:4864:20::136]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1nhVMU-0002Ld-TE for pgsql-performance@postgresql.org; Thu, 21 Apr 2022 11:52:41 +0000 Received: by mail-il1-x136.google.com with SMTP id d4so2876990iln.6 for ; Thu, 21 Apr 2022 04:52:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=ffWjl77MItXDNAVRIwG+iV+hOkOhZIKq5dKTmWE2tjY=; b=N8c2tCWaNd5edDGRvdr+r217xERl173ihvjTPl18ahzIX3xkkiaI8+3sW+c/joYHVi +quuhKmqxASJxZrCloAQ3EH/Z0OnRYeM0rxlopL3y+TiGH9yAOS5LQo9w9Gyi2TVGS0S +dc9shbKF0d28RSpoeN0NBJLNMyzCRdxpQEkeRjUBu8MATpdWWiaTPAua8S7eIHmEjj+ kh/PkCxIUfyWz2+XTeFS79kud/vt9+SKLdxXsUTZN6v4YoU3hZ8g5reXGw81EjftV4fs eOaW68SneIN93A2jwlTWRO9ZBiyb9m4N4TQwgCMxDDjzAy4unTX0AURFuSvCOdTqf6+e B4eQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=ffWjl77MItXDNAVRIwG+iV+hOkOhZIKq5dKTmWE2tjY=; b=D7soznBX84F6qgQwoAAO7PcFdjYhCoaJEpsnrTa7R/7B8ed1n/Cfw+sYBoKKyPaOII eDOdDBKZ/5aGsOPJc+w12KSkXtFhe0ZLwuN9i0YSqSC9Hd9stx3RrKkWqFC1vm8MNhSc YhOx9TILJaHvFRkLdpvMZh9QVchgAyAQenk1bjNg8x6IHDzdAZQmNchlW/gd+ySYNWbp TH6ZtZaXPh3l51L8OI0cTtWE4mifvNDRkF8mtgwRszjdUtC0GjCvw79Wv5T+oCzOeD0P DFLVrNGCLZyI8yQ6HdzcRPFUdf1qO/uYpkEufkLSNgqJtoOOOuc1HLlkTzLEDiGq5T0p 5d8g== X-Gm-Message-State: AOAM531ctxexPthymBogCx4L7jGPiws6rjd5rLZAKq/YzsbXO01DT4tc JzdD4lt2Pfc1AcDzOu58AhgT2A== X-Google-Smtp-Source: ABdhPJyZz4yBA3m409wMLrPU/b+nu0MzymRekZKJvSzz9Bsb5UP9hX1HlfyGCLN7luS70BYYIBTFQQ== X-Received: by 2002:a92:7c01:0:b0:2ca:95e4:f4b5 with SMTP id x1-20020a927c01000000b002ca95e4f4b5mr10245214ilc.240.1650541957928; Thu, 21 Apr 2022 04:52:37 -0700 (PDT) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id o16-20020a92c690000000b002cbf7f76878sm10350334ilg.6.2022.04.21.04.52.37 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Apr 2022 04:52:37 -0700 (PDT) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 9F3C680086E; Thu, 21 Apr 2022 06:52:36 -0500 (CDT) Date: Thu, 21 Apr 2022 06:52:36 -0500 From: Justin Pryzby To: Benjamin Tingle Cc: Alvaro Herrera , pgsql-performance@postgresql.org Subject: Re: Query Planner not taking advantage of HASH PARTITION Message-ID: <20220421115236.GA10173@telsasoft.com> References: <202204171850.iqpjc2mmr47y@alvherre.pgsql> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Wed, Apr 20, 2022 at 07:11:37PM -0700, Benjamin Tingle wrote: > @ the first point about write locks > I think I had/have a misconception about how inserts work in postgres. It's > my understanding that postgres will never draft a parallel insert plan for > any query (except maybe CREATE TABLE AS?) It's correct that DML (INSERT/UPDATE/DELETE) currently is not run in parallel. https://www.postgresql.org/docs/current/when-can-parallel-query-be-used.html > because the process needs to acquire an exclusive access write lock to the > table it is inserting on. But this is incorrect - DML acquires a relation lock, but not a strong one. Multiple processes can insert into a table at once (because the row-excl lock level is not self-conflicting, to be technical). https://www.postgresql.org/docs/current/explicit-locking.html In fact, that's a design requirement. It's understood that many people would be unhappy if only one client were able to run UPDATEs at once, and that only a toy system would acquire a strong lock for DML. -- Justin