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 1sco8O-00Ac5J-9C for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Aug 2024 15:36:00 +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 1sco8L-009Res-B5 for pgsql-hackers@arkaria.postgresql.org; Sat, 10 Aug 2024 15:35:57 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1sco8K-009Rei-VA for pgsql-hackers@lists.postgresql.org; Sat, 10 Aug 2024 15:35:57 +0000 Received: from mail-il1-x12d.google.com ([2607:f8b0:4864:20::12d]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1sco8E-0043aE-6g for pgsql-hackers@postgresql.org; Sat, 10 Aug 2024 15:35:55 +0000 Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-39834949f27so11522385ab.2 for ; Sat, 10 Aug 2024 08:35:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723304149; x=1723908949; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=lHUvOpBPXOwX9IzzkTR1p6rdztEqDmCaTeBZgCOiE+U=; b=CYBvq8+P7DjIiXXUfjXwaA516dJsNeRJNwROqV9PQlbhY6dfi4xrXCimEwLYGie+hG SSOwSpD/7ZiRgRW97LFlUrSmMuyCGqAUrPfHxxowkD9c8/a2Vb4VBHIQQZNIeV+yjDCn 41Fp+W0OtjIB/neG7xw4M8BrH0i020w1zXX916/N0XbprM+vdCbH/npG/DJEcFimLsgG EWdkz9lxS2pQJjT71Gqf1CeUu0I9HLdvrRQemPodEbO3JbEDB5MbI3u7DM8MGdIAJRCm n/sklIUfrrkJTkeWKHWZWe0dQNEmgBBDgP3tW7Dhmdgtlxn4+IRmodC/5NUkJcfVzGLJ n1Ig== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723304149; x=1723908949; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=lHUvOpBPXOwX9IzzkTR1p6rdztEqDmCaTeBZgCOiE+U=; b=n7m910NS/ynA2DljIvjNCqiXeG4/HV1WlelXHR37GdvPRImR7W3eUvhDERuE3qtnWE pPaBGpS6gYQK42qR9taNESPNqDkdmzhGSaBea7Md7iRTyN/XiW4CA0EmG28ylR3ZdtJk aShF3jlej1pIUNixa0OhmUazlggesrIF3J4M9iEHW3398aIyJu8BWUqMOMRuGq4kecog WPIzXKgfdmoywthy4ADaV/ZIx8/R/9HoE4Sg4eP4hR0pDq73zrOw7T0w07jDxmemjHoO HT5cHvhEESgCLO/iFz7GGzs6VMGl5gxt0SYjh3u3V/QJL2Bf+qrA/e4WUvVptFm7qP+U rOaQ== X-Forwarded-Encrypted: i=1; AJvYcCWssubYmwVSUWM5lKjejU97KYNQctv5RefajsR58mUmvXEJ96bG5JTrbBkqYBw0lbM1ETrDgot4WuY7mUTqJq0iXJ4qB9ZCnjcPHxM9 X-Gm-Message-State: AOJu0YyzktWTTb8v3KToqRWd25z5N9j+C5b46172dM8OpmwnzAyQx/g6 1xBZlfWS/6bKXprOHC07qsVh0bldK5gtnW5b3jayarTypl+gQEgY X-Google-Smtp-Source: AGHT+IFeGDtd/nsjNcTY7/UyxNSRo4gnnXf91ADkikP7dpVK1o7tYqiIvbloY6d3/YS68KW0ZQXesQ== X-Received: by 2002:a05:6602:1694:b0:822:3ad7:ebae with SMTP id ca18e2360f4ac-8225ed04464mr680592439f.9.1723304148815; Sat, 10 Aug 2024 08:35:48 -0700 (PDT) Received: from nathan (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id ca18e2360f4ac-82267221fe1sm68164439f.19.2024.08.10.08.35.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 10 Aug 2024 08:35:48 -0700 (PDT) Date: Sat, 10 Aug 2024 10:35:46 -0500 From: Nathan Bossart To: Corey Huinker Cc: Ilya Gladyshev , Daniel Gustafsson , Robert Haas , Jeff Davis , PostgreSQL Hackers Subject: Re: optimizing pg_upgrade's once-in-each-database steps Message-ID: References: <10c1c8dd-4685-46d4-80be-56bdfca8659a@gmail.com> <60cbc507-4c36-4037-9af7-028b1c8455b5@gmail.com> 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: Archived-At: Precedence: bulk On Sat, Aug 10, 2024 at 10:17:27AM -0500, Nathan Bossart wrote: > On Fri, Aug 09, 2024 at 04:06:16PM -0400, Corey Huinker wrote: >>> Furthermore, most of the callbacks should do almost nothing for a given >>> upgrade, and since pg_upgrade runs on the server, client/server round-trip >>> time should be pretty low. >> >> To my mind, that makes pipelining make more sense, you throw out N queries, >> most of which are trivial, and by the time you cycle back around and start >> digesting result sets via callbacks, more of the queries have finished >> because they were waiting on the query ahead of them in the pipeline, not >> waiting on a callback to finish consuming its assigned result set and then >> launching the next task query. > > My assumption is that the "waiting for a callback before launching the next > query" time will typically be pretty short in practice. I could try > measuring it... Another option might be to combine all the queries for a task into a single string and then send that in one PQsendQuery() call. That may be a simpler way to eliminate the time between queries. -- nathan