Re: Tid scan increments value of pg_stat_all_tables.seq_scan. (but not seq_tup_read)

From: Fujii Masao <masao(dot)fujii(at)oss(dot)nttdata(dot)com>
To: Kasahara Tatsuhito <kasahara(dot)tatsuhito(at)gmail(dot)com>, Andres Freund <andres(at)anarazel(dot)de>
Cc: Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: Tid scan increments value of pg_stat_all_tables.seq_scan. (but not seq_tup_read)
Date: 2020-02-06 06:24:48
Message-ID: aa9388b6-f9b1-edfc-9ec1-5a514b932449@oss.nttdata.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020/02/06 15:04, Kasahara Tatsuhito wrote:
> Hi,
>
> On Thu, Feb 6, 2020 at 11:48 AM Andres Freund <andres(at)anarazel(dot)de> wrote:
>> I think it'd be good if we could guard against b) via an isolation
>> test. It's more painful to do that for a), due to the unreliability of
>> stats at the moment (we have some tests, but they take a long time).
> Thanks for your advise, and agreed.
>
> I added a new (but minimal) isolation test for the case of tid scan.
> (v12 and HEAD will be failed this test. v11 and HEAD with my patch
> will be passed)

Isn't this test scenario a bit overkill? We can simply test that
as follows, instead.

CREATE TABLE test_tidscan AS SELECT 1 AS id;
BEGIN ISOLATION LEVEL SERIALIZABLE;
SELECT * FROM test_tidscan WHERE ctid = '(0,1)';
SELECT locktype, mode FROM pg_locks WHERE pid = pg_backend_pid() AND mode = 'SIReadLock';
COMMIT;

In the expected file, the result of query looking at pg_locks
should be matched with the following.

locktype | mode
----------+------------
tuple | SIReadLock

BTW, in master branch, locktype in that query result is "relation"
because of the issue.

Regards,

--
Fujii Masao
NTT DATA CORPORATION
Advanced Platform Technology Group
Research and Development Headquarters

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Amit Kapila 2020-02-06 06:40:42 Re: typo in set_rel_consider_parallel()
Previous Message Laurenz Albe 2020-02-06 06:18:00 Re: Make ringbuffer threshold and ringbuffer sizes configurable?