@@ -1137,10 +1137,10 @@ SELECT pg_stat_get_subscription_stats(NULL);
1137
1137
-- Create a regular table and insert some data to generate IOCONTEXT_NORMAL
1138
1138
-- extends.
1139
1139
SELECT sum(extends) AS io_sum_shared_before_extends
1140
- FROM pg_stat_io WHERE io_context = 'normal' AND io_object = 'relation' \gset
1140
+ FROM pg_stat_io WHERE context = 'normal' AND object = 'relation' \gset
1141
1141
SELECT sum(writes) AS writes, sum(fsyncs) AS fsyncs
1142
1142
FROM pg_stat_io
1143
- WHERE io_object = 'relation' \gset io_sum_shared_before_
1143
+ WHERE object = 'relation' \gset io_sum_shared_before_
1144
1144
CREATE TABLE test_io_shared(a int);
1145
1145
INSERT INTO test_io_shared SELECT i FROM generate_series(1,100)i;
1146
1146
SELECT pg_stat_force_next_flush();
@@ -1150,7 +1150,7 @@ SELECT pg_stat_force_next_flush();
1150
1150
(1 row)
1151
1151
1152
1152
SELECT sum(extends) AS io_sum_shared_after_extends
1153
- FROM pg_stat_io WHERE io_context = 'normal' AND io_object = 'relation' \gset
1153
+ FROM pg_stat_io WHERE context = 'normal' AND object = 'relation' \gset
1154
1154
SELECT :io_sum_shared_after_extends > :io_sum_shared_before_extends;
1155
1155
?column?
1156
1156
----------
@@ -1164,7 +1164,7 @@ CHECKPOINT;
1164
1164
CHECKPOINT;
1165
1165
SELECT sum(writes) AS writes, sum(fsyncs) AS fsyncs
1166
1166
FROM pg_stat_io
1167
- WHERE io_object = 'relation' \gset io_sum_shared_after_
1167
+ WHERE object = 'relation' \gset io_sum_shared_after_
1168
1168
SELECT :io_sum_shared_after_writes > :io_sum_shared_before_writes;
1169
1169
?column?
1170
1170
----------
@@ -1181,13 +1181,13 @@ SELECT current_setting('fsync') = 'off'
1181
1181
-- Change the tablespace so that the table is rewritten directly, then SELECT
1182
1182
-- from it to cause it to be read back into shared buffers.
1183
1183
SELECT sum(reads) AS io_sum_shared_before_reads
1184
- FROM pg_stat_io WHERE io_context = 'normal' AND io_object = 'relation' \gset
1184
+ FROM pg_stat_io WHERE context = 'normal' AND object = 'relation' \gset
1185
1185
-- Do this in a transaction to prevent spurious failures due to concurrent accesses to our newly
1186
1186
-- rewritten table, e.g. by autovacuum.
1187
1187
BEGIN;
1188
1188
ALTER TABLE test_io_shared SET TABLESPACE regress_tblspace;
1189
1189
-- SELECT from the table so that the data is read into shared buffers and
1190
- -- io_context 'normal', io_object 'relation' reads are counted.
1190
+ -- context 'normal', object 'relation' reads are counted.
1191
1191
SELECT COUNT(*) FROM test_io_shared;
1192
1192
count
1193
1193
-------
@@ -1202,15 +1202,15 @@ SELECT pg_stat_force_next_flush();
1202
1202
(1 row)
1203
1203
1204
1204
SELECT sum(reads) AS io_sum_shared_after_reads
1205
- FROM pg_stat_io WHERE io_context = 'normal' AND io_object = 'relation' \gset
1205
+ FROM pg_stat_io WHERE context = 'normal' AND object = 'relation' \gset
1206
1206
SELECT :io_sum_shared_after_reads > :io_sum_shared_before_reads;
1207
1207
?column?
1208
1208
----------
1209
1209
t
1210
1210
(1 row)
1211
1211
1212
1212
SELECT sum(hits) AS io_sum_shared_before_hits
1213
- FROM pg_stat_io WHERE io_context = 'normal' AND io_object = 'relation' \gset
1213
+ FROM pg_stat_io WHERE context = 'normal' AND object = 'relation' \gset
1214
1214
-- Select from the table again to count hits.
1215
1215
-- Ensure we generate hits by forcing a nested loop self-join with no
1216
1216
-- materialize node. The outer side's buffer will stay pinned, preventing its
@@ -1243,7 +1243,7 @@ SELECT pg_stat_force_next_flush();
1243
1243
(1 row)
1244
1244
1245
1245
SELECT sum(hits) AS io_sum_shared_after_hits
1246
- FROM pg_stat_io WHERE io_context = 'normal' AND io_object = 'relation' \gset
1246
+ FROM pg_stat_io WHERE context = 'normal' AND object = 'relation' \gset
1247
1247
SELECT :io_sum_shared_after_hits > :io_sum_shared_before_hits;
1248
1248
?column?
1249
1249
----------
@@ -1264,7 +1264,7 @@ SET temp_buffers TO 100;
1264
1264
CREATE TEMPORARY TABLE test_io_local(a int, b TEXT);
1265
1265
SELECT sum(extends) AS extends, sum(evictions) AS evictions, sum(writes) AS writes
1266
1266
FROM pg_stat_io
1267
- WHERE io_context = 'normal' AND io_object = 'temp relation' \gset io_sum_local_before_
1267
+ WHERE context = 'normal' AND object = 'temp relation' \gset io_sum_local_before_
1268
1268
-- Insert tuples into the temporary table, generating extends in the stats.
1269
1269
-- Insert enough values that we need to reuse and write out dirty local
1270
1270
-- buffers, generating evictions and writes.
@@ -1277,7 +1277,7 @@ SELECT pg_relation_size('test_io_local') / current_setting('block_size')::int8 >
1277
1277
(1 row)
1278
1278
1279
1279
SELECT sum(reads) AS io_sum_local_before_reads
1280
- FROM pg_stat_io WHERE io_context = 'normal' AND io_object = 'temp relation' \gset
1280
+ FROM pg_stat_io WHERE context = 'normal' AND object = 'temp relation' \gset
1281
1281
-- Read in evicted buffers, generating reads.
1282
1282
SELECT COUNT(*) FROM test_io_local;
1283
1283
count
@@ -1296,7 +1296,7 @@ SELECT sum(evictions) AS evictions,
1296
1296
sum(writes) AS writes,
1297
1297
sum(extends) AS extends
1298
1298
FROM pg_stat_io
1299
- WHERE io_context = 'normal' AND io_object = 'temp relation' \gset io_sum_local_after_
1299
+ WHERE context = 'normal' AND object = 'temp relation' \gset io_sum_local_after_
1300
1300
SELECT :io_sum_local_after_evictions > :io_sum_local_before_evictions,
1301
1301
:io_sum_local_after_reads > :io_sum_local_before_reads,
1302
1302
:io_sum_local_after_writes > :io_sum_local_before_writes,
@@ -1317,7 +1317,7 @@ SELECT pg_stat_force_next_flush();
1317
1317
(1 row)
1318
1318
1319
1319
SELECT sum(writes) AS io_sum_local_new_tblspc_writes
1320
- FROM pg_stat_io WHERE io_context = 'normal' AND io_object = 'temp relation' \gset
1320
+ FROM pg_stat_io WHERE context = 'normal' AND object = 'temp relation' \gset
1321
1321
SELECT :io_sum_local_new_tblspc_writes > :io_sum_local_after_writes;
1322
1322
?column?
1323
1323
----------
@@ -1335,7 +1335,7 @@ RESET temp_buffers;
1335
1335
-- reads.
1336
1336
SET wal_skip_threshold = '1 kB';
1337
1337
SELECT sum(reuses) AS reuses, sum(reads) AS reads
1338
- FROM pg_stat_io WHERE io_context = 'vacuum' \gset io_sum_vac_strategy_before_
1338
+ FROM pg_stat_io WHERE context = 'vacuum' \gset io_sum_vac_strategy_before_
1339
1339
CREATE TABLE test_io_vac_strategy(a int, b int) WITH (autovacuum_enabled = 'false');
1340
1340
INSERT INTO test_io_vac_strategy SELECT i, i from generate_series(1, 8000)i;
1341
1341
-- Ensure that the next VACUUM will need to perform IO by rewriting the table
@@ -1349,7 +1349,7 @@ SELECT pg_stat_force_next_flush();
1349
1349
(1 row)
1350
1350
1351
1351
SELECT sum(reuses) AS reuses, sum(reads) AS reads
1352
- FROM pg_stat_io WHERE io_context = 'vacuum' \gset io_sum_vac_strategy_after_
1352
+ FROM pg_stat_io WHERE context = 'vacuum' \gset io_sum_vac_strategy_after_
1353
1353
SELECT :io_sum_vac_strategy_after_reads > :io_sum_vac_strategy_before_reads,
1354
1354
:io_sum_vac_strategy_after_reuses > :io_sum_vac_strategy_before_reuses;
1355
1355
?column? | ?column?
@@ -1361,7 +1361,7 @@ RESET wal_skip_threshold;
1361
1361
-- Test that extends done by a CTAS, which uses a BAS_BULKWRITE
1362
1362
-- BufferAccessStrategy, are tracked in pg_stat_io.
1363
1363
SELECT sum(extends) AS io_sum_bulkwrite_strategy_extends_before
1364
- FROM pg_stat_io WHERE io_context = 'bulkwrite' \gset
1364
+ FROM pg_stat_io WHERE context = 'bulkwrite' \gset
1365
1365
CREATE TABLE test_io_bulkwrite_strategy AS SELECT i FROM generate_series(1,100)i;
1366
1366
SELECT pg_stat_force_next_flush();
1367
1367
pg_stat_force_next_flush
@@ -1370,7 +1370,7 @@ SELECT pg_stat_force_next_flush();
1370
1370
(1 row)
1371
1371
1372
1372
SELECT sum(extends) AS io_sum_bulkwrite_strategy_extends_after
1373
- FROM pg_stat_io WHERE io_context = 'bulkwrite' \gset
1373
+ FROM pg_stat_io WHERE context = 'bulkwrite' \gset
1374
1374
SELECT :io_sum_bulkwrite_strategy_extends_after > :io_sum_bulkwrite_strategy_extends_before;
1375
1375
?column?
1376
1376
----------
0 commit comments