Unix Technical Forum

Re: Document how to turn off disk write cache on popularoperating

This is a discussion on Re: Document how to turn off disk write cache on popularoperating within the pgsql Hackers forums, part of the PostgreSQL category; --> Magnus Hagander wrote: > On Mon, Dec 10, 2007 at 02:05:05PM +0000, Bruce Momjian wrote: > > Log Message: ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > pgsql Hackers

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-15-2008, 11:36 PM
Bruce Momjian
 
Posts: n/a
Default Re: Document how to turn off disk write cache on popularoperating

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/cvsw...1=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. +

---------------------------(end of broadcast)---------------------------
TIP 2: Don't 'kill -9' the postmaster

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-15-2008, 11:36 PM
Magnus Hagander
 
Posts: n/a
Default Re: Document how to turn off disk write cache on popular operating

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/cvsw...1=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

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-15-2008, 11:36 PM
Tom Lane
 
Posts: n/a
Default Re: Document how to turn off disk write cache on popular operating

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

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
choose an index scan if your joining column's datatypes do not
match

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #4 (permalink)  
Old 04-15-2008, 11:36 PM
Magnus Hagander
 
Posts: n/a
Default Re: Document how to turn off disk write cache on popular operating

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

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

http://www.postgresql.org/docs/faq

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #5 (permalink)  
Old 04-15-2008, 11:37 PM
Manolo _
 
Posts: n/a
Default tuplesort.c


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 storing it 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 popping heap's root, no heapifying)
- reduceing the actual heap size in order to build the current run (insteadof 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/cvsw...1=1.46&r2=1.47)

>>
>> Should this mention that you don't need to turn it off at the disk levelif
>> 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/g...ave/direct/01/
---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #6 (permalink)  
Old 04-15-2008, 11:37 PM
Bruce Momjian
 
Posts: n/a
Default Re: Document how to turn off disk write cache onpopular operating

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 is disabled by
unchecking <literal>My Computer\Open\{select disk
drive}\Properties\Hardware\Properties\Policies\Ena ble write caching 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. +

---------------------------(end of broadcast)---------------------------
TIP 5: don't forget to increase your free space map settings

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 04:05 PM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com