Re: synchronized scan: reset state at end of scan

Lists: pgsql-patches
From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: pgsql-patches(at)postgresql(dot)org
Subject: synchronized scan: reset state at end of scan
Date: 2008-06-01 00:45:14
Message-ID: 1212281114.6360.22.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

I was looking into supporting synchronized scans for VACUUM, and I
noticed that we currently don't remove the reported scan location as
this post suggests:

http://archives.postgresql.org/pgsql-patches/2007-06/msg00047.php

There was some debate about whether it should be done, but I thought
that the solution here seemed to satisfy most people's concerns:

http://archives.postgresql.org/pgsql-patches/2007-06/msg00052.php

I attached a patch that implements the above idea.

The benefit is that if you have a singular scan, it will start at the
beginning of the heap and not at some arbitrary place.

The cost is that it's not 100% guaranteed that the location entry will
be removed. The backend that started the scan could abort, die, etc.
Also, in rare situations there is a small window created where a new
scan might not be synchronized with existing concurrent scans. This is
really only an issue when issuing queries with limits or issuing two
scans that progress at different rates. I think it's somewhat reasonable
to say that if you're doing either of those things, you shouldn't be too
surprised if it messes with synchronized scanning. I have more
information in the comments in the attached patch.

I do not have a strong opinion about whether this patch is applied or
not. I am submitting this just for the sake of completeness.

Regards,
Jeff Davis

Attachment Content-Type Size
syncscan-reset.diff text/x-patch 4.6 KB

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Jeff Davis <pgsql(at)j-davis(dot)com>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: synchronized scan: reset state at end of scan
Date: 2008-06-01 02:01:26
Message-ID: 11636.1212285686@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

Jeff Davis <pgsql(at)j-davis(dot)com> writes:
> I was looking into supporting synchronized scans for VACUUM, and I
> noticed that we currently don't remove the reported scan location as
> this post suggests:

> http://archives.postgresql.org/pgsql-patches/2007-06/msg00047.php

I thought the end conclusion of that thread was to not do anything,
on the grounds that
(1) having new scans sometimes fail to join an existing syncscan
herd would be a bad thing because of the resulting performance
uncertainty;
(2) partially masking the order-nondeterminism created by syncscans
would be a bad thing because it would make it more likely for people
to not notice the issue during testing.

regards, tom lane


From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-patches(at)postgresql(dot)org
Subject: Re: synchronized scan: reset state at end of scan
Date: 2008-06-01 03:38:34
Message-ID: 1212291514.6360.44.camel@jdavis
Views: Raw Message | Whole Thread | Download mbox | Resend email
Lists: pgsql-patches

On Sat, 2008-05-31 at 22:01 -0400, Tom Lane wrote:
> I thought the end conclusion of that thread was to not do anything,
> on the grounds that
> (1) having new scans sometimes fail to join an existing syncscan
> herd would be a bad thing because of the resulting performance
> uncertainty;
> (2) partially masking the order-nondeterminism created by syncscans
> would be a bad thing because it would make it more likely for people
> to not notice the issue during testing.

Ok, I certainly am not pushing for this patch to be applied. I'll
consider it closed.

Regards,
Jeff Davis