X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id DAF4ADA135 for ; Wed, 23 Nov 2005 00:53:39 -0400 (AST) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 67139-09 for ; Wed, 23 Nov 2005 04:53:38 +0000 (GMT) X-Greylist: from auto-whitelisted by SQLgrey- Received: from candle.pha.pa.us (candle.pha.pa.us [64.139.89.126]) by svr1.postgresql.org (Postfix) with ESMTP id CB893D9585 for ; Wed, 23 Nov 2005 00:53:36 -0400 (AST) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id jAN4rGs24421; Tue, 22 Nov 2005 23:53:16 -0500 (EST) From: Bruce Momjian Message-Id: <200511230453.jAN4rGs24421@candle.pha.pa.us> Subject: Re: Hardware/OS recommendations for large databases ( In-Reply-To: <4383E89C.8040200@rentec.com> To: Alan Stange Date: Tue, 22 Nov 2005 23:53:16 -0500 (EST) CC: Greg Stark , Luke Lonergan , Dave Cramer , Joshua Marsh , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL121 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.026 required=5 tests=[AWL=0.026] X-Spam-Score: 0.026 X-Spam-Level: X-Archive-Number: 200511/467 X-Sequence-Number: 15724 Alan Stange wrote: > Bruce Momjian wrote: > > Right now the file system will do read-ahead for a heap scan (but not an > > index scan), but even then, there is time required to get that kernel > > block into the PostgreSQL shared buffers, backing up Luke's observation > > of heavy memcpy() usage. > > > > So what are our options? mmap()? I have no idea. Seems larger page > > size does help. > For sequential scans, you do have a background reader. It's the > kernel. As long as you don't issue a seek() between read() calls, the I guess you missed my text of "Right now the file system will do read-ahead", meaning the kernel. > I don't think the memcpy of data from the kernel to userspace is that > big of an issue right now. dd and all the high end network interfaces > manage OK doing it, so I'd expect postgresql to do all right with it now > yet too. Direct IO will avoid that memcpy, but then you also don't get > any caching of the files in memory. I'd be more concerned about any > memcpy calls or general data management within postgresql. Does > postgresql use the platform specific memcpy() in libc? Some care might > be needed to ensure that the memory blocks within postgresql are all > properly aligned to make sure that one isn't ping-ponging cache lines > around (usually done by padding the buffer sizes by an extra 32 bytes or > L1 line size). Whatever you do, all the usual high performance > computing tricks should be used prior to considering any rewriting of > major code sections. We have dealt with alignment and MemCpy is what we used for small-sized copies to reduce function call overhead. If you want to improve it, feel free to take a look. -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073