OSDN Git Service

(split) Apply minor changes from v3.32 to v3.35 in the upstream.
[linuxjm/LDP_man-pages.git] / draft / man3 / btree.3
1 .\" Copyright (c) 1990, 1993
2 .\"     The Regents of the University of California.  All rights reserved.
3 .\"
4 .\" Redistribution and use in source and binary forms, with or without
5 .\" modification, are permitted provided that the following conditions
6 .\" are met:
7 .\" 1. Redistributions of source code must retain the above copyright
8 .\"    notice, this list of conditions and the following disclaimer.
9 .\" 2. Redistributions in binary form must reproduce the above copyright
10 .\"    notice, this list of conditions and the following disclaimer in the
11 .\"    documentation and/or other materials provided with the distribution.
12 .\" 3. All advertising materials mentioning features or use of this software
13 .\"    must display the following acknowledgement:
14 .\"     This product includes software developed by the University of
15 .\"     California, Berkeley and its contributors.
16 .\" 4. Neither the name of the University nor the names of its contributors
17 .\"    may be used to endorse or promote products derived from this software
18 .\"    without specific prior written permission.
19 .\"
20 .\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
21 .\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 .\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 .\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
24 .\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 .\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
26 .\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
27 .\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
28 .\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
29 .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 .\" SUCH DAMAGE.
31 .\"
32 .\"     @(#)btree.3     8.4 (Berkeley) 8/18/94
33 .\"
34 .\" Japanese Version Copyright (c) 1999 Shouichi Saito
35 .\"     all rights reserved.
36 .\" Translated Mon Jul 26 21:43:11 JST 1999
37 .\"     by Shouichi Saito <ss236rx@ymg.urban.ne.jp>
38 .\" Proofed Mon Aug 16 1999 by NAKANO Takeo <nakano@apm.seikei.ac.jp>
39 .\"
40 .\"WORD:        access method           ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É
41 .\"WORD:        prefix (comparison)     Á°ÃÖÈæ³Ó
42 .TH BTREE 3 1994-08-18 "" "Linux Programmer's Manual"
43 .UC 7
44 .SH Ì¾Á°
45 .\"O btree \- btree database access method
46 btree \- btree ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤Î¥¢¥¯¥»¥¹¥á¥½¥Ã¥É
47 .SH ½ñ¼°
48 .nf
49 .ft B
50 #include <sys/types.h>
51 #include <db.h>
52 .ft R
53 .fi
54 .SH ÀâÌÀ
55 .\"O The routine
56 .\"O .BR dbopen (3)
57 .\"O is the library interface to database files.
58 ¥ë¡¼¥Á¥ó
59 .BR dbopen (3)
60 ¤Ï¥Ç¡¼¥¿¥Ù¡¼¥¹¥Õ¥¡¥¤¥ë¤ËÂФ¹¤ë¥é¥¤¥Ö¥é¥ê¥¤¥ó¥¿¡¼¥Õ¥§¡¼¥¹¤Ç¤¢¤ë¡£
61 .\"O One of the supported file formats is btree files.
62 .\"O The general description of the database access methods is in
63 .\"O .BR dbopen (3),
64 .\"O this manual page describes only the btree specific information.
65 ¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¥Õ¥¡¥¤¥ë¥Õ¥©¡¼¥Þ¥Ã¥È¤Î¤Ò¤È¤Ä¤Ë btree ¥Õ¥¡¥¤¥ë¤¬¤¢¤ë¡£
66 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ø¤Î¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ë´Ø¤¹¤ë°ìÈÌŪ¤Êµ­½Ò¤Ï
67 .BR dbopen (3)
68 ¤Ë½ñ¤«¤ì¤Æ¤¤¤ë¡£
69 ¤³¤Î¥Þ¥Ë¥å¥¢¥ë¥Ú¡¼¥¸¤Ç¤Ï btree ÆÃÍ­¤Î¾ðÊó¤Ë¤Ä¤¤¤Æ¤Î¤ßµ­½Ò¤¹¤ë¡£
70 .PP
71 .\"O The btree data structure is a sorted, balanced tree structure storing
72 .\"O associated key/data pairs.
73 btree ¥Ç¡¼¥¿¹½Â¤¤Ç¤Ï¡¢¥½¡¼¥È¤µ¤ì¤¿¥Ð¥é¥ó¥¹¥Ä¥ê¡¼¹½Â¤¤Ë
74 ¸ß¤¤¤Ë´ØÏ¢¤Å¤±¤é¤ì¤¿¥­¡¼/¥Ç¡¼¥¿ÂФò³ÊǼ¤·¤Æ¤¤¤ë¡£
75 .PP
76 .\"O The btree access method specific data structure provided to
77 .\"O .BR dbopen (3)
78 .\"O is defined in the
79 .\"O .I <db.h>
80 .\"O include file as follows:
81 .BR dbopen (3)
82 ¤ËÅϤµ¤ì¤ë btree ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤ËÆÃÍ­¤Î¥Ç¡¼¥¿¹½Â¤ÂΤϡ¢
83 .I <db.h>
84 ¥¤¥ó¥¯¥ë¡¼¥É¥Õ¥¡¥¤¥ë¤Ç¼¡¤Î¤è¤¦¤ËÄêµÁ¤µ¤ì¤Æ¤¤¤ë¡£
85 .sp
86 .in +4n
87 .nf
88
89 typedef struct {
90     unsigned long flags;
91     unsigned int  cachesize;
92     int           maxkeypage;
93     int           minkeypage;
94     unsigned int  psize;
95     int         (*compare)(const DBT *key1, const DBT *key2);
96     size_t      (*prefix)(const DBT *key1, const DBT *key2);
97     int           lorder;
98 } BTREEINFO;
99 .fi
100 .in
101 .sp
102 .\"O The elements of this structure are as follows:
103 ¤³¤Î¹½Â¤ÂΤÎÍ×ÁǤò°Ê²¼¤Ë¼¨¤¹¡£
104 .TP
105 .I flags
106 .\"O The flag value is specified by ORing any of the following values:
107 .I flags
108 ¤ÎÃͤϰʲ¼¤ÎÃͤΤ¤¤º¤ì¤«¤«¡¢¤³¤ì¤é¤ÎÏÀÍýϤǻØÄꤵ¤ì¤ë¡£
109 .RS
110 .TP
111 .B R_DUP
112 .\"O Permit duplicate keys in the tree, that is,
113 .\"O permit insertion if the key to be
114 .\"O inserted already exists in the tree.
115 .\"O The default behavior, as described in
116 .\"O .BR dbopen (3),
117 .\"O is to overwrite a matching key when inserting a new key or to fail if
118 .\"O the
119 .\"O .B R_NOOVERWRITE
120 .\"O flag is specified.
121 ¥Ä¥ê¡¼¤ÎÃæ¤Ë¥­¡¼¤Î½ÅÊ£¤òµö¤¹¡£¤¹¤Ê¤ï¤Á¥Ä¥ê¡¼¤ÎÃæ¤ËÁÞÆþ¤µ¤ì¤è¤¦¤È¤·¤Æ¤¤¤ë
122 ¥­¡¼¤¬´û¤Ë¸ºß¤·¤Æ¤¤¤Æ¤â¡¢¤½¤ÎÁÞÆþ¤òµö²Ä¤¹¤ë¡£¥Ç¥Õ¥©¥ë¥È¤ÎÆ°ºî¤Ï
123 .BR dbopen (3)
124 ¤Ëµ­½Ò¤µ¤ì¤Æ¤¤¤ë¤è¤¦¤Ë¡¢¿·¤·¤¤¥­¡¼¤¬ÁÞÆþ¤µ¤ì¤ë¤È°ìÃפ·¤¿¥­¡¼¤ò¾å½ñ¤­¤¹¤ë¡£
125 ¤¢¤ë¤¤¤Ï
126 .B R_NOOVERWRITE
127 ¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¤ÈÁÞÆþ¤Ë¼ºÇÔ¤¹¤ë¡£
128 .\"O The
129 .\"O .B R_DUP
130 .\"O flag is overridden by the
131 .\"O .B R_NOOVERWRITE
132 .\"O flag, and if the
133 .\"O .B R_NOOVERWRITE
134 .\"O flag is specified, attempts to insert duplicate keys into
135 .\"O the tree will fail.
136 .B R_DUP
137 ¥Õ¥é¥°¤Ï
138 .B R_NOOVERWRITE
139 ¥Õ¥é¥°¤Ë¤è¤Ã¤Æ¾å½ñ¤­¤µ¤ì¤ë¡£¤Ä¤Þ¤ê
140 .B R_NOOVERWRITE
141 ¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤¿¾ì¹ç¡¢¥Ä¥ê¡¼¤ËÊ£À½¥­¡¼¤òÁÞÆþ¤·¤è¤¦¤È¤¹¤ë¤È¼ºÇÔ¤¹¤ë¡£
142 .IP
143 .\"O If the database contains duplicate keys, the order of retrieval of
144 .\"O key/data pairs is undefined if the
145 .\"O .I get
146 .\"O routine is used, however,
147 .\"O .I seq
148 .\"O routine calls with the
149 .\"O .B R_CURSOR
150 .\"O flag set will always return the logical
151 .\"O "first" of any group of duplicate keys.
152 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë¥­¡¼¤Î½ÅÊ£¤¬¤¢¤ë¤È¡¢
153 .I get
154 ¥ë¡¼¥Á¥ó¤ò»È¤Ã¤¿¾ì¹ç¤Î¥­¡¼/¥Ç¡¼¥¿ÂФμèÆÀ½ç¤Ï̤ÄêµÁ¤Ç¤¢¤ë¡£¤½¤ì¤ËÂФ·¡¢
155 .B R_CURSOR
156 ¥Õ¥é¥°¤ò¥»¥Ã¥È¤·¤Æ
157 .I seq
158 ¥ë¡¼¥Á¥ó¤ò»È¤¦¤È¡¢Ê£À½¥­¡¼¤Î¥°¥ë¡¼¥×¤ÎÃæ¤Î
159 ÏÀÍýŪ¤Ë¡ÖºÇ½é¡×¤Î¥­¡¼¤òɬ¤ºÊÖ¤·¤Æ¤¯¤ë¡£
160 .RE
161 .TP
162 .I cachesize
163 .\"O A suggested maximum size (in bytes) of the memory cache.
164 ÁÛÄꤵ¤ì¤ë¥á¥â¥ê¥­¥ã¥Ã¥·¥å¤ÎºÇÂ祵¥¤¥º (¥Ð¥¤¥Èñ°Ì)¡£
165 .\"O This value is
166 .\"O .I only
167 .\"O advisory, and the access method will allocate more memory rather than fail.
168 .\"O Since every search examines the root page of the tree, caching the most
169 .\"O recently used pages substantially improves access time.
170 ¤³¤ÎÃͤÏ
171 .I ¤¢¤¯¤Þ¤Ç
172 »²¹Í¤Ç¤¢¤ê¡¢¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¤Ï¤³¤ÎÃͤò±Û¤¨¤¿¥á¥â¥ê¤Î
173 ³ä¤êÅö¤Æ¤ËÀ®¸ù¤¹¤ë¤³¤È¤â¤¢¤ë¡£
174 .\"O In addition, physical writes are delayed as long as possible, so a moderate
175 .\"O cache can reduce the number of I/O operations significantly.
176 ²Ã¤¨¤Æ¡¢ÊªÍýŪ¤Ê½ñ¤­¹þ¤ß¤Ï²Äǽ¤Ê¸Â¤êÃٱ䤵¤ì¤ë¤Î¤Ç¡¢
177 ¥­¥ã¥Ã¥·¥å¤ÎÂ礭¤µ¤òŬÅ٤ˤ·¤Æ¤ª¤±¤Ð I/O Áàºî¤Î²ó¿ô¤ò¤«¤Ê¤ê¸º¤é¤¹¤³¤È
178 ¤¬¤Ç¤­¤ë¡£
179 .\"O Obviously, using a cache increases (but only increases) the likelihood of
180 .\"O corruption or lost data if the system crashes while a tree is being modified.
181 ¤¢¤­¤é¤«¤Ë¥­¥ã¥Ã¥·¥å¤ò»È¤¦¤È¡¢¥Ä¥ê¡¼¤¬Êѹ¹¤µ¤ì¤Æ¤¤¤ëÅÓÃæ¤Ç
182 ¥·¥¹¥Æ¥à¤¬¥¯¥é¥Ã¥·¥å¤·¤¿¾ì¹ç¤Î¥Ç¡¼¥¿Ç˲õ¤ä¥Ç¡¼¥¿¥í¥¹¥È¤Î²ÄǽÀ­¤Ï
183 Áý¤¨¤ë (¤Þ¤¢¤Ç¤â¤½¤ì¤À¤±¤Î¤³¤È)¡£
184 .\"O If
185 .I cachesize
186 .\"O is 0 (no size is specified) a default cache is used.
187 ¤¬ 0 (¥µ¥¤¥º¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Î¾ì¹ç¡¢¥Ç¥Õ¥©¥ë¥È¤Î¥­¥ã¥Ã¥·¥å¤¬»È¤ï¤ì¤ë¡£
188 .TP
189 .I maxkeypage
190 .\"O The maximum number of keys which will be stored on any single page.
191 .\"O Not currently implemented.
192 ñ°ì¥Ú¡¼¥¸¤ËǼ¤á¤é¤ì¤ëºÇÂ祭¡¼¿ô¤Ç¤¢¤ë¡£¸½ºß¼ÂÁõ¤µ¤ì¤Æ¤¤¤Ê¤¤¡£
193 .\" The maximum number of keys which will be stored on any single page.
194 .\" Because of the way the btree data structure works,
195 .\" .I maxkeypage
196 .\" must always be greater than or equal to 2.
197 .\" If
198 .\" .I maxkeypage
199 .\" is 0 (no maximum number of keys is specified) the page fill factor is
200 .\" made as large as possible (which is almost invariably what is wanted).
201 .TP
202 .I minkeypage
203 .\"O The minimum number of keys which will be stored on any single page.
204 .\"O This value is used to determine which keys will be stored on overflow
205 .\"O pages, that is, if a key or data item is longer than the pagesize divided
206 .\"O by the minkeypage value, it will be stored on overflow pages instead
207 .\"O of in the page itself.
208 ñ°ì¥Ú¡¼¥¸¤ËǼ¤á¤é¤ì¤ëºÇ¾®¥­¡¼¿ô¤Ç¤¢¤ë¡£¤³¤ÎÃͤϡ¢¤É¤Î¥­¡¼¤ò
209 ¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Ú¡¼¥¸
210 ¤ËǼ¤á¤ë¤«·è¤á¤ë¤Î¤Ë»È¤ï¤ì¤ë¡£¤¹¤Ê¤ï¤Á¥­¡¼¤Þ¤¿¤Ï¥Ç¡¼¥¿¤¬
211 minkeypage ¤ÎÃͤÇʬ³ä¤µ¤ì¤¿¥Ú¡¼¥¸¥µ¥¤¥º¤è¤êÂ礭¤¤»þ¡¢¤½¤Î¥Ú¡¼¥¸¤ËǼ¤á
212 ¤ëÂå¤ï¤ê¤Ë¥ª¡¼¥Ð¡¼¥Õ¥í¡¼¥Ú¡¼¥¸¤ËǼ¤á¤ë¤È¤¤¤¦¤³¤È¤Ç¤¢¤ë¡£
213 .\"O If
214 .I minkeypage
215 .\"O is 0 (no minimum number of keys is specified) a value of 2 is used.
216 ¤¬ 0 (¥­¡¼¤ÎºÇ¾®Ãͤ¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Î¾ì¹ç¡¢ÃͤȤ·¤Æ 2 ¤¬»È¤ï¤ì¤ë¡£
217 .TP
218 .I psize
219 .\"O Page size is the size (in bytes) of the pages used for nodes in the tree.
220 .\"O The minimum page size is 512 bytes and the maximum page size is 64K.
221 ¥Ä¥ê¡¼¤ÎÃæ¤Î¥Î¡¼¥É¤Ë»È¤ï¤ì¤ë¥Ú¡¼¥¸¥µ¥¤¥º (¥Ð¥¤¥Èñ°Ì)¡£
222 ºÇ¾®ÃͤϠ512 ¥Ð¥¤¥È¤Ç¡¢ºÇÂçÃͤϠ64K ¤Ç¤¢¤ë¡£
223 .\"O If
224 .I psize
225 .\"O is 0 (no page size is specified) a page size is chosen based on the
226 .\"O underlying file system I/O block size.
227 ¤¬ 0 (¥Ú¡¼¥¸¥µ¥¤¥º¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Î¾ì¹ç¡¢
228 ¥Õ¥¡¥¤¥ë¥·¥¹¥Æ¥à¤Î I/O ¥Ö¥í¥Ã¥¯¥µ¥¤¥º¤Ë´ð¤Å¤¤¤Æ·è¤á¤é¤ì¤ë¡£
229 .TP
230 .I compare
231 .\"O Compare is the key comparison function.
232 .I compare
233 ¤Ï¥­¡¼¤ÎÈæ³Ó´Ø¿ô¤Ç¤¢¤ë¡£
234 .\"O It must return an integer less than, equal to, or greater than zero if the
235 .\"O first key argument is considered to be respectively less than, equal to,
236 .\"O or greater than the second key argument.
237 ºÇ½é¤Î¥­¡¼°ú¿ô¤ËÂФ·¡¢ÆóÈÖÌܤΥ­¡¼°ú¿ô¤¬Â礭¤¤¾ì¹ç¤Ë¤ÏÀµ¤ÎÀ°¿ô¤ò¡¢
238 Ʊ¤¸¾ì¹ç¤Ë¤Ï¥¼¥í¤ò¡¢¾®¤µ¤¤¾ì¹ç¤Ë¤ÏÉé¤ÎÀ°¿ô¤òÊÖ¤¹¡£
239 .\"O The same comparison function must be used on a given tree every time it
240 .\"O is opened.
241 ¥Ä¥ê¡¼¤ò³«¤¯ºÝ¤Ë¤Ï¡¢¾ï¤ËƱ¤¸Èæ³Ó´Ø¿ô¤¬»È¤ï¤ì¤Ê¤±¤ì¤Ð¤Ê¤é¤Ê¤¤¡£
242 .\"O If
243 .I compare
244 .\"O is NULL (no comparison function is specified), the keys are compared
245 .\"O lexically, with shorter keys considered less than longer keys.
246 ¤¬ NULL (Èæ³Ó´Ø¿ô¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Î¾ì¹ç¡¢
247 ¼­½ñŪ¤ËÈæ³Ó¤µ¤ì¤ë¡£Ã»¤¤¥­¡¼¤ÏŤ¤¥­¡¼¤è¤ê¾®¤µ¤¤¤³¤È¤Ë¤Ê¤ë¡£
248 .TP
249 .I prefix
250 .\"O Prefix is the prefix comparison function.
251 .I prefix
252 ¤ÏÁ°ÃÖÈæ³Ó´Ø¿ô¤Ç¤¢¤ë¡£
253 .\"O If specified, this routine must return the number of bytes of the second key
254 .\"O argument which are necessary to determine that it is greater than the first
255 .\"O key argument.
256 ¤³¤Î¥ë¡¼¥Á¥ó¤Ï (»ØÄꤵ¤ì¤¿¾ì¹ç¤Ë¤Ï)¡¢ÆóÈÖÌܤΥ­¡¼°ú¿ô¤Î
257 ¥Ð¥¤¥È¿ô¤òÊÖ¤µ¤Ê¤¯¤Æ¤Ï¤Ê¤é¤Ê¤¤¡£¤³¤ì¤ÏÆóÈÖÌܤΥ­¡¼°ú¿ô¤¬
258 °ìÈÖÌܤΥ­¡¼°ú¿ô¤è¤êÂ礭¤¤¤«¤É¤¦¤«·è¤á¤ë¤Î¤ËɬÍפǤ¢¤ë¡£
259 .\"NAKANO ¤Á¤ç¤Ã¤È°ÕÌ£¤ï¤«¤é¤ó...
260 .\"O If the keys are equal, the key length should be returned.
261 .\"O Note, the usefulness of this routine is very data-dependent, but, in some
262 .\"O data sets can produce significantly reduced tree sizes and search times.
263 ¥­¡¼¤¬Æ±¤¸¾ì¹ç¡¢¥­¡¼¤ÎŤµ¤¬Ê֤롣¤³¤Î¥ë¡¼¥Á¥ó¤¬Í­ÍѤ«¤É¤¦¤«¤Ï¡¢
264 ¥Ç¡¼¥¿¤Ë¶¯¤¯°Í¸¤¹¤ë¡£¤·¤«¤·¥Ç¡¼¥¿¥»¥Ã¥È¤Ë¤è¤Ã¤Æ¤Ï¡¢ÌÀ¤é¤«¤Ë¥Ä¥ê¡¼
265 ¤Î¥µ¥¤¥º¤È¸¡º÷»þ´Ö¤ò¸º¤é¤·¤Æ¤¯¤ì¤ë¡£
266 .\"O If
267 .\"O .I prefix
268 .\"O is NULL (no prefix function is specified),
269 .\"O .I and
270 .\"O no comparison function is specified, a default lexical comparison routine
271 .\"O is used.
272 .I prefix
273 ¤¬ NULL (prefix ´Ø¿ô¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Ç¡¢
274 .I ¤«¤Ä
275 Èæ³Ó´Ø¿ô¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤¤È¡¢¥Ç¥Õ¥©¥ë¥È¤Î¼­½ñÈæ³Ó¥ë¡¼¥Á¥ó¤¬»È¤ï¤ì¤ë¡£
276 .\"O If
277 .\"O .I prefix
278 .\"O is NULL and a comparison routine is specified, no prefix comparison is
279 .\"O done.
280 .I prefix
281 ¤¬ NULL ¤ÇÈæ³Ó´Ø¿ô¤¬»ØÄꤵ¤ì¤Æ¤¤¤ë¾ì¹ç¤Ï¡¢Á°ÃÖÈæ³Ó¤Ï¹Ô¤ï¤ì¤Ê¤¤¡£
282 .TP
283 .I lorder
284 .\"O The byte order for integers in the stored database metadata.
285 .\"O The number should represent the order as an integer; for example,
286 .\"O big endian order would be the number 4,321.
287 .\"O If
288 .\"O .I lorder
289 .\"O is 0 (no order is specified) the current host order is used.
290 ¥Ç¡¼¥¿¥Ù¡¼¥¹¤Ë³ÊǼ¤µ¤ì¤Æ¤¤¤ë¥á¥¿¥Ç¡¼¥¿¤ÎÀ°¿ôÃͤΥХ¤¥È¥ª¡¼¥À¡¼¡£
291 ¤³¤Î¿ô»ú¤Ï¡¢½ç½ø¤òÀ°¿ô¤Çɽ¤·¤¿¤â¤Î¤Ç¤¢¤ë¡£
292 Î㤨¤Ð¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤Ê¤é¡¢¤³¤Î¿ôÃͤϠ4,321 ¤È¤Ê¤ë¡£
293 .I lorder
294 ¤¬ 0 (»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤Î¾ì¹ç¡¢¸½ºß¤Î¥Û¥¹¥È
295 ¤Ç»È¤ï¤ì¤Æ¤¤¤ë¥Ð¥¤¥È¥ª¡¼¥À¡¼¤¬»È¤ï¤ì¤ë¡£
296 .PP
297 .\"O If the file already exists (and the
298 .\"O .B O_TRUNC
299 .\"O flag is not specified), the
300 .\"O values specified for the arguments
301 .\"O .IR flags ,
302 .\"O .I lorder
303 .\"O and
304 .\"O .I psize
305 .\"O are ignored
306 .\"O in favor of the values used when the tree was created.
307 ¥Õ¥¡¥¤¥ë¤¬´û¤Ë¸ºß¤·¤Æ¤¤¤ë (¤Þ¤¿¤Ï
308 .B O_TRUCT
309 ¥Õ¥é¥°¤¬»ØÄꤵ¤ì¤Æ¤¤¤Ê¤¤) ¤È¡¢
310 °ú¤­¿ô
311 .IR flag ,
312 .IR lorder ,
313 .I psize
314 ¤Ë»ØÄꤵ¤ì¤¿ÃͤÏ̵»ë¤µ¤ì¡¢
315 ¥Ä¥ê¡¼¤¬ºî¤é¤ì¤¿»þ¤Ë»È¤Ã¤¿Ãͤ¬ÍѤ¤¤é¤ì¤ë¡£
316 .PP
317 .\"O Forward sequential scans of a tree are from the least key to the greatest.
318 ¥Ä¥ê¡¼¤ÎÁ°Êý½ç¸¡º÷¤Ï¡¢ºÇ¾®¥­¡¼¤«¤éºÇÂ祭¡¼¤Ë¸þ¤«¤Ã¤Æ¹Ô¤ï¤ì¤ë¡£
319 .PP
320 .\"O Space freed up by deleting key/data pairs from the tree is never reclaimed,
321 .\"O although it is normally made available for reuse.
322 .\"O This means that the btree storage structure is grow-only.
323 .\"O The only solutions are to avoid excessive deletions, or to create a fresh
324 .\"O tree periodically from a scan of an existing one.
325 ¥Ä¥ê¡¼¤«¤é¥­¡¼/¥Ç¡¼¥¿ÂФ¬ºï½ü¤µ¤ì¤ë¤³¤È¤Ë¤è¤Ã¤Æ¤Ç¤­¤¿¥¹¥Ú¡¼¥¹¤Ï¡¢
326 Ä̾ïºÆÍøÍѤǤ­¤ë·Á¤Ë¤Ê¤Ã¤Æ¤¤¤ë¤¬ºÆÍøÍѤµ¤ì¤ë¤³¤È¤Ï̵¤¤¡£
327 ¤Ä¤Þ¤ê brtee µ­²±¹½Â¤¤ÏÈîÂ礹¤ë°ìÊý¤Ç¤¢¤ë¡£
328 Âкö¤Ï²áÅ٤κï½ü¤òÈò¤±¤ë¤«¡¢
329 ¸ºß¤¹¤ë¥Ä¥ê¡¼¤òÄ´¤Ù¤ÆÄê´üŪ¤Ë¿·¤·¤¤¥Ä¥ê¡¼¤òºî¤ë¤«¡¢¤À¤±¤Ç¤¢¤ë¡£
330 .PP
331 .\"O Searches, insertions, and deletions in a btree will all complete in
332 .\"O O lg base N where base is the average fill factor.
333 .\"O Often, inserting ordered data into btrees results in a low fill factor.
334 .\"O This implementation has been modified to make ordered insertion the best
335 .\"O case, resulting in a much better than normal page fill factor.
336 .SH ¥¨¥é¡¼
337 .\"O The
338 .\"O .I btree
339 .\"O access method routines may fail and set
340 .\"O .I errno
341 .\"O for any of the errors specified for the library routine
342 .\"O .BR dbopen (3).
343 .I btree
344 ¥¢¥¯¥»¥¹¥á¥½¥Ã¥É¥ë¡¼¥Á¥ó¤Ï¼ºÇÔ¤¹¤ë¤È¡¢¥é¥¤¥Ö¥é¥ê¥ë¡¼¥Á¥ó
345 .BR dbopen (3)
346 ¤ÇÄêµÁ¤µ¤ì¤Æ¤¤¤ë¥¨¥é¡¼¤Î¤¤¤º¤ì¤«¤ò
347 .I errno
348 ¤È¤·¤ÆÊÖ¤¹¡£
349 .\"O .SH BUGS
350 .SH ¥Ð¥°
351 .\"O Only big and little endian byte order is supported.
352 ¥Ð¥¤¥È¥ª¡¼¥À¡¼¤È¤·¤Æ¤Ï¥Ó¥Ã¥°¥¨¥ó¥Ç¥£¥¢¥ó¤È¥ê¥È¥ë¥¨¥ó¥Ç¥£¥¢¥ó¤Î¤ß¤¬
353 ¥µ¥Ý¡¼¥È¤µ¤ì¤Æ¤¤¤ë¡£
354 .SH ´ØÏ¢¹àÌÜ
355 .BR dbopen (3),
356 .BR hash (3),
357 .BR mpool (3),
358 .BR recno (3)
359 .sp
360 .IR "The Ubiquitous B-tree" ,
361 Douglas Comer, ACM Comput. Surv. 11, 2 (June 1979), 121-138.
362 .sp
363 .IR "Prefix B-trees" ,
364 Bayer and Unterauer, ACM Transactions on Database Systems, Vol. 2, 1
365 (March 1977), 11-26.
366 .sp
367 .IR "The Art of Computer Programming Vol. 3: Sorting and Searching" ,
368 D.E. Knuth, 1968, pp 471-480.