Re: Unlogged tables

From: George Neuner <gneuner2(at)comcast(dot)net>
To: "ldh(at)laurent-hasson(dot)com" <ldh(at)laurent-hasson(dot)com>
Cc: pgsql-performance(at)postgresql(dot)org
Subject: Re: Unlogged tables
Date: 2017-08-10 22:28:37
Message-ID: d7dd1ccf-9815-89c3-c883-942a3f0b0ab0@comcast.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-performance

On 8/10/2017 1:29 AM, ldh(at)laurent-hasson(dot)com wrote:
> 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?

The standard joke reply is:

Because it messes up the order in which people normally read.
> Why is top-posting such a bad thing?
>> Top-posting.
>>> What is the most annoying thing in e-mail?

<grin>

It is just convention, but with a good reason: most posts in groups are
part of a discussion, and it's hard to follow a discussion when replies
are far from the comment or question that provoked them. The convention
for discussion is "interleaved" style.

The email top posting convention serves a different purpose: to preserve
a record of the communication. Polite people often use a mix of
styles: copying the [latest portion of the ] quoted message to the top
and replying to it inline (as with a discussion).

see https://en.wikipedia.org/wiki/Posting_style

Then too, there is the issue of editing. With an email, typically only
a handful of people will receive it. With a public group or mailing
list, all of the participants - perhaps thousands - will receive the
post. When lots of people in a popular discussion quote the entire
message, it quickly grows to an unwieldy size and eventually will be
rejected by the servers.

The polite thing when replying is to edit the original message to
include just information relevant to your reply, and then reply inline.
Leave archiving of the discussion to the servers.

> 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'

Your problem still may be related to the shutdown delay.

The way it works is: Windows sends a shutdown message to the service,
and the service replies with an estimate of how long it will take to
stop. Until the service terminates, Windows waits and periodically
polls the service asking for its progress. Windows continues to wait
until the service process either terminates, or until the system
configured "drop-dead" timeout occurs, at which time Windows forcibly
kills the service and continues with the shutdown.

The problem is that Postgresql is not a single process: pg_ctl spawns a
bunch of children. Looking further at the source, I believe pg_ctl is
waiting for the children to terminate before stopping itself - but it is
NOT responding to Windows progress messages, so Windows has no idea
whether it is making headway or needs more time to complete.

Windows has no idea that those other processes are connected to the
Postgresql service, so if it times out and kills pg_ctl, it assumes it
is done with Postgresql. The other processes then may be killed whether
or not they are finished.

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

I saw some of the other responses re: that issue.

As I mentioned previously, an unlogged table will be truncated on
startup if it is dirty - i.e. there were any updates that haven't
survived at least one checkpoint. The only thing you could try to do is
force a checkpoint immediately following an unlogged table write. But
that is expensive performance wise and is not encouraged.

https://www.postgresql.org/docs/current/static/sql-checkpoint.html

George

In response to

Browse pgsql-performance by date

  From Date Subject
Next Message George Neuner 2017-08-10 22:52:46 Re: Unlogged tables
Previous Message ldh@laurent-hasson.com 2017-08-10 05:29:35 Re: Unlogged tables