Re: Sequential vs. random values - number of pages in B-tree

From: "Ilya Kazakevich" <Ilya(dot)Kazakevich(at)JetBrains(dot)com>
To: "'pinker'" <pinker(at)onet(dot)eu>, <pgsql-general(at)postgresql(dot)org>
Subject: Re: Sequential vs. random values - number of pages in B-tree
Date: 2016-08-18 12:00:31
Message-ID: 006201d1f948$1ebd9ec0$5c38dc40$@JetBrains.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi,

>What's the reason that postgres needs more index pages to store random
>data
>than sequential ones?

I assume that is because B-Tree is self-balanced tree, so it needs to be
rebalanced after each insertion.
Random insertions may go to the head of index where no space left leading to
huge data moving.
https://en.wikipedia.org/wiki/B-tree#Insertions_and_deletions

Ilya Kazakevich

JetBrains
http://www.jetbrains.com
The Drive to Develop

In response to

Browse pgsql-general by date

  From Date Subject
Next Message pinker 2016-08-18 12:03:02 Re: Sequential vs. random values - number of pages in B-tree
Previous Message David G. Johnston 2016-08-18 11:39:30 Re: PGPASSWORD - More than one in a bash script