public inbox for [email protected]  
help / color / mirror / Atom feed
From: [email protected] <[email protected]>
To: George Neuner <[email protected]>
Cc: postgres performance list <[email protected]>
Subject: Re: Unlogged tables
Date: Thu, 10 Aug 2017 05:29:35 +0000
Message-ID: <BN4PR15MB05477F51C9D6D8B45178F64585880@BN4PR15MB0547.namprd15.prod.outlook.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
	<BN4PR15MB0547F5864AD9691E31458FE1858B0@BN4PR15MB0547.namprd15.prod.outlook.com>
	<[email protected]>
List-Unsubscribe:  <mailto:[email protected]?body=unsub%20pgsql-performance>



Sent from my BlackBerry - the most secure mobile device
From: [email protected]
Sent: August 9, 2017 14:52
To: [email protected]
Cc: [email protected]
Subject: Re: [PERFORM] Unlogged tables


Please don't top post.

On 8/9/2017 2:30 PM, [email protected]<mailto:[email protected]> wrote:
> On 8/9/2017 2:17 PM, [email protected]<mailto:[email protected]> wrote:

>> On Wed, 9 Aug 2017 09:14:48 -0700, Jeff Janes <[email protected]><mailto:[email protected]> wrote:

>> Why doesn't the Windows scheduled shutdown signal postgres to shutdown
>> cleanly and wait for it to do so?  That is what is supposed to happen.

> Windows *does* signal shutdown (and sleep and hibernate and wakeup).
> pg_ctl can catch these signals only when running as a service ... it
> will not catch any system signals when run as an application.

Ok, I am not sure. I run Postgres as a service, and when my Windows rebooted after a patch, UNLOGGED tables were cleaned... maybe the patch process in Windows messed something up, I don't know.

Hmm.  Do you have checkpoint intervals set very long?  Or do you have the Windows shutdown delay(s) set short?

Data in unlogged tables persists only AFTER a checkpoint ... if the tables had been written to and were "dirty", and the system went down before the shutdown checkpoint (or before the shutdown checkpoint completed), then the tables would be truncated at the next startup.


Service control in Windows is very different from Unix/Linux, and Windows is not completely POSIX compatible.  I develop software for Windows and Linux, but I only use Postgresql.  Postgresql was written originally for Unix and it is possible that the Windows version is not doing something quite right.

I took a quick glance at the source for pg_ctl:  SERVICE_CONTROL_SHUTDOWN and SERVICE_CONTROL_STOP both just set an shared event to notify the writer processes to terminate.  Offhand I don't see where pg_ctl - running as a service - is waiting for the writer processes to actually terminate ( it does wait if run from the command line ).   It's possible that your system shut down too quickly and the WAL writer was killed instead of terminating cleanly.


Just FYI, re: Postgresql as a user application.

Windows doesn't send *signals* (ala Unix) at all ... it is message based.  The control messages are different for applications and services - e.g., WM_SHUTDOWN is sent to applications, SERVICE_CONTROL_SHUTDOWN is sent to services.  In order for an application to catch a message, it must create a window.

pg_ctl is a command line program which does not create any windows (in any mode).  It was designed to enable it to run as a service, but when run as a user application it will can't receive any system messages.  The user *must* manually stop a running database cluster before shutting down or sleeping.

George


Hello George... I know about not doing top posting but was emailing from my phone, and just recently moved to Android. I think I am still not configured right.

Somewhat orthogonal, but any particular reason why top posts == bad, or just convention?

I will try a few scenarios and report back. I do not believe I have long cp intervals and I do not believe the windows machine shuts down faster than 'normal'

Finally, my true question was whether Postgres would support something like worm with the performance benefits of UNLOGGED, but not the inconveniences of auto truncates.

Thanks.


reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected]
  Subject: Re: Unlogged tables
  In-Reply-To: <BN4PR15MB05477F51C9D6D8B45178F64585880@BN4PR15MB0547.namprd15.prod.outlook.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox