Heikki Linnakangas <[EMAIL PROTECTED]> writes: > Alvaro Herrera wrote: >> I thought about that too. I admit I am not sure if this really works >> portably; however I don't want to add a palloc() to that routine.
> It should work, AFAIK, but unaligned memcpy()s and write()s can be a > significantly slower. There can be only one write() happening at any > time, so you could just palloc() a single 8k buffer in TopMemoryContext > in backend startup, and always use that. Some time ago, we arranged for shared buffers to be aligned on *more* than maxalign boundaries (cf BUFFERALIGN) because on at least some platforms this makes a very significant difference in the speed of copying to/from kernel space. If you are going to double-buffer it is going to be important to have the intermediate buffer just as well aligned. A local char array won't be acceptable, and even for a palloc'd one you'll need to take some extra steps (like wasting ALIGNOF_BUFFER extra bytes so you can align the pointer palloc gives). 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