如何测量 SQL 填充因子值

发布于 2024-07-04 04:55:37 字数 111 浏览 8 评论 0原文

通常,当我在表上创建索引时,我通常会根据对表的使用方式(多次读取或多次写入)的有根据的猜测来猜测填充因子应该是什么。

是否有更科学的方法来确定更准确的填充因子值?

Usually when I'm creating indexes on tables, I generally guess what the Fill Factor should be based on an educated guess of how the table will be used (many reads or many writes).

Is there a more scientific way to determine a more accurate Fill Factor value?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

颜漓半夏 2024-07-11 04:55:37

我倾向于认为,如果您追求性能改进,那么您的时间最好花在其他地方,调整您的模式,优化您的查询并确保良好的索引覆盖率。 填充因子是当您知道系统中的其他一切都处于最佳状态时才需要担心的事情之一。 我不知道有谁能这么说。

I would tend to be of the opinion that if you're after performance improvements, your time is much better spent elsewhere, tweaking your schema, optimising your queries and ensuring good index coverage. Fill factor is one of those things that you only need to worry about when you know that everything else in your system is optimal. I don't know anyone that can say that.

路弥 2024-07-11 04:55:37

您可以尝试运行大量实际操作并查看 IO 队列以了解不同的操作。

有很多变量控制它,例如每行的大小以及写入与读取的数量。

基本上:高填充因子 = 读取速度更快,低填充因子 = 写入速度更快。

然而,事情并没有那么简单,因为几乎所有写入都将针对需要首先查找的行的子集。

例如:将填充因子设置为 10%,每次单行更新将花费 10 倍的时间才能找到正在更改的行,即使页面拆分的可能性很小。

通常,您会看到填充因子为 70%(非常高的写入)到 95%(非常高的读取)。

这是一种艺术形式。

我发现填充因子的一个好方法是将其视为地址簿中的页面 - 地址包装得越紧密,更改它们就越困难,但地址簿也越薄。 我想我在我的博客上解释得更好

You could try running a big list of realistic operations and looking at IO queues for the different actions.

There are a lot of variables that govern it, such as the size of each row and the number of writes vs reads.

Basically: high fill factor = quicker read, low = quicker write.

However it's not quite that simple, as almost all writes will be to a subset of rows that need to be looked up first.

For instance: set a fill factor to 10% and each single-row update will take 10 times as long to find the row it's changing, even though a page split would then be very unlikely.

Generally you see fill factors 70% (very high write) to 95% (very high read).

It's a bit of an art form.

I find that a good way of thinking of fill factors is as pages in an address book - the more tightly you pack the addresses the harder it is to change them, but the slimmer the book. I think I explained it better on my blog.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文