Sql-docs: Clarification required for Step 3.1 -- non-leaf level calculations log base (e or 10?)

Created on 28 Jun 2019  ·  15Comments  ·  Source: MicrosoftDocs/sql-docs

Calculate the number of non-leaf levels in the index:

Non-leaf Levels = 1 + log( Index_Rows_Per_Page) (Num_Leaf_Pages / Index_Rows_Per_Page)

It is unclear if the base is 10 or e.
Please refactor this line to indicate this value.


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Pri2 assigned-to-author doc-enhancement sqprod supportabilittech

All 15 comments

@kfarlee -- Kevin, can you please determine the base for this logarithm, is it 10 or e?

@kfarlee -- Kevin, please look into this aging issue 2404.

@CarlRabeler -- can you help get this issue 2404 processed? Thank you.

what makes you suggest that the base is not 10 ?
@swbhartims

The answer is "Neither".

The calculation requires the logarithm to the base of Index_Rows_Per_Page, not base 10 or base e because of how a B*-tree handles the fan-out between the levels of the tree.

However, I would argue that the calculation given is more complex than it needs to be, apologies in advance for the maths about to be thrown around!

It can be shown using simple logarithmic identities (happy to provide a rudimentary proof if needed) that the calculation in the document can be simplified to:
LogIndex_Rows_Per_Page(Num_Leaf_Pages)

Note that I'm defining the base of the logarithm within the "sub" tags (hopefully your flavour of Markdown recognises sub- and superscript!) and the value whose logarithm is to be calculated within the ellipses for clarity here.

If you absolutely have to have the calculation in base-10 (perhaps because you don't have a calculator that can do arbitrary-base logarithm calculations), another logarithmic identity allows us to transform the simplified form I gave above to base-10:
Log10(Num_Leaf_Pages) / Log10(Index_Rows_Per_Page)

Hope that helps!

@CarlRabeler - I brought up this request as it is not clear what base must be chosen - either e or 10. An educated guess would make me assume that it is to the base 10. However, I would appreciate if the instructions included this specification as well.

@RobAshton-IM Thanks for the clarification :)
Would the documentation be updated to reflect this?

@swbhartims I've taken a fork of the page as I have noticed a few typos and copy-paste errors between the sections that I was planning on submitting issues and PR's for myself, happy to include a fix for this issue if no-one else gets to it before me :)

@RobAshton-IM Thank you so much 👍

@kfarlee can you review please

@RobAshton-IM Hi Rob - have you made any progress in updating the page? Thanks, Carl

@RobAshton-IM Thanks, again, for your input. Did you create an update to the page? Let me know how we can help. @CarlRabeler is out of the office for the next few weeks, but I will take over this and help out as needed. @swbhartims Thanks for your question and your patience as we look into the right next steps.

@rothja Hi Jason, I'm having a ton of issues with GitHub Desktop at work, so I'm probably going to end up doing this at home I think. I'm going to spend some time over the weekend on it, so watch this space :)

As @RobAshton-IM has provided an answer and is working on the suggested doc updates, I am going to close this issue. @swbhartims Thank you for your feedback, and please accept my apologies for any delay in our response on this. I hope we can make this more clear going forward. Thank you!!

Thanks @rothja :)

Was this page helpful?
0 / 5 - 0 ratings