--
|
-- src/test/performance/cfs/pgbench_hotupdate.sql
|
--
|
-- Custom pgbench script: random UPDATE of an existing row. Unlike the
|
-- read-write script (which touches a single hot row in a cache-resident
|
-- table), this one is meant to run against a table that is several times
|
-- larger than shared_buffers, so every UPDATE that evicts a dirty page
|
-- forces CFS to compress it and append a new record to the .cfp, leaving
|
-- the previous record as dead space. This is the workload that exposes
|
-- the real CPU cost of CFS compression (see pgbench_writeheavy.sh).
|
--
|
-- pgbench -n -c <clients> -j <threads> -T <seconds> \
|
-- -f pgbench_hotupdate.sql -D scale=50000 -D table=evic_lz4 <db>
|
|
\set id random(1, :scale)
|
UPDATE :table SET payload = repeat('u' || (:id % 50), :payload_len) WHERE id = :id
|