Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ba6Ge-0000Ad-4K for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 19:12:48 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84_2) (envelope-from ) id 1ba6Gd-00031t-DZ for pgsql-hackers@arkaria.postgresql.org; Wed, 17 Aug 2016 19:12:47 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ba6FE-0001VP-Ri for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 19:11:21 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1ba6FC-00015A-77 for pgsql-hackers@postgresql.org; Wed, 17 Aug 2016 19:11:19 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.4/8.14.4) with ESMTP id u7HJBFqP006353; Wed, 17 Aug 2016 15:11:15 -0400 From: Tom Lane To: Robert Haas cc: Oskari Saarenmaa , "pgsql-hackers@postgresql.org" Subject: Re: Use pread and pwrite instead of lseek + write and read In-reply-to: References: <7109.1471441241@sss.pgh.pa.us> Comments: In-reply-to Robert Haas message dated "Wed, 17 Aug 2016 14:25:26 -0400" Date: Wed, 17 Aug 2016 15:11:15 -0400 Message-ID: <6352.1471461075@sss.pgh.pa.us> X-Pg-Spam-Score: -2.5 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Robert Haas writes: > I don't understand why you think this would create non-trivial > portability issues. The patch as submitted breaks entirely on platforms without pread/pwrite. Yes, we can add a configure test and some shim functions to fix that, but the argument that it makes the code shorter will get a lot weaker once we do. I agree that adding such functions is pretty trivial, but there are reasons to think there are other hazards that are less trivial: First, a self-contained shim function will necessarily do an lseek every time, which means performance will get *worse* not better on non-pread platforms. And yes, the existing logic to avoid lseeks fires often enough to be worthwhile, particularly in seqscans. Second, I wonder whether this will break any kernel's readahead detection. I wouldn't be too surprised if successive reads (not preads) without intervening lseeks are needed to trigger readahead on at least some platforms. So there's a potential, both on platforms with pread and those without, for this to completely destroy seqscan performance, with penalties very far exceeding what we might save by avoiding some kernel calls. I'd be more excited about this if the claimed improvement were more than 1.5%, but you know as well as I do that that's barely above the noise floor for most performance measurements. I'm left wondering why bother, and why take any risk of de-optimizing on some platforms. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers