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 1jhFTu-0003rt-Gz for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Jun 2020 16:46:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1jhFTs-0003ez-MS for pgsql-bugs@arkaria.postgresql.org; Fri, 05 Jun 2020 16:46:08 +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 1jhFTs-0003es-G1 for pgsql-bugs@lists.postgresql.org; Fri, 05 Jun 2020 16:46:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1jhFTl-0004Ov-Uo for pgsql-bugs@lists.postgresql.org; Fri, 05 Jun 2020 16:46:07 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 055GjlPt1507640; Fri, 5 Jun 2020 12:45:47 -0400 From: Tom Lane To: David Rowley cc: Fabien COELHO , "Jawarilal, Manish" , "pgsql-bugs@lists.postgresql.org" Subject: Re: pgbench bug / limitation In-reply-to: References: <7221.1590687090@sss.pgh.pa.us> <10327.1590763515@sss.pgh.pa.us> <384920.1591027137@sss.pgh.pa.us> <512846.1591057287@sss.pgh.pa.us> Comments: In-reply-to David Rowley message dated "Fri, 05 Jun 2020 16:10:34 +1200" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <1507638.1591375547.1@sss.pgh.pa.us> Date: Fri, 05 Jun 2020 12:45:47 -0400 Message-ID: <1507639.1591375547@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk David Rowley writes: > On Tue, 2 Jun 2020 at 23:27, Fabien COELHO wrote: >> Attached is a blind attempt at working around the issue based on what you >> show below, that I cannot test. > I suppose we might be able to do something like that. It does expose > us to the implementation of Microsoft's fd_set struct, but surely the > shape of that must be pretty much fixed since if it were to be changed > then software that's already compiled would break. More to the point, this does nothing to get around the O(N^2) cost of adding N FDs to the fd_set with Microsoft's implementation; so I do not think it's really going to fix the problem for people who want to use lots of connections on Windows. The idea that I vaguely had was to build our own array of socket FDs (bypassing the unnecessary de-duplication logic in FD_SET) and then call WaitForMultipleObjects() or similar directly. This would of course be quite Windows-specific, which'd be annoying, but it seems like getting out of using select() on Windows wouldn't be a bad thing. Trying to make the same code work with two basically different models of what a fd_set is seems like a recipe for pain. This would also get us out from under the hack of redefining FD_SETSIZE. Alternatively, if we're going to get in bed with the internals of Windows' fd_set implementation anyway, we could implement our own version of FD_SET that doesn't do the de-duplication. regards, tom lane