Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit569659a

Browse files
committed
Improve btree's initial-positioning-strategy code so that we never need
to step more than one entry after descending the search tree to arrive atthe correct place to start the scan. This can improve the behaviorsubstantially when there are many entries equal to the chosen boundaryvalue. Per suggestion from Dmitry Tkach, 14-Jul-03.
1 parent772d0f9 commit569659a

File tree

4 files changed

+187
-129
lines changed

4 files changed

+187
-129
lines changed

‎src/backend/access/nbtree/nbtinsert.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.109 2003/11/29 19:51:40 pgsql Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.110 2003/12/21 01:23:06 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -86,8 +86,8 @@ _bt_doinsert(Relation rel, BTItem btitem,
8686
itup_scankey=_bt_mkscankey(rel,itup);
8787

8888
top:
89-
/* find the page containing this key */
90-
stack=_bt_search(rel,natts,itup_scankey,&buf,BT_WRITE);
89+
/* find thefirstpage containing this key */
90+
stack=_bt_search(rel,natts,itup_scankey,false,&buf,BT_WRITE);
9191

9292
/* trade in our read lock for a write lock */
9393
LockBuffer(buf,BUFFER_LOCK_UNLOCK);
@@ -100,7 +100,7 @@ _bt_doinsert(Relation rel, BTItem btitem,
100100
* need to move right in the tree.See Lehman and Yao for an
101101
* excruciatingly precise description.
102102
*/
103-
buf=_bt_moveright(rel,buf,natts,itup_scankey,BT_WRITE);
103+
buf=_bt_moveright(rel,buf,natts,itup_scankey,false,BT_WRITE);
104104

105105
/*
106106
* If we're not allowing duplicates, make sure the key isn't already
@@ -175,7 +175,7 @@ _bt_check_unique(Relation rel, BTItem btitem, Relation heapRel,
175175
* Find first item >= proposed new item. Note we could also get a
176176
* pointer to end-of-page here.
177177
*/
178-
offset=_bt_binsrch(rel,buf,natts,itup_scankey);
178+
offset=_bt_binsrch(rel,buf,natts,itup_scankey, false);
179179

180180
/*
181181
* Scan over all equal tuples, looking for live conflicts.
@@ -478,7 +478,7 @@ _bt_insertonpg(Relation rel,
478478
if (movedright)
479479
newitemoff=P_FIRSTDATAKEY(lpageop);
480480
else
481-
newitemoff=_bt_binsrch(rel,buf,keysz,scankey);
481+
newitemoff=_bt_binsrch(rel,buf,keysz,scankey, false);
482482
}
483483

484484
/*

‎src/backend/access/nbtree/nbtpage.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
*
1010
*
1111
* IDENTIFICATION
12-
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.73 2003/11/29 19:51:40 pgsql Exp $
12+
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtpage.c,v 1.74 2003/12/21 01:23:06 tgl Exp $
1313
*
1414
*NOTES
1515
* Postgres btree pages look like ordinary relation pages.The opaque
@@ -804,7 +804,7 @@ _bt_pagedel(Relation rel, Buffer buf, bool vacuum_full)
804804
/* we need a scan key to do our search, so build one */
805805
itup_scankey=_bt_mkscankey(rel,&(targetkey->bti_itup));
806806
/* find the leftmost leaf page containing this key */
807-
stack=_bt_search(rel,rel->rd_rel->relnatts,itup_scankey,
807+
stack=_bt_search(rel,rel->rd_rel->relnatts,itup_scankey, false,
808808
&lbuf,BT_READ);
809809
/* don't need a pin on that either */
810810
_bt_relbuf(rel,lbuf);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp