From: | Andres Freund <andres(at)anarazel(dot)de> |
---|---|
To: | Michael Paquier <michael(at)paquier(dot)xyz> |
Cc: | Dave Page <dpage(at)pgadmin(dot)org>, Vik Fearing <vik(at)postgresfriends(dot)org>, Matthias van de Meent <boekewurm+postgres(at)gmail(dot)com>, PostgreSQL Developers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: Tracking last scan time |
Date: | 2022-10-12 22:52:36 |
Message-ID: | 20221012225236.r4tdvprilkhdwhdu@awork3.anarazel.de |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hi,
On 2022-10-12 12:50:31 -0700, Andres Freund wrote:
> I think this should have at a basic test in src/test/regress/sql/stats.sql. If
> I can write one in a few minutes I'll go for that, otherwise will reply
> detailing difficulties.
Took a bit longer (+lunch). Attached.
In the attached 0001, the patch to make GetCurrentTransactionStopTimestamp()
set xactStopTimestamp, I added a few comment updates and an Assert() to ensure
that CurrentTransactionState->state is TRANS_(DEFAULT|COMMIT|ABORT|PREPARE). I
am worried that otherwise we might end up with someone ending up using it in a
place before the end of the transaction, which'd then end up recording the
wrong timestamp in the commit/abort record.
For 0002, the commit adding lastscan, I added catversion/stats version bumps
(because I was planning to commit it already...), a commit message, and that
minor docs change mentioned earlier.
0003 adds the tests mentioned above. I plan to merge them with 0002, but left
them separate for easier review for now.
To be able to compare timestamps for > not just >= we need to make sure that
two subsequent timestamps differ. The attached achieves this by sleeping for
100ms between those points - we do that in other places already. I'd started
out with 10ms, which I am fairly sure would suffice, but then deciced to copy
the existing 100ms sleeps.
I verified tests pass under valgrind, debug_discard_caches and after I make
pgstat_report_stat() only flush when force is passed in.
Greetings,
Andres Freund
Attachment | Content-Type | Size |
---|---|---|
v5-0001-Have-GetCurrentTransactionStopTimestamp-set-xactS.patch | text/x-diff | 4.0 KB |
v5-0002-pgstat-Track-time-of-the-last-scan-of-a-relation.patch | text/x-diff | 10.6 KB |
v5-0003-pgstat-Add-tests-for-last_seq_scan-last_idx_scan.patch | text/x-diff | 10.7 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Nikita Malakhov | 2022-10-12 23:13:23 | Re: Pluggable toaster |
Previous Message | Lyu Pan | 2022-10-12 22:36:00 | Re: Bloom filter Pushdown Optimization for Merge Join |