61514

How to decide order of b tree

Question:

B trees are said to be particularly useful in case of huge amount of data that cannot fit in main memory.

My question is then how do we decide order of B tree or how many keys to store in a node ? Or how many children a node should have ?

I came across that everywhere people are using 4/5 keys per node. How does it solve the huge data and disk read problem ?

Answer1:

Typically, you'd choose the order so that the resulting node is as large as possible while still fitting into the block device page size. If you're trying to build a B-tree for an on-disk database, you'd probably pick the order such that each node fits into a single disk page, thereby minimizing the number of disk reads and writes necessary to perform each operation. If you wanted to build an in-memory B-tree, you'd likely pick either the L2 or L3 cache line sizes as your target and try to fit as many keys as possible into a node without exceeding that size. In either case, you'd have to look up the specs to determine what size to use.

Of course, you could always just experiment and try to determine this empirically as well. :-)

Hope this helps!

Recommend

  • this, owner, delegate in Groovy closure
  • How do i get rid of call __x86.get_pc_thunk.ax
  • compareTo(K) in java.lang.Comparable cannot be applied to (java.lang.Comparable)
  • Extract images with podofo from pdf pages
  • iOS Dev: Segue by pressing a button in an Alert?
  • how do i auto increment a value in firebase
  • Python + Tkinter Windows 7 taskbar progress
  • Azure function C#: Create or replace document in cosmos db on HTTP request
  • Byte Array to *Signed* Int
  • How to use Sanitize on HTML Entity
  • How to use apoc.load.csv in conjunction with apoc.create.node
  • How do I get partial cell styling in excel using EPpplus?
  • Get Network Interface Names and Set All to DHCP Batch Script
  • exception thrown while building the java application using netbeans
  • JQuery and PHP validation problem?
  • Can the use of C++11's 'auto' deteriorate performance or even break the code?
  • Angular not getting response when it's a non-200
  • Carrierwave default image doesn't display
  • Multiple custom authentication with spring security
  • How to concatenate data.frame inside lists by using names?
  • how to change the black color to Red with opencv python
  • Pyinstaller GLIBC_2.15 not found
  • Saving CLLocation error: Mutating method sent to immutable object
  • Can Node.JS on OpenShift be upgraded?
  • Django REST framework - HyperlinkedRelatedField with additional parameter
  • Get name of days between two date in ios?
  • Splitting ReportLab table across PDF page (side by side)?
  • Facebook Error (#200) The user hasn't authorized the application to perform this action (PHP)
  • How to load dynamic images in custom ListView
  • What is the difference between dynamically creating a script tag and statically embed a script tag?
  • VS2010 RDLC C#. How can I set a LocalReport object to a ReportViewer?
  • How to include associated objects using gon in Rails/jQuery
  • How can I ssh into a server that requires 2 password authentication using python's paramiko mod
  • Google App Engine backend servlet not responding
  • Background transfer download task failed when app was closed
  • XEP-0166: Jingle protocol implementation for voice/video chat in iOS
  • Write to .csv file with PHP (Commas in Data Error)
  • How to mutate multiple variables without repeating codes?