Re: B-tree descend for insertion locking
От | Amit Kapila |
---|---|
Тема | Re: B-tree descend for insertion locking |
Дата | |
Msg-id | CAA4eK1Jz2j3RKLkUokOAQ9oLHMW7RGBkBB5t7biEJoELq5x24w@mail.gmail.com обсуждение исходный текст |
Ответ на | B-tree descend for insertion locking (Heikki Linnakangas <hlinnakangas@vmware.com>) |
Список | pgsql-hackers |
On Tue, Mar 18, 2014 at 4:42 PM, Heikki Linnakangas <hlinnakangas@vmware.com> wrote: > When inserting into a B-tree index, all the pages are read-locked when > descending the tree. When we reach the leaf page, the read-lock is exchanged > for a write-lock. > > There's nothing wrong with that, but why don't we just directly grab a > write-lock on the leaf page? When descending, we know the level we're on, > and what level the child page is. The only downside I can see is that we > would unnecessarily hold a write-lock when a read-lock would suffice, if the > page was just split and we have to move right. But that seems like a really > bad bet - hitting the page when it was just split is highly unlikely. Another case could be when the page is half dead or deleted, but again chances of same are relatively less. With Regards, Amit Kapila. EnterpriseDB: http://www.enterprisedb.com
В списке pgsql-hackers по дате отправления: