Thread: Re: Document how to turn off disk write cache on popular operating

Re: Document how to turn off disk write cache on popular operating

From
Bruce Momjian
Date:
Magnus Hagander wrote:
> On Mon, Dec 10, 2007 at 02:05:05PM +0000, Bruce Momjian wrote:
> > Log Message:
> > -----------
> > Document how to turn off disk write cache on popular operating systems.
> > 
> > Modified Files:
> > --------------
> >     pgsql/doc/src/sgml:
> >         wal.sgml (r1.46 -> r1.47)
> >         (http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/wal.sgml?r1=1.46&r2=1.47)
> 
> Should this mention that you don't need to turn it off at the disk level if
> you use fsync_writethrough? 

Uh, I remember we looked at this checkbox before but I don't remember
the details, and I can't find a comment about it.  Was the issue that
writethrough always forces through the disk cache?  Is that the default
on Win32?  Did we comment this somewhere?

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://postgres.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


Re: Document how to turn off disk write cache on popular operating

From
Magnus Hagander
Date:
On Tue, Dec 11, 2007 at 08:18:42AM -0500, Bruce Momjian wrote:
> Magnus Hagander wrote:
> > On Mon, Dec 10, 2007 at 02:05:05PM +0000, Bruce Momjian wrote:
> > > Log Message:
> > > -----------
> > > Document how to turn off disk write cache on popular operating systems.
> > > 
> > > Modified Files:
> > > --------------
> > >     pgsql/doc/src/sgml:
> > >         wal.sgml (r1.46 -> r1.47)
> > >         (http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/wal.sgml?r1=1.46&r2=1.47)
> > 
> > Should this mention that you don't need to turn it off at the disk level if
> > you use fsync_writethrough? 
> 
> Uh, I remember we looked at this checkbox before but I don't remember
> the details, and I can't find a comment about it.  Was the issue that
> writethrough always forces through the disk cache?  Is that the default
> on Win32?  Did we comment this somewhere?

If you set it to fsync or fsync_writethrough it will write through the
cache. (fsync is just an alias)
If you set it to OPEN_DATASYNC, it will respond to the checkbox you are
referring to.

OPEN_DATASYNC is the default, IIRC.

//Magnus


Re: Document how to turn off disk write cache on popular operating

From
Tom Lane
Date:
Magnus Hagander <magnus@hagander.net> writes:
> If you set it to fsync or fsync_writethrough it will write through the
> cache.

Really?  How much should we trust that?
        regards, tom lane


Re: Document how to turn off disk write cache on popular operating

From
Magnus Hagander
Date:
On Tue, Dec 11, 2007 at 10:09:51AM -0500, Tom Lane wrote:
> Magnus Hagander <magnus@hagander.net> writes:
> > If you set it to fsync or fsync_writethrough it will write through the
> > cache.
> 
> Really?  How much should we trust that?

I'd say as much as we shuold trust that checkbox in the Windows settings
page...

I haven't come across a case yet where it doesn't work, but that doesn't
mean there isn't one. It certainly writes through the writeback cache of
shiny expensive raid controllers :-) And it does write through the IDE
drives that I've tested.

Bottom line is, I think that the cases where fsync_writethrough doesn't do
it, that checkbox isn't going to work either....

//Magnus


tuplesort.c

From
Manolo _
Date:
http://pastebin.com/f304b279e

",,,the tuple we last output,,,"

What's the problem with just keeping the "the key" of the last output tuple (not the whole tuple)?

I mean, keeping that key will let us writing some incoming tuples (from input) directly into the current run  avoiding
storingit into the heap. Otherwise we consither those tuples as pending elements to be written into the next run. That
implies:
- not writing into the current run a tuple that needs no extra work as the common case (no insertion into the heap, no
poppingheap's root, no heapifying) 
- reduceing the actual heap size in order to build the current run (instead of trying to make each run as long as
possible!)

If we think about it on large amount of data... this could save some disk latency time.

Isn't it worth?

Regards, Manolo.


----------------------------------------
> From: bruce@momjian.us
> Subject: [HACKERS] Re: Document how to turn off disk write cache on popular operating
> To: magnus@hagander.net
> Date: Tue, 11 Dec 2007 08:18:42 -0500
> CC: pgsql-hackers@postgreSQL.org
>
> Magnus Hagander wrote:
>> On Mon, Dec 10, 2007 at 02:05:05PM +0000, Bruce Momjian wrote:
>>> Log Message:
>>> -----------
>>> Document how to turn off disk write cache on popular operating systems.
>>>
>>> Modified Files:
>>> --------------
>>>     pgsql/doc/src/sgml:
>>>         wal.sgml (r1.46 -> r1.47)
>>>         (http://developer.postgresql.org/cvsweb.cgi/pgsql/doc/src/sgml/wal.sgml?r1=1.46&r2=1.47)
>>
>> Should this mention that you don't need to turn it off at the disk level if
>> you use fsync_writethrough?
>
> Uh, I remember we looked at this checkbox before but I don't remember
> the details, and I can't find a comment about it.  Was the issue that
> writethrough always forces through the disk cache?  Is that the default
> on Win32?  Did we comment this somewhere?
>
> --
>   Bruce Momjian          http://momjian.us
>   EnterpriseDB                             http://postgres.enterprisedb.com
>
>   + If your life is a hard drive, Christ can be your backup. +
>
> ---------------------------(end of broadcast)---------------------------
> TIP 2: Don't 'kill -9' the postmaster

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/

Re: Document how to turn off disk write cache on popular operating

From
Bruce Momjian
Date:
Magnus Hagander wrote:
> > > Should this mention that you don't need to turn it off at the disk level if
> > > you use fsync_writethrough? 
> > 
> > Uh, I remember we looked at this checkbox before but I don't remember
> > the details, and I can't find a comment about it.  Was the issue that
> > writethrough always forces through the disk cache?  Is that the default
> > on Win32?  Did we comment this somewhere?
> 
> If you set it to fsync or fsync_writethrough it will write through the
> cache. (fsync is just an alias)
> If you set it to OPEN_DATASYNC, it will respond to the checkbox you are
> referring to.
> 
> OPEN_DATASYNC is the default, IIRC.

OK, docs updated:
  On <productname>Windows</> if <varname>wal_sync_method</> is  <literal>open_datasync</> (the default), write caching
isdisabled by  unchecking <literal>My Computer\Open\{select disk  drive}\Properties\Hardware\Properties\Policies\Enable
writecaching on  the disk</>.  Also on Windows, <literal>fsync</> and  <literal>fsync_writethrough</> never do write
caching.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://postgres.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +