Commit 5b0d7f69 authored by Simon Riggs's avatar Simon Riggs

Use pg_stat_get_xact* functions within xacts

Resolve build farm failures from c203d6cf,
diagnosed by Tom Lane.

The output of pg_stat_get_xact_tuples_hot_updated() and friends
is not guaranteed to show anything after the transaction completes.
Data is flushed slowly to stats collector, so using them can
give timing issues.
parent f4f5845b
begin;
create table keyvalue(id integer primary key, info jsonb);
create index nameindex on keyvalue((info->>'name')) with (recheck_on_update=false);
insert into keyvalue values (1, '{"name": "john", "data": "some data"}');
......@@ -8,7 +9,8 @@ select pg_stat_get_xact_tuples_hot_updated('keyvalue'::regclass);
0
(1 row)
drop table keyvalue;
rollback;
begin;
create table keyvalue(id integer primary key, info jsonb);
create index nameindex on keyvalue((info->>'name')) with (recheck_on_update=true);
insert into keyvalue values (1, '{"name": "john", "data": "some data"}');
......@@ -33,7 +35,8 @@ select pg_stat_get_xact_tuples_hot_updated('keyvalue'::regclass);
2
(1 row)
drop table keyvalue;
rollback;
begin;
create table keyvalue(id integer primary key, info jsonb);
create index nameindex on keyvalue((info->>'name'));
insert into keyvalue values (1, '{"name": "john", "data": "some data"}');
......@@ -58,4 +61,4 @@ select pg_stat_get_xact_tuples_hot_updated('keyvalue'::regclass);
2
(1 row)
drop table keyvalue;
rollback;
begin;
create table keyvalue(id integer primary key, info jsonb);
create index nameindex on keyvalue((info->>'name')) with (recheck_on_update=false);
insert into keyvalue values (1, '{"name": "john", "data": "some data"}');
update keyvalue set info='{"name": "john", "data": "some other data"}' where id=1;
select pg_stat_get_xact_tuples_hot_updated('keyvalue'::regclass);
drop table keyvalue;
rollback;
begin;
create table keyvalue(id integer primary key, info jsonb);
create index nameindex on keyvalue((info->>'name')) with (recheck_on_update=true);
insert into keyvalue values (1, '{"name": "john", "data": "some data"}');
......@@ -14,8 +16,9 @@ update keyvalue set info='{"name": "smith", "data": "some other data"}' where id
select pg_stat_get_xact_tuples_hot_updated('keyvalue'::regclass);
update keyvalue set info='{"name": "smith", "data": "some more data"}' where id=1;
select pg_stat_get_xact_tuples_hot_updated('keyvalue'::regclass);
drop table keyvalue;
rollback;
begin;
create table keyvalue(id integer primary key, info jsonb);
create index nameindex on keyvalue((info->>'name'));
insert into keyvalue values (1, '{"name": "john", "data": "some data"}');
......@@ -25,6 +28,6 @@ update keyvalue set info='{"name": "smith", "data": "some other data"}' where id
select pg_stat_get_xact_tuples_hot_updated('keyvalue'::regclass);
update keyvalue set info='{"name": "smith", "data": "some more data"}' where id=1;
select pg_stat_get_xact_tuples_hot_updated('keyvalue'::regclass);
drop table keyvalue;
rollback;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment