|From:||Kyotaro HORIGUCHI <horiguchi(dot)kyotaro(at)lab(dot)ntt(dot)co(dot)jp>|
|Cc:||thomas(dot)munro(at)enterprisedb(dot)com, sfrost(at)snowman(dot)net, michael(dot)paquier(at)gmail(dot)com, daniel(at)yesql(dot)se, andres(at)anarazel(dot)de, sawada(dot)mshk(at)gmail(dot)com, a(dot)lubennikova(at)postgrespro(dot)ru, lubennikovaav(at)gmail(dot)com, pgsql-hackers(at)postgresql(dot)org|
|Subject:||Re: [HACKERS] Vacuum: allow usage of more than 1GB of work mem|
|Views:||Raw Message | Whole Thread | Download mbox | Resend email|
Hello, I looked this a bit closer.
In upthread Robert mentioned the exponentially increasing size
of additional segments.
>> Hmm, I had imagined making all of the segments the same size rather
>> than having the size grow exponentially. The whole point of this is
>> to save memory, and even in the worst case you don't end up with that
>> many segments as long as you pick a reasonable base size (e.g. 64MB).
> Wastage is bound by a fraction of the total required RAM, that is,
> it's proportional to the amount of required RAM, not the amount
> allocated. So it should still be fine, and the exponential strategy
> should improve lookup performance considerably.
It seems that you are getting him wrong. (Anyway I'm not sure
what you meant by the above. not-yet-allocated memory won't be a
waste.) The conclusive number of dead tuples in a heap scan is
undeteminable until the scan ends. If we had a new dead tuple
required a, say 512MB new segment and the scan ends just after,
the wastage will be almost the whole of the segment.
On the other hand, I don't think the exponential strategy make
things considerably better. bsearch iterations in
lazy_tid_reaped() are distributed between segment search and tid
search. Intuitively more or less the increased segment size just
moves some iterations of the former to the latter.
I made a calculation. With maintemance_work_mem of 4096MB, the
number of segments is 6 and expected number of bsearch iteration
is about 20.8 for the exponential strategy. With 64MB fixed size
segments, we will have 64 segments (that is not so many) and the
expected iteration is 20.4. (I suppose the increase comes from
the imbalanced size among segments.) Addition to that, as Robert
mentioned, the possible maximum memory wastage of the exponential
strategy is about 2GB and 64MB in fixed size strategy.
Seeing these numbers, I don't tend to take the exponential
 See attached perl script. I hope it is correct.
NTT Open Source Software Center
|Next Message||Etsuro Fujita||2018-02-08 05:53:38||Re: postgres_fdw: perform UPDATE/DELETE .. RETURNING on a join directly|
|Previous Message||Amit Langote||2018-02-08 05:11:07||Re: [HACKERS] advanced partition matching algorithm for partition-wise join|