optimize the value of vacthresh and anlthresh

Started by wenhui qiuabout 2 years ago5 messageshackers

Thread notes

1 note#performance#minor#enhancement
hackorum-bot#performance#minor#enhancement
hackorum-bot
1 day ago

@global #performance #minor #enhancement

#performance#minor#enhancement
Jump to latest
#1wenhui qiu
qiuwenhuifx@gmail.com

Hi hackers
A few days ago, I was looking at the sql server documentation and found
that sql server has optimized the algorithm related to updating statistics
in the 2016 ,version,I think we can also learn from the implementation
method of sql server to optimize the problem of automatic vacuum triggered
by large tables,The Document link(
https://learn.microsoft.com/en-us/sql/relational-databases/statistics/statistics?view=sql-server-ver16),I
refer to the sql server implementation method, submit a patch, please see
the attachment, hope to get the help of expert hackers

Attachments:

0001-optimize-the-value-of-vacthresh-and-anlthresh.patchapplication/octet-stream; name=0001-optimize-the-value-of-vacthresh-and-anlthresh.patchDownload+8-4
#2wenhui qiu
qiuwenhuifx@gmail.com
In reply to: wenhui qiu (#1)
Re: optimize the value of vacthresh and anlthresh

Hi hackers
I find that the arithmetic square root is not very smooth, and the
logarithmic function is smoother,Looking at the graph, the log function
algorithm might be more appropriate,I want to hear from the experts

sqrt

[image: image.png]
log2

[image: image.png]

log
[image: image.png]
orginal
[image: image.png]
postgres=# select ln(100000)*1000;
?column?
--------------------
11512.925464970229
(1 row)

postgres=# select log(2,100000)*1000;
?column?
-----------------------
16609.640474436812000
(1 row)

postgres=#

postgres=# select log(10,100000)*1000;
?column?
----------------------
5000.000000000000000
(1 row)

wenhui qiu <qiuwenhuifx@gmail.com> 于2024年11月4日周一 16:30写道:

Show quoted text

Hi hackers
A few days ago, I was looking at the sql server documentation and
found that sql server has optimized the algorithm related to updating
statistics in the 2016 ,version,I think we can also learn from the
implementation method of sql server to optimize the problem of automatic
vacuum triggered by large tables,The Document link(
https://learn.microsoft.com/en-us/sql/relational-databases/statistics/statistics?view=sql-server-ver16),I
refer to the sql server implementation method, submit a patch, please see
the attachment, hope to get the help of expert hackers

Attachments:

image.pngimage/png; name=image.pngDownload
image.pngimage/png; name=image.pngDownload+0-3
image.pngimage/png; name=image.pngDownload+2-1
image.pngimage/png; name=image.pngDownload+2-6
#3wenhui qiu
qiuwenhuifx@gmail.com
In reply to: wenhui qiu (#2)
Re: optimize the value of vacthresh and anlthresh

Hi hackers
Here new path , I think it is most appropriate to use a logarithmic
function with base 2

Thanks

wenhui qiu <qiuwenhuifx@gmail.com> 于2024年11月6日周三 11:44写道:

Show quoted text

Hi hackers
I find that the arithmetic square root is not very smooth, and the
logarithmic function is smoother,Looking at the graph, the log function
algorithm might be more appropriate,I want to hear from the experts

sqrt

[image: image.png]
log2

[image: image.png]

log
[image: image.png]
orginal
[image: image.png]
postgres=# select ln(100000)*1000;
?column?
--------------------
11512.925464970229
(1 row)

postgres=# select log(2,100000)*1000;
?column?
-----------------------
16609.640474436812000
(1 row)

postgres=#

postgres=# select log(10,100000)*1000;
?column?
----------------------
5000.000000000000000
(1 row)

wenhui qiu <qiuwenhuifx@gmail.com> 于2024年11月4日周一 16:30写道:

Hi hackers
A few days ago, I was looking at the sql server documentation and
found that sql server has optimized the algorithm related to updating
statistics in the 2016 ,version,I think we can also learn from the
implementation method of sql server to optimize the problem of automatic
vacuum triggered by large tables,The Document link(
https://learn.microsoft.com/en-us/sql/relational-databases/statistics/statistics?view=sql-server-ver16),I
refer to the sql server implementation method, submit a patch, please see
the attachment, hope to get the help of expert hackers

Attachments:

t50502_3
image.pngimage/png; name=image.pngDownload
image.pngimage/png; name=image.pngDownload+0-3
image.pngimage/png; name=image.pngDownload+2-1
image.pngimage/png; name=image.pngDownload+2-6
0002-optimize-the-value-of-vacthresh-and-anlthresh.patchapplication/octet-stream; name=0002-optimize-the-value-of-vacthresh-and-anlthresh.patchDownload+3-4
#4Frédéric Yhuel
frederic.yhuel@dalibo.com
In reply to: wenhui qiu (#1)
Re: optimize the value of vacthresh and anlthresh

On 11/4/24 09:30, wenhui qiu wrote:

Hi hackers
    A few days ago, I was looking at the sql server documentation and
found that sql server has optimized the algorithm related to updating
statistics in the 2016 ,version,I think we can also learn from the
implementation method of sql server to optimize the problem of automatic
vacuum triggered by large tables,The Document
link(https://learn.microsoft.com/en-us/sql/relational-databases/statistics/statistics?view=sql-server-ver16 <https://learn.microsoft.com/en-us/sql/relational-databases/statistics/statistics?view=sql-server-ver16>),I refer to the sql server implementation method, submit a patch, please see the attachment, hope to get the help of expert hackers

similar idea here :
/messages/by-id/6a2ac9b7-6535-4bb1-8274-0647f7c31c82@dalibo.com

#5wenhui qiu
qiuwenhuifx@gmail.com
In reply to: Frédéric Yhuel (#4)
Re: optimize the value of vacthresh and anlthresh

Hi Frédéric
many thanks for your email。
I'll go and see.

On Wed, 6 Nov 2024 at 17:47, Frédéric Yhuel <frederic.yhuel@dalibo.com>
wrote:

Show quoted text

On 11/4/24 09:30, wenhui qiu wrote:

Hi hackers
A few days ago, I was looking at the sql server documentation and
found that sql server has optimized the algorithm related to updating
statistics in the 2016 ,version,I think we can also learn from the
implementation method of sql server to optimize the problem of automatic
vacuum triggered by large tables,The Document
link(

https://learn.microsoft.com/en-us/sql/relational-databases/statistics/statistics?view=sql-server-ver16
<
https://learn.microsoft.com/en-us/sql/relational-databases/statistics/statistics?view=sql-server-ver16>),I
refer to the sql server implementation method, submit a patch, please see
the attachment, hope to get the help of expert hackers

similar idea here :

/messages/by-id/6a2ac9b7-6535-4bb1-8274-0647f7c31c82@dalibo.com