On 15.07.2020 02:17, Alvaro Herrera wrote:
On 2020-Jul-10, Konstantin Knizhnik wrote:

@@ -3076,6 +3080,10 @@ relation_needs_vacanalyze(Oid relid,
                instuples = tabentry->inserts_since_vacuum;
                anltuples = tabentry->changes_since_analyze;
+ rel = RelationIdGetRelation(relid);
+               oldestXmin = 
TransactionIdLimitedForOldSnapshots(GetOldestXmin(rel, PROCARRAY_FLAGS_VACUUM), 
rel);
+               RelationClose(rel);
*cough*

Sorry, Alvaro.
Can you explain this *cough*
You didn't like that relation is openedĀ  just to call GetOldestXmin?
But this functions requires Relation. Do you suggest to rewrite it so that it is possible to pass just Oid of relation?

Or you do you think that such calculation of oldestSmin is obscure and at lest requires some comment? Actually, I have copied it from vacuum.c and there is a large comment explaining why it is calculated in thisĀ  way.
May be it is enough to add reference to vacuum.c?
Or may be create some special function for it?
I just need to oldestXmin in calculated in the same way in vacuum.c and autovacuum.c



Reply via email to