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

Started by Nonameabout 18 years ago8 messages
#1Noname
momjian@postgresql.org

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)

#2Magnus Hagander
magnus@hagander.net
In reply to: Noname (#1)
Re: pgsql: Document how to turn off disk write cache on popular operating

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?

//Magnus

#3Bruce Momjian
bruce@momjian.us
In reply to: Magnus Hagander (#2)
Re: Document how to turn off disk write cache on popular operating

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. +

#4Magnus Hagander
magnus@hagander.net
In reply to: Bruce Momjian (#3)
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/cvsweb.cgi/pgsql/doc/src/sgml/wal.sgml?r1=1.46&amp;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

#5Tom Lane
tgl@sss.pgh.pa.us
In reply to: Magnus Hagander (#4)
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

#6Magnus Hagander
magnus@hagander.net
In reply to: Tom Lane (#5)
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

#7Manolo _
mac_man2005@hotmail.it
In reply to: Bruce Momjian (#3)
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 (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&amp;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/

#8Bruce Momjian
bruce@momjian.us
In reply to: Magnus Hagander (#4)
Re: Document how to turn off disk write cache on popular 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\Enable 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. +