Re: Tid scan increments value of pg_stat_all_tables.seq_scan. (butnot seq_tup_read) - Mailing list pgsql-hackers

From Fujii Masao
Subject Re: Tid scan increments value of pg_stat_all_tables.seq_scan. (butnot seq_tup_read)
Date
Msg-id aa9388b6-f9b1-edfc-9ec1-5a514b932449@oss.nttdata.com
Whole thread Raw
In response to Re: Tid scan increments value of pg_stat_all_tables.seq_scan. (butnot seq_tup_read)  (Kasahara Tatsuhito <kasahara.tatsuhito@gmail.com>)
Responses Re: Tid scan increments value of pg_stat_all_tables.seq_scan. (butnot seq_tup_read)
List pgsql-hackers

On 2020/02/06 15:04, Kasahara Tatsuhito wrote:
> Hi,
> 
> On Thu, Feb 6, 2020 at 11:48 AM Andres Freund <andres@anarazel.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



pgsql-hackers by date:

Previous
From: Laurenz Albe
Date:
Subject: Re: Make ringbuffer threshold and ringbuffer sizes configurable?
Next
From: Amit Kapila
Date:
Subject: Re: typo in set_rel_consider_parallel()