JP2007249369A - Key search device, key search method, and program - Google Patents

Key search device, key search method, and program Download PDF

Info

Publication number
JP2007249369A
JP2007249369A JP2006069198A JP2006069198A JP2007249369A JP 2007249369 A JP2007249369 A JP 2007249369A JP 2006069198 A JP2006069198 A JP 2006069198A JP 2006069198 A JP2006069198 A JP 2006069198A JP 2007249369 A JP2007249369 A JP 2007249369A
Authority
JP
Japan
Prior art keywords
search
key
value
boundary
unit
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
JP2006069198A
Other languages
Japanese (ja)
Inventor
Masaya Kawamura
真弥 川村
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
NEC Corp
Original Assignee
NEC Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Corp filed Critical NEC Corp
Priority to JP2006069198A priority Critical patent/JP2007249369A/en
Publication of JP2007249369A publication Critical patent/JP2007249369A/en
Withdrawn legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To speedily search a leading search key among search keys having a search object key value regardless of the number of search keys having the same key value included in a search object key column. <P>SOLUTION: When a search instruction including a search object key value is inputted by a user, a search key having the search object key value is searched by a binary search method from an array type index A by a key search part SK. Afterwards, one of a linear search method or the binary search method is selected based on a threshold to be determined according to the rate of a duplicate level calculated by a duplicate level determination part D to the mean costs of the linear search method and the binary search method by a boundary search part 11. At that time, when the duplicate level is less than a threshold, the linear search method is selected, and when the duplicate level is the threshold or more, the binary search method is selected. Afterwards, the leading search key of the search keys having search object key values is searched by the selected search method. <P>COPYRIGHT: (C)2007,JPO&INPIT

Description

本発明は、重複を許す検索キーを持つ配列型インデックスなどのように、複数の検索キーが昇順あるいは降順に並び、且つキー値が同一の検索キーを含んだキー列を検索対象キー列にするキー検索技術に関し、特に、指示された検索対象キー値を有する検索キーの内の先頭あるいは末尾の検索キーを検索するキー検索技術に関する。   According to the present invention, a key string including a search key in which a plurality of search keys are arranged in ascending or descending order and the same key value is used as a search target key string, such as an array type index having search keys that allow duplication. The present invention relates to a key search technique, and more particularly to a key search technique for searching for the first or last search key among search keys having a designated search target key value.

重複を許す検索キーを持つ配列型インデックスやファイル等を検索する場合、利用者によって指示されたキー値(検索対象キー値)を持つ検索キーの内の、先頭の検索キーを検索するということが従来から行われている。検索対象キー値を持つ先頭の検索キーを検索するのは、その後の処理を効率的に行えるようにするためである。例えば、図16に示すような配列型インデックス101において、利用者が検索対象キー値として「d」を指定した場合、キー値「d」を有する検索キーk3〜k10の内の、先頭の検索キーが検索されれば、利用者は、次レコードを要求するボタンのみを操作するだけで、キー値「d」を有するキーk3〜k10によってポイントされるレコードを全て参照することが可能になり、操作性が向上する。   When searching an array type index or file with a search key that allows duplication, searching for the first search key among the search keys with the key value (search target key value) specified by the user Traditionally done. The first search key having the search target key value is searched so that the subsequent processing can be performed efficiently. For example, in the array type index 101 as shown in FIG. 16, when the user designates “d” as the search target key value, the first search key among the search keys k3 to k10 having the key value “d”. Is retrieved, the user can refer to all the records pointed to by the keys k3 to k10 having the key value “d” only by operating the button requesting the next record. Improves.

ところで、従来のこの種の技術としては、次のような技術が知られている(例えば、特許文献1参照)。この特許文献1に記載されている従来の情報検索装置は、時刻が検索キーとなっているログファイルを検索対象にしており、利用者によって検索対象にする時刻が入力されると、先ず、二分検索法によって上記時刻を検索キーとして含んだレコードを検索する。その後、二分検索法で検索したレコードを検索開始レコードにして、線形検索法でログファイルを降順方向に検索し、利用者によって指示された時刻を含んだレコードの内の先頭のレコードを検索する。   By the way, the following techniques are known as this kind of conventional techniques (for example, refer to Patent Document 1). The conventional information search device described in Patent Document 1 uses a log file whose time is a search key as a search target. When a user inputs a time to be searched, first, a bisection is performed. A record including the above time as a search key is searched by a search method. Thereafter, the record searched by the binary search method is used as a search start record, the log file is searched in the descending order by the linear search method, and the first record among the records including the time designated by the user is searched.

特開2001−167094号公報JP 2001-167094 A

上述した従来の技術は、先ず、二分検索法により利用者によって指示された時刻を含むレコードの内の1つを検索し、その後、上記検索したレコードを検索開始レコードにして線形検索法で降順方向にログファイルを検索するようにしているので、全ての検索を線形検索法によって行う場合に比較して、検索処理を高速化することができる。しかしながら、上述した従来の技術では、二分検索法によって利用者が指示した時刻を含むレコードを検索した後は、常に線形検索法によって先頭のレコードを検索するようにしているため、同一キー値を含むレコードが多数存在する場合、検索処理を充分に高速化することができないという問題があった。   In the conventional technique described above, first, one of the records including the time instructed by the user is searched by the binary search method, and then the search record is set as the search start record in the descending direction by the linear search method. Therefore, the search process can be speeded up as compared with the case where all searches are performed by the linear search method. However, in the above-described conventional technique, after searching for a record including the time designated by the user by the binary search method, the first record is always searched by the linear search method, so the same key value is included. When there are a large number of records, there is a problem that the search process cannot be sufficiently accelerated.

なお、二分検索法によって先頭レコードを検索するようにすることも考えられるが、このようにした場合は、同一キー値を含むレコードが少ないと、非効率的になってしまうという問題がある。   Although it is conceivable to search for the first record by the binary search method, in such a case, there is a problem that if there are few records including the same key value, it becomes inefficient.

〔発明の目的〕
そこで、本発明の目的は、検索対象キー列に含まれている同一キー値を有する検索キーの数にかかわらず、検索対象キー値を有する検索キーの内の、先頭または末尾の検索キーを高速に検索できるようにすることにある。
(Object of invention)
Accordingly, an object of the present invention is to quickly search the first or last search key of search keys having a search target key value regardless of the number of search keys having the same key value included in the search target key column. To be able to search.

本発明にかかる第1のキー検索装置は、
複数の検索キーが昇順または降順に並び、且つキー値が同一の検索キーを含んだ検索対象キー列の中から、指示された検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを検索するキー検索装置であって、
前記検索対象キー列から、前記検索対象キー値を有する検索キーを二分検索法によって検索するキー検索部と、
前記検索対象キー列の検索キーの重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、線形検索法または二分検索法の内の一方を選択し、該選択した検索方法により、前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを検索する境界検索部とを備えたことを特徴とする。
The first key retrieval apparatus according to the present invention is:
A plurality of search keys arranged in ascending or descending order, and a key having a designated search target key value and different from the search target key value out of a search target key string including a search key having the same key value A key search device for searching a search key that is a boundary with a search key having a value,
A key search unit for searching a search key having the search target key value from the search target key string by a binary search method;
Based on the search key duplication degree of the search target key column and the ratio of the average cost of the linear search method and the binary search method, one of the linear search method and the binary search method is selected, and the selected search method By using the search key searched by the key search unit as a search start key, a search key serving as a boundary with a search key having the search target key value and having a key value different from the search target key value And a boundary search unit for searching.

本発明にかかる第2のキー検索装置は、第1のキー検索装置において、
前記境界検索部が、
前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを、線形検索法によって検索する第1の重複キー境界検索部と、
前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを、二分検索法によって検索する第2の重複キー境界検索部と、
前記検索対象キー列の検索キーの重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、前記第1の重複キー境界検索部または前記第2の重複キー境界検索部を動作させる検索法決定部を備えたことを特徴とする。
A second key search device according to the present invention is the first key search device,
The boundary search unit
Using the search key searched by the key search unit as a search start key, a search key that is a boundary between a search key having the search target key value and a key value different from the search target key value is linearly A first duplicate key boundary search unit for searching by a search method;
Using a search key searched by the key search unit as a search start key, a search key that is a boundary between a search key having the search target key value and a key value different from the search target key value is divided into two A second duplicate key boundary search unit for searching by a search method;
The first duplicate key boundary search unit or the second duplicate key boundary search unit is based on the degree of duplication of the search key of the search target key column and the ratio of the average cost of the linear search method and the binary search method. A search method determination unit to be operated is provided.

本発明にかかる第3のキー検索装置は、第1または第2のキー検索装置において、
前記重複度が、同一キー値を有する検索キーのキー数が多くなるほど、大きな値となることを特徴とする。
A third key search device according to the present invention is the first or second key search device,
The degree of duplication increases as the number of search keys having the same key value increases.

本発明にかかる第4のキー検索装置は、第3のキー検索装置において、
前記検索対象キー列中の各キー値毎に、そのキー値を有する検索キーのキー数が登録された重複度管理表と、
前記検索対象キー列に検索キーが追加された場合および前記検索対象キー列から検索キーが削除された場合、前記重複度管理表を更新し、更新後の前記重複度管理表の内容に基づいて、キー値毎のキー数の平均値を求め、該平均値を重複度とする重複度決定部とを備えたことを特徴とする。
A fourth key search device according to the present invention is the third key search device,
For each key value in the search target key column, a duplication degree management table in which the number of search keys having the key value is registered;
When a search key is added to the search target key column and when a search key is deleted from the search target key column, the duplication degree management table is updated, based on the contents of the updated duplication degree management table And a duplication degree determining unit that obtains an average value of the number of keys for each key value and uses the average value as a duplication degree.

本発明にかかる第1のキー検索方法は、
複数の検索キーが昇順または降順に並び、且つキー値が同一の検索キーを含んだ検索対象キー列の中から、指示された検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを検索するキー検索方法であって、
前記検索対象キー列から、前記検索対象キー値を有する検索キーを二分検索法によって検索するキー検索ステップと、
前記検索対象キー列の検索キーの重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、線形検索法または二分検索法の内の一方を選択し、該選択した検索方法により、前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを検索する境界検索ステップとを含むことを特徴とする。
The first key search method according to the present invention is as follows.
A plurality of search keys arranged in ascending or descending order, and a key having a designated search target key value and different from the search target key value out of a search target key string including a search key having the same key value A key search method for searching a search key that is a boundary with a search key having a value,
A key search step of searching a search key having the search target key value from the search target key string by a binary search method;
Based on the search key duplication degree of the search target key column and the ratio of the average cost of the linear search method and the binary search method, one of the linear search method and the binary search method is selected, and the selected search method By using the search key searched by the key search unit as a search start key, a search key serving as a boundary with a search key having the search target key value and having a key value different from the search target key value And a boundary search step for searching.

本発明にかかる第2のキー検索方法は、第1のキー検索方法において、
前記境界検索ステップが、
前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを、線形検索法によって検索する第1の重複キー境界検索ステップと、
前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを、二分検索法によって検索する第2の重複キー境界検索ステップと、
前記検索対象キー列の検索キーの重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、前記第1の重複キー境界検索ステップまたは前記第2の重複キー境界検索ステップを起動させる検索法決定ステップとを含むことを特徴とする。
A second key search method according to the present invention is the first key search method,
The boundary search step includes:
Using the search key searched by the key search unit as a search start key, a search key that is a boundary between a search key having the search target key value and a key value different from the search target key value is linearly A first duplicate key boundary search step for searching by a search method;
Using a search key searched by the key search unit as a search start key, a search key that is a boundary between a search key having the search target key value and a key value different from the search target key value is divided into two A second duplicate key boundary search step for searching by a search method;
The first duplicate key boundary search step or the second duplicate key boundary search step is performed based on the degree of duplication of the search key of the search target key string and the ratio of the average cost of the linear search method and the binary search method. And a search method determination step to be activated.

本発明にかかる第3のキー検索方法は、第1または第2のキー検索方法において、
前記重複度が、同一キー値を有する検索キーのキー数が多くなるほど、大きな値となることを特徴とする。
A third key retrieval method according to the present invention is the first or second key retrieval method,
The degree of duplication increases as the number of search keys having the same key value increases.

本発明にかかる第4のキー検索方法は、第3のキー検索方法において、
前記検索対象キー列に検索キーが追加された場合および前記検索対象キー列から検索キーが削除された場合、前記検索対象キー列中の各キー値毎に、そのキー値を有する検索キーのキー数が登録された重複度管理表を更新し、更新後の前記重複度管理表の内容に基づいて、キー値毎のキー数の平均値を求め、該平均値を重複度とする重複度決定ステップを含むことを特徴とする。
A fourth key search method according to the present invention is the third key search method,
When a search key is added to the search target key column and when a search key is deleted from the search target key column, for each key value in the search target key column, the key of the search key having that key value The duplication degree management table in which the number is registered is updated, the average value of the number of keys for each key value is obtained based on the contents of the updated duplication degree management table, and the duplication degree is determined by using the average value as the duplication degree Including steps.

本発明にかかる第1のプログラムは、
コンピュータを、複数の検索キーが昇順または降順に並び、且つキー値が同一の検索キーを含んだ検索対象キー列の中から、指示された検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを検索するキー検索装置として機能させるためのプログラムであって、
前記コンピュータを、
前記検索対象キー列から、前記検索対象キー値を有する検索キーを二分検索法によって検索するキー検索部、
前記検索対象キー列の検索キーの重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、線形検索法または二分検索法の内の一方を選択し、該選択した検索方法により、前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを検索する境界検索部として機能させる。
The first program according to the present invention is:
A plurality of search keys arranged in ascending or descending order, and a search target key string including a search key having the same key value, the specified search target key value and the search target key value; Is a program for functioning as a key search device that searches for a search key that is a boundary with a search key having a different key value,
The computer,
A key search unit for searching a search key having the search target key value from the search target key string by a binary search method;
Based on the search key duplication degree of the search target key column and the ratio of the average cost of the linear search method and the binary search method, one of the linear search method and the binary search method is selected, and the selected search method By using the search key searched by the key search unit as a search start key, a search key serving as a boundary with a search key having the search target key value and having a key value different from the search target key value It functions as a boundary search unit for searching.

本発明にかかる第2のプログラムは、第1のプログラムにおいて、
前記境界検索部が、
前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを、線形検索法によって検索する第1の重複キー境界検索部と、
前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを、二分検索法によって検索する第2の重複キー境界検索部と、
前記検索対象キー列の検索キーの重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、前記第1の重複キー境界検索部または前記第2の重複キー境界検索部を動作させる検索法決定部を備えたことを特徴とする。
The second program according to the present invention is the first program,
The boundary search unit
Using the search key searched by the key search unit as a search start key, a search key that is a boundary between a search key having the search target key value and a key value different from the search target key value is linearly A first duplicate key boundary search unit for searching by a search method;
Using a search key searched by the key search unit as a search start key, a search key that is a boundary between a search key having the search target key value and a key value different from the search target key value is divided into two A second duplicate key boundary search unit for searching by a search method;
The first duplicate key boundary search unit or the second duplicate key boundary search unit is based on the degree of duplication of the search key of the search target key column and the ratio of the average cost of the linear search method and the binary search method. A search method determination unit to be operated is provided.

本発明にかかる第3のプログラムは、第1または第2のプログラムにおいて、
前記重複度が、同一キー値を有する検索キーのキー数が多くなるほど、大きな値となることを特徴とする。
The third program according to the present invention is the first or second program,
The degree of duplication increases as the number of search keys having the same key value increases.

本発明にかかる第4のプログラムは、第3のプログラムにおいて、
前記コンピュータを、
前記検索対象キー列に検索キーが追加された場合および前記検索対象キー列から検索キーが削除された場合、前記検索対象キー列中の各キー値毎に、そのキー値を有する検索キーのキー数が登録された重複度管理表を更新し、更新後の前記重複度管理表の内容に基づいて、キー値毎のキー数の平均値を求め、該平均値を重複度とする重複度決定部として機能させる。
A fourth program according to the present invention is the third program,
The computer,
When a search key is added to the search target key column and when a search key is deleted from the search target key column, for each key value in the search target key column, the key of the search key having that key value The duplication degree management table in which the number is registered is updated, the average value of the number of keys for each key value is obtained based on the contents of the updated duplication degree management table, and the duplication degree is determined by using the average value as the duplication degree Function as a part.

〔作用〕
検索対象キー列に検索キーが追加された場合および検索対象キー列から検索キーが削除された場合、重複度決定部が、上記検索対象キー列の重複度を算出し直す。重複度は、同一キー値を有する検索キーの数が多くなるほど大きな値となるものであり、例えば、各キー値毎のキー数の平均値を採用することができる。
[Action]
When a search key is added to the search target key string and when a search key is deleted from the search target key string, the duplication degree determination unit recalculates the duplication degree of the search target key string. The degree of overlap increases as the number of search keys having the same key value increases. For example, an average value of the number of keys for each key value can be adopted.

利用者によって、検索対象キー値が指定された場合は、先ず、キー検索部が、検索対象キー列から、上記検索対象キー値を有する検索キーを二分検索法によって検索する。その後、境界検索部が、重複度決定部で算出された重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、線形検索法または二分検索法の内の一方を選択し、選択した検索方法により、キー検索部で検索された検索キーを検索開始キーにして、上記検索対象キー値を有し且つ上記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを検索する。   When the search target key value is designated by the user, first, the key search unit searches the search key having the search target key value from the search target key string by the binary search method. After that, the boundary search unit selects one of the linear search method and the binary search method based on the redundancy calculated by the redundancy determination unit and the ratio of the average cost of the linear search method and the binary search method. A search key searched by the key search unit by the selected search method as a search start key, and a boundary between the search key having the search target key value and a key value different from the search target key value Search for a search key.

本発明によれば、検索対象キー列に含まれている同一キー値を有する検索キーの数にかかわらず、検索対象キー値を有する検索キーの内の、先頭または末尾の検索キーを高速に検索できるという効果を得ることができる。その理由は、検索対象キー列の検索キーの重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、線形検索法または二分検索法の内の一方を選択し、選択した検索方法により、キー検索部で検索された検索キーを検索開始キーにして、検索対象キー値を有し且つ検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを検索する境界検索部を備えているからである。   According to the present invention, regardless of the number of search keys having the same key value included in the search target key column, the search key at the head or the end among the search keys having the search target key value is searched at high speed. The effect that it is possible can be obtained. The reason is that one of the linear search method and the binary search method is selected based on the redundancy of the search key in the search target key column and the ratio of the average cost of the linear search method and the binary search method. By using the search method, the search key searched by the key search unit is used as a search start key, and a search key that is a boundary between a search key having a search target key value and a key value different from the search target key value is searched. This is because a boundary search unit is provided.

次に、発明を実施するための最良の形態について図面を参照して詳細に説明する。   Next, the best mode for carrying out the invention will be described in detail with reference to the drawings.

〔本発明の原理〕
先ず、本発明の実施の形態を説明する前に、本発明の原理について説明しておく。
[Principle of the present invention]
First, before describing embodiments of the present invention, the principle of the present invention will be described.

配列型インデックスにおいて、N個のデータから1つのキーを検索する場合、キーの重複を許さないインデックスに二分検索法を使うと最大(log2N+1)回の比較で検索が終了する。キーの重複を許す配列型インデックスの場合、この処理に加えて「同一のキー値を有する同一検索キー群の先頭の位置を検出する」処理が必要となる。 When searching for one key from N pieces of data in an array type index, if the binary search method is used for an index that does not allow duplication of keys, the search ends with a maximum of (log 2 N + 1) comparisons. In the case of an array type index that allows duplication of keys, in addition to this process, a process of “detecting the leading position of the same search key group having the same key value” is required.

この処理は、一般的には2つの方法が考えられる。   There are generally two methods for this processing.

第1の方法は、線形検索法により、配列型インデックスを逆順に比較しながら、同一検索キー群の先頭位置を検出する方法である。第2の方法は、二分検索法により、検索範囲を絞り込みながら、同一検索キー群の先頭位置を検出する方法である。   The first method is a method of detecting the head position of the same search key group by comparing the array type indexes in reverse order by the linear search method. The second method is a method of detecting the head position of the same search key group while narrowing down the search range by the binary search method.

N個のデータから1つのキーを検索する場合の最大比較回数は、線形検索法ではN回、二分検索法では(log2N+1)回である。図13にデータ数Nを1〜10としたときの線形検索法および二分検索法の最大比較回数を示す。 The maximum number of comparisons when searching for one key from N data is N times for the linear search method and (log 2 N + 1) times for the binary search method. FIG. 13 shows the maximum number of comparisons of the linear search method and the binary search method when the number of data N is 1 to 10.

また、n回の比較処理によって同一検索キー群の先頭位置を検出できた場合の、線形検索法および二分検索法それぞれの処理内容とその平均コスト(アセンブラレベルでの平均処理ステップ数)は、図14に示すものとなる。なお、線形検索法の処理内容におけるSL4等は、図11のフローチャートにおけるステップ番号を示し、二分検索法の処理内容におけるSB2等は、図12のフローチャートにおけるステップ番号を示している。図14に示すように、二分検索法の平均コストは、線形検索法の平均コストの1.5倍となっている。   The processing contents and the average cost (average number of processing steps at the assembler level) of the linear search method and the binary search method when the head position of the same search key group can be detected by n comparison processes are shown in FIG. 14 is obtained. Note that SL4 and the like in the processing contents of the linear search method indicate step numbers in the flowchart of FIG. 11, and SB2 and the like in the processing contents of the binary search method indicate step numbers in the flowchart of FIG. As shown in FIG. 14, the average cost of the binary search method is 1.5 times the average cost of the linear search method.

図13に示した線形検索法および二分検索法の最大検索回数と、図14に示した線形検索法および二分検索法の平均コストとを考慮して、データ数Nが1〜10のときの、線形検索法および二分検索法のコストを算出すると、図15に示すようになる。   In consideration of the maximum number of searches of the linear search method and the binary search method shown in FIG. 13 and the average cost of the linear search method and the binary search method shown in FIG. FIG. 15 shows the calculated costs of the linear search method and the binary search method.

図15を参照して分かるように、データ数Nが小さい場合には線形検索法の方が効率がよく、データ数が大きい場合には二分検索法の方が効率がよいと言える。そして、その境界値は、この例の場合「6」となる。   As can be seen with reference to FIG. 15, the linear search method is more efficient when the number of data N is small, and the binary search method is more efficient when the number of data is large. The boundary value is “6” in this example.

従って、検索キーが重複しているレコード数の期待値「6」より小さい場合には線形検索法を、「6」より大きい場合には二分検索法を用いることで高速化を図ることができる。 実際には両方法ともに付加的な処理があるために、前出の期待値が「6」の場合には、合計コストは、線形検索法で「36+6α」、二分検索法で「36+4α」(αは1回の比較にかかる付加的な処理のコスト)となるので、二分検索法を用いるようにする。   Therefore, it is possible to increase the speed by using a linear search method when the number of records with duplicate search keys is smaller than the expected value “6” and using a binary search method when the search key is larger than “6”. Actually, both methods have additional processing, so when the expected value is “6”, the total cost is “36 + 6α” in the linear search method and “36+” in the binary search method. 4α ”(α is an additional processing cost for one comparison), so the binary search method is used.

〔実施の形態の構成の説明〕
次に、本発明にかかるキー検索装置の実施の形態の構成について説明する。
[Description of Configuration of Embodiment]
Next, the configuration of the embodiment of the key search device according to the present invention will be described.

図1に示す通り、本実施の形態のキー検索装置1には、ハードディスク等の記憶装置2が接続されると共に、キーボード等の入力装置3が接続されている。   As shown in FIG. 1, a storage device 2 such as a hard disk and an input device 3 such as a keyboard are connected to the key search device 1 of the present embodiment.

記憶装置2には、キー検索装置1が検索対象にする配列型インデックスAが登録されている。配列型インデックスAは、検索キーの重複を許すものであり、複数の検索キーが昇順に並んでいる。図1の例では、検索キーk3〜k10のキー値が全て「d」となっており、また、検索キーk11,k12のキー値が「e」となっている。なお、図1では、図示を省略したが、記憶装置2には、検索キーk1、k2、…によってポイントされるレコード(データ)も登録されている。また、本実施の形態では、配列型インデックスAとして検索キーが昇順に並んでいるものを例に挙げて説明するが、検索キーが降順に並んでいるものであっても、本発明を適用することができる。   In the storage device 2, an array type index A to be searched by the key search device 1 is registered. The array type index A allows search keys to be duplicated, and a plurality of search keys are arranged in ascending order. In the example of FIG. 1, the key values of the search keys k3 to k10 are all “d”, and the key values of the search keys k11 and k12 are “e”. Although not shown in FIG. 1, the storage device 2 also stores records (data) pointed to by the search keys k1, k2,. In the present embodiment, an example in which search keys are arranged in ascending order as array type index A will be described as an example. However, the present invention is applied even if search keys are arranged in descending order. be able to.

キー検索装置1は、キー検索部SKと、検索法決定部SM、第1の重複キー境界検索部SLおよび第2の重複キー境界検索部SBから構成される境界検索部11と、重複度決定部Dと、重複度管理表DTとから構成されている。   The key search device 1 includes a key search unit SK, a search method determination unit SM, a boundary search unit 11 including a first duplicate key boundary search unit SL, and a second duplicate key boundary search unit SB, and a redundancy degree determination. It consists of a part D and a redundancy management table DT.

キー検索部SKは、入力装置3を介して利用者から検索指示が入力されたとき、配列型インデックスAを二分検索法で検索する機能を有する。図2にキー検索部SKが行う処理の概要を示す。なお、検索指示には、検索対象にするキー値(検索対象キー値)が含まれている。   The key search unit SK has a function of searching the array type index A by a binary search method when a search instruction is input from the user via the input device 3. FIG. 2 shows an outline of processing performed by the key search unit SK. The search instruction includes a key value (search target key value) to be searched.

重複度管理表DTには、配列型インデックスA中の各キー値b,c,d,…毎に、そのキー値を有する検索キーのキー数(重複キー数)および重複キー数の平均値が登録されている。本実施の形態では、図3に示すように、項目「キー値」,「重複キー数」を有するレコードが登録されると共に、重複キー数の平均値が重複度として登録されている。同図の例は、キー値b,c,d,…を有する検索キーの重複キー数がそれぞれ2,1,8,…であることを示すと共に、重複キー数の平均値(重複度)が5.8であることを示している。   In the duplication degree management table DT, for each key value b, c, d,... In the array type index A, the number of search keys having the key value (number of duplicate keys) and the average value of the number of duplicate keys are stored. It is registered. In this embodiment, as shown in FIG. 3, a record having items “key value” and “number of duplicate keys” is registered, and an average value of the number of duplicate keys is registered as the degree of duplication. The example in the figure shows that the number of duplicate keys of search keys having key values b, c, d,... Is 2, 1, 8,. 5.8.

重複度決定部Dは、配列型インデックスAが更新される毎に、重複度管理表DTを参照・更新し、重複度(重複キー数の平均値)を算出し直す機能を有する。図3に重複度決定部Dが行う処理の概要を示す。なお、配列型インデックスAが更新されないものである場合には、重複度決定部Dおよび重複度管理表DTは不要になり、その代わりに、配列型インデックスAの重複度が登録されたメモリなどを用意しておけば良い。   The duplication degree determination unit D has a function of referring to and updating the duplication degree management table DT every time the array type index A is updated, and recalculating the duplication degree (average value of the number of duplicate keys). FIG. 3 shows an overview of the processing performed by the redundancy determining unit D. If the array type index A is not updated, the duplication degree determination unit D and the duplication degree management table DT are not necessary. Instead, a memory in which the duplication degree of the array type index A is registered is used. Prepare it.

境界検出部11は、重複度決定部Dが決定した重複度と、予め定められている閾値Thとに基づいて線形検索法または二分検索法の一方を選択し、選択した検索方法により、キー検索部SKで検索された検索キーを検索開始キーにして、検索対象キー値を有するキーの内の先頭の検索キーを検索する機能を有する。なお、閾値Thは、線形検索法と二分検索法の平均コストの比に基づいて予め決められている値である。   The boundary detection unit 11 selects one of the linear search method and the binary search method based on the duplication degree determined by the duplication degree determination unit D and a predetermined threshold Th, and the key search is performed by the selected search method. The search key searched in the part SK is used as a search start key, and the first search key among the keys having the search target key value is searched. Note that the threshold value Th is a value determined in advance based on a ratio of average costs of the linear search method and the binary search method.

境界検索部11内の検索法決定部SMは、キー検索部SKの処理が終わった後、重複度決定部Dの算出した重複度と、予め定められている閾値Thとを基に、第1,第2の重複キー境界検索部SL,SBの内のどちらを動作させるか決定する機能を有する。   After the processing of the key search unit SK is completed, the search method determination unit SM in the boundary search unit 11 performs the first operation based on the degree of duplication calculated by the duplication degree determination unit D and a predetermined threshold Th. , Has a function of determining which one of the second duplicate key boundary search units SL and SB is to be operated.

第1の重複キー境界検索部SLは、キー検索部SKの検出したキー位置から、線形検索法により同一検索キー群の先頭位置を検出する機能を有する。図4に第1の重複キー境界検索部SLが行う処理の概要を示す。   The first duplicate key boundary search unit SL has a function of detecting the head position of the same search key group by the linear search method from the key position detected by the key search unit SK. FIG. 4 shows an outline of processing performed by the first duplicate key boundary search unit SL.

第2の重複キー境界検索部SBは、キー検索部SKの検出したキー位置から、二分検索法により同一検索キー群の先頭位置を検出する機能を有する。図5に第2の重複キー境界検索部SBが行う処理の概要を示す。   The second duplicate key boundary search unit SB has a function of detecting the head position of the same search key group by the binary search method from the key position detected by the key search unit SK. FIG. 5 shows an outline of processing performed by the second duplicate key boundary search unit SB.

なお、本実施の形態では、第1,第2の重複キー境界検索部SL,SBが同一検索キー群の先頭位置を検出するようにしたが、末尾位置を検出するようにしても良い。また、キー検索装置1は、コンピュータによって実現可能なものであり、コンピュータによって実現する場合は、例えば、次のようにする。コンピュータをキー検索装置1として機能させるためのプログラムを記録したディスク、半導体メモリ、その他の記録媒体を用意し、コンピュータに上記プログラムを読み取らせる。コンピュータは、読み取ったプログラムに従って自身の動作を制御することにより、自コンピュータ上に、キー検索部SK、検索法決定部SM、第1の重複キー境界検索部SL、第2の重複キー境界検索部SBおよび重複度決定部Dを実現する。   In the present embodiment, the first and second duplicate key boundary search units SL and SB detect the start position of the same search key group, but may detect the end position. The key search device 1 can be realized by a computer. When the key search device 1 is realized by a computer, for example, the following is performed. A disk, a semiconductor memory, and other recording media on which a program for causing the computer to function as the key search device 1 is recorded are prepared, and the program is read by the computer. The computer controls its own operation according to the read program, so that a key search unit SK, a search method determination unit SM, a first duplicate key boundary search unit SL, a second duplicate key boundary search unit are provided on the computer. The SB and the redundancy determining unit D are realized.

〔実施の形態の動作の説明〕
次に、各図を参照して本実施の形態の動作について詳細に説明する。
[Description of Operation of Embodiment]
Next, the operation of the present embodiment will be described in detail with reference to the drawings.

先ず、配列型インデックスAの更新時に、重複度決定部Dによって行われる重複度決定処理について図6のフローチャートを参照して説明する。   First, the redundancy determination process performed by the redundancy determination unit D when the array type index A is updated will be described with reference to the flowchart of FIG.

配列型インデックスAの要素の更新(追加・削除を含む)処理が行われると(図6のステップD0)、重複度決定部Dは、配列型インデックスAに対して検索キーの追加または削除のイベントが発生したかどうかを判定する(ステップD1)。   When the process of updating (including addition / deletion) of the element of the array type index A is performed (step D0 in FIG. 6), the duplication degree determination unit D performs an event of adding or deleting a search key for the array type index A. Is determined (step D1).

ステップD1において、追加のイベントが発生したと判定した場合には、重複度管理表加算処理DAを実行し、イベントループの終端であるステップD4に進む(ステップD2→D4)。なお、重複度管理表加算処理DAについては、後で図7のフローチャートを参照して詳しく説明する。   If it is determined in step D1 that an additional event has occurred, the redundancy management table addition process DA is executed, and the process proceeds to step D4, which is the end of the event loop (step D2 → D4). The redundancy management table addition process DA will be described in detail later with reference to the flowchart of FIG.

また、ステップD1において、削除のイベントが発生したと判定した場合には、重複度管理表減算処理DSを実行し、イベントループの終端であるステップD4に進む(ステップD3→D4)。なお、重複度管理表減算処理DSについては、後で図8のフローチャートを参照して詳しく説明する。   If it is determined in step D1 that a deletion event has occurred, the redundancy management table subtraction process DS is executed, and the process proceeds to step D4, which is the end of the event loop (step D3 → D4). The redundancy management table subtraction process DS will be described in detail later with reference to the flowchart of FIG.

また、ステップD1において、追加のイベントも削除のイベントも発生していないと判定した場合には、イベントループの終端であるステップD4に進む(ステップD1→D4)。   If it is determined in step D1 that neither an additional event nor a deletion event has occurred, the process proceeds to step D4 which is the end of the event loop (step D1 → D4).

ステップD4において、残りのイベントが存在すると判定した場合(判定結果がyesの場合)は、ステップD1に戻る。これに対して、ステップD4において、残りのイベントが存在しないと判定した場合(判定結果がnoの場合)は、ステップD5に進む。   In step D4, when it is determined that there are remaining events (when the determination result is yes), the process returns to step D1. On the other hand, when it is determined in step D4 that there are no remaining events (when the determination result is no), the process proceeds to step D5.

ステップD5では、重複度管理表DTを参照し、各キー値に対応付けて登録されている重複キー数の平均値を重複度として算出する。これにより、重複度決定部Dは、その処理を終了する。   In step D5, the duplication degree management table DT is referred to, and an average value of the number of duplicate keys registered in association with each key value is calculated as the duplication degree. Thereby, the multiplicity determination unit D ends the process.

次に、図6のステップD2で行う重複度管理表加算処理DAについて、図7のフローチャートを参照して詳細に説明する。   Next, the redundancy management table addition process DA performed in step D2 of FIG. 6 will be described in detail with reference to the flowchart of FIG.

先ず、二分検索法により重複度管理表DTを検索し、目的の検索キー(追加された検索キー)のキー値kと同一のキー値を有するレコードを探し出す(ステップDA1)。   First, the duplication degree management table DT is searched by the binary search method to find a record having the same key value as the key value k of the target search key (added search key) (step DA1).

そして、該当レコードが存在しなければ(ステップDA2がno)、キー値「k」、重複キー数「0」を持つレコードを重複度管理表DTに追加し、更に、当該キーにおいて重複度管理表DT中の各レコードを昇順ソートした後(ステップDA3)、ステップDA4へ進む。これに対して、該当レコードが存在する場合(ステップDA2がyes)は、直ちにステップDA4へ進む。   If the corresponding record does not exist (step DA2 is no), a record having the key value “k” and the number of duplicate keys “0” is added to the duplicate management table DT, and further, the duplicate management table for the key is added. After the records in DT are sorted in ascending order (step DA3), the process proceeds to step DA4. On the other hand, if the corresponding record exists (step DA2 is yes), the process immediately proceeds to step DA4.

ステップDA4では、重複度管理表DT中のキー値kを持つレコードの重複キー数を1インクリメントする。以上が、図6のステップD2で行う重複度管理表加算処理DAの詳細である。   In step DA4, the number of duplicate keys of the record having the key value k in the duplicate management table DT is incremented by one. The above is the details of the redundancy management table addition process DA performed in step D2 of FIG.

次に、図6のステップD3で行う重複度管理表減算処理DSについて図8のフローチャートを参照して詳細に説明する。   Next, the redundancy management table subtraction process DS performed in step D3 of FIG. 6 will be described in detail with reference to the flowchart of FIG.

先ず、二分検索法により重複度管理表DTを検索し、目的の検索キー(削除された検索キー)のキー値kと同一のキー値を有するレコードを探し出す(ステップDS1)。次いで、探し出したレコード中の重複キー数を1デクリメントする(ステップDS2)。   First, the duplication degree management table DT is searched by the binary search method to find a record having the same key value as the key value k of the target search key (deleted search key) (step DS1). Next, the number of duplicate keys in the found record is decremented by 1 (step DS2).

そして、上記レコード中の重複キー数が「0」になったなら(ステップDS3がyes)、上記レコードを重複度管理表DTから削除した後、当該キーにより重複度管理表DT中のレコードを昇順ソートし(ステップDS4)、重複度管理表減算処理DSを終了する。これに対して、上記レコード中の重複キー数が「0」にならなかったら(ステップDS3がno)、直ちに、重複度管理表減算処理DSを終了する。以上が、図6のステップD3で行う重複度管理表減算処理の詳細である。   If the number of duplicate keys in the record becomes “0” (Yes in step DS3), the record is deleted from the duplicate management table DT, and then the records in the duplicate management table DT are arranged in ascending order by the key. Sorting is performed (step DS4), and the duplication degree management table subtraction process DS is terminated. On the other hand, if the number of duplicate keys in the record does not become “0” (step DS3 is no), the duplicate management table subtraction process DS is immediately terminated. The above is the details of the redundancy management table subtraction process performed in step D3 of FIG.

次に、配列型インデックスAを検索する場合の動作について説明する。   Next, the operation when searching for the array type index A will be described.

利用者は、配列型インデックスAを検索する場合、入力装置3から検索指示を入力する。この検索指示には、検索対象にする検索キーのキー値kが含まれている。   When searching for the array type index A, the user inputs a search instruction from the input device 3. This search instruction includes the key value k of the search key to be searched.

検索指示が入力されると、先ず、キー検索部SKによって図9のフローチャートに示すキー検索処理が行われる。   When a search instruction is input, first, key search processing shown in the flowchart of FIG. 9 is performed by the key search unit SK.

先ず、キー検索部SKは、配列型インデックスAの上限位置(配列の添え字)を上限ポインタuに、下限位置を下限ポインタlに設定する(ステップSK1)。   First, the key search unit SK sets the upper limit position (array suffix) of the array type index A to the upper limit pointer u and the lower limit position to the lower limit pointer l (step SK1).

次いで、上限ポインタuに設定されている上限位置と、下限ポインタlに設定されている下限位置との中間位置を求め、検索ポインタmに設定する(ステップSK2)。ここで、中間位置は、{(l+u)+1}/2となる。ただし、mが小数になる場合には、小数点以下を切り捨てる。   Next, an intermediate position between the upper limit position set in the upper limit pointer u and the lower limit position set in the lower limit pointer l is obtained and set in the search pointer m (step SK2). Here, the intermediate position is {(l + u) +1} / 2. However, when m is a decimal, the decimal part is rounded down.

そして、検索ポインタmで示される検索位置のキー値A[m](配列型インデックスAの第m番目のキー値)が検索対象キー値kと等しければ(ステップSK3がyes)、mを検出位置ポインタk0に、lを検索下限ポインタklに設定し、更に、検索法決定部SMを起動した後(ステップSK8)、キー検索処理を終了する。これに対して、A[m]≠kならば(ステップSK3がno)、A[m]>kであるか否かを調べる(ステップSK4)。   If the key value A [m] at the search position indicated by the search pointer m (the mth key value of the array type index A) is equal to the search target key value k (step SK3 is yes), m is detected. The pointer k0 is set to 1 as the search lower limit pointer kl, and after the search method determination unit SM is activated (step SK8), the key search process is terminated. On the other hand, if A [m] ≠ k (step SK3 is no), it is checked whether A [m]> k (step SK4).

そして、A[m]>kならば(ステップSK4がyes)、上限ポインタuをm−1で更新し(ステップSK5)、ステップSK7に進む。これに対して、A[m]≦Kならば(ステップSK4がno)、下限ポインタlをm+1で更新し(ステップSK6)、ステップSK7に進む。   If A [m]> k (step SK4 is yes), the upper limit pointer u is updated by m−1 (step SK5), and the process proceeds to step SK7. On the other hand, if A [m] ≦ K (step SK4 is no), the lower limit pointer l is updated with m + 1 (step SK6), and the process proceeds to step SK7.

ステップSK7において、l>uならば(判定結果がyes)、該当データなしとしてキー検索処理を終了する。その際、図示を省略した表示装置に該当データがない旨を表示するようにしても良い。これに対して、l≦uならば(ステップSK7がno)、ステップSK2に戻る。   In step SK7, if l> u (determination result is yes), the key search process is terminated as no corresponding data. At this time, a message indicating that there is no corresponding data may be displayed on a display device (not shown). On the other hand, if l ≦ u (step SK7 is no), the process returns to step SK2.

次に、検索法決定部SMで行う検索法決定処理を、図10のフローチャートを参照して説明する。   Next, search method determination processing performed by the search method determination unit SM will be described with reference to the flowchart of FIG.

検索法決定部SMは、キー検索部SKから起動されると、先ず、重複度決定部Dによって決定されている重複度dと、予め定められている閾値Thとを比較する(ステップSM1)。ここで、上記閾値Thは、前述したように、線形検索法の平均コストと二分検索法の平均コストとの比に応じて予め決めておくものであり、線形検索法および二分検索法のコストが図15に示すものである場合には、上記閾値Thは前述したように「6」となる。   When activated by the key search unit SK, the search method determination unit SM first compares the duplication degree d determined by the duplication degree determination unit D with a predetermined threshold value Th (step SM1). Here, as described above, the threshold value Th is determined in advance according to the ratio of the average cost of the linear search method and the average cost of the binary search method, and the costs of the linear search method and the binary search method are the same. In the case shown in FIG. 15, the threshold value Th is “6” as described above.

そして、重複度dが閾値未満Thならば(ステップSM1がyes)、線形検索法により検索を行う第1の重複キー境界検索部SLを起動し(ステップSM2)、検索法決定処理を終了する。これに対して、重複度dが閾値Th以上である場合(ステップSM1がno)は、二分検索法により検索を行う第2の重複キー境界検索部SBを起動し(ステップSM3)、検索法決定処理を終了する。   If the duplication degree d is less than the threshold Th (step SM1 is yes), the first duplicate key boundary search unit SL that performs the search by the linear search method is activated (step SM2), and the search method determination process is terminated. On the other hand, when the duplication degree d is equal to or greater than the threshold value Th (step SM1 is no), the second duplicate key boundary search unit SB that performs the search by the binary search method is activated (step SM3), and the search method is determined. The process ends.

次に、第1の重複キー境界検索部SLの動作を説明する。重複キー境界検索部SLは、検索法決定部SMから起動されると、図11のフローチャートに示す線形検索法を用いた重複キー境界検索処理を行う。   Next, the operation of the first duplicate key boundary search unit SL will be described. When the duplicate key boundary search unit SL is activated by the search method determination unit SM, the duplicate key boundary search unit SL performs a duplicate key boundary search process using the linear search method shown in the flowchart of FIG.

重複キー境界検索部SLは、先ず、キー検索部SKによって検出位置ポインタk0に設定されている値を検索ポインタmに、検索下限ポインタklに設定されている値を下限ポインタlに設定する(ステップSL1)。   First, the duplicate key boundary search unit SL sets the value set in the detection position pointer k0 by the key search unit SK as the search pointer m and the value set in the search lower limit pointer kl as the lower limit pointer l (step) SL1).

その後、検索ポインタmによって示される検索位置よりも1つ前の要素のキー値A[m-1]が、検索対象キー値kと一致しているか否かを調べる(ステップSL2)。   Thereafter, it is checked whether or not the key value A [m−1] of the element immediately before the search position indicated by the search pointer m matches the search target key value k (step SL2).

そして、キー値A [m-1]が検索対象キー値kでない場合(ステップSL2がno)は、mが目的キーの先頭位置になるので、mを検出位置ポインタk0に設定し(ステップSL5)、重複キー境界検索処理(線形検索用)を終了する。これに対して、キー値A[m-1]が検索対象キー値kである場合(ステップSL2がyes)は、検索下限の判定を行うためにステップSL3に進む。   If the key value A [m-1] is not the search target key value k (step SL2 is no), m is the start position of the target key, so m is set as the detection position pointer k0 (step SL5). The duplicate key boundary search process (for linear search) is terminated. On the other hand, when the key value A [m−1] is the search target key value k (step SL2 is yes), the process proceeds to step SL3 to determine the search lower limit.

ステップSL3では、検索ポインタmと下限ポインタlが等しいか否かを調べる。そして、m=lの場合(ステップSL3がyes)は、検索下限まで全て検索したことになるので、mを検出位置ポインタk0に設定し(ステップSL5)、重複キー境界検索処理を終了する。これに対して、m=lでない場合(ステップSL3がno)は、検索位置を更新するために、検索ポインタmをデクリメントし(ステップSL4)、ステップSL2に戻る。   In step SL3, it is checked whether or not the search pointer m and the lower limit pointer l are equal. If m = 1 (step SL3 is yes), all the search is performed up to the search lower limit, so m is set as the detection position pointer k0 (step SL5), and the duplicate key boundary search process is terminated. On the other hand, when m is not 1 (step SL3 is no), the search pointer m is decremented (step SL4) and the process returns to step SL2 in order to update the search position.

次に、第2の重複キー境界検索部SBの動作について説明する。重複キー境界検索部SBは、検索法決定部SMから起動されると、図12のフローチャートに示す二分検索法を用いた重複キー境界検索処理を行う。   Next, the operation of the second duplicate key boundary search unit SB will be described. When the duplicate key boundary search unit SB is activated from the search method determination unit SM, the duplicate key boundary search unit SB performs a duplicate key boundary search process using the binary search method shown in the flowchart of FIG.

先ず、重複キー境界検索部SBは、キー検索部SKが検出位置ポインタk0,検索下限ポインタklに設定した値をそれぞれ上限ポインタu,下限ポインタlに設定する(ステップSB1)。   First, the duplicate key boundary search unit SB sets the values set by the key search unit SK to the detection position pointer k0 and the search lower limit pointer kl as the upper limit pointer u and the lower limit pointer l, respectively (step SB1).

次いで、上限ポインタuに設定されている上限位置と、下限ポインタlに設定されている下限位置との中間位置を求め、検索ポインタmに設定する(ステップSB2)。ここで、中間位置は、{(l+u)+1}/2となる。ただし、mが小数になる場合には、小数点以下を切り捨てる。   Next, an intermediate position between the upper limit position set in the upper limit pointer u and the lower limit position set in the lower limit pointer l is obtained and set in the search pointer m (step SB2). Here, the intermediate position is {(l + u) +1} / 2. However, when m is a decimal, the decimal part is rounded down.

その後、検索ポインタmの値と上限ポインタuの値が同じであるか否かを調べる(ステップSB3)。   Thereafter, it is checked whether or not the value of the search pointer m and the value of the upper limit pointer u are the same (step SB3).

そして、m=uである場合(ステップSB3がyes)は、u-l≦1であり、実質的に検索終了であるので、ステップSB8に進む。これに対して、m=uでない場合(ステップSB3がno)は、、ステップSB4に進む。   If m = u (Yes in step SB3), u-l ≦ 1 and the search is substantially completed, so the process proceeds to step SB8. On the other hand, when m = u is not satisfied (step SB3 is no), the process proceeds to step SB4.

ステップSB4では、検索ポインタmによって示されるキー値A[m]が検索対象キー値kと等しいか否かを調べる。   In step SB4, it is checked whether or not the key value A [m] indicated by the search pointer m is equal to the search target key value k.

そして、A[m]=kの場合(ステップSB4がyes)は、目的キーの先頭位置判定を行うためにステップSB6に進む。これに対して、A[m]≠kの場合(ステップSB4がno)は、m+1を下限ポインタlに設定し(ステップSB5)、ステップSB2に戻る。   If A [m] = k (step SB4 is yes), the process proceeds to step SB6 to determine the start position of the target key. On the other hand, if A [m] ≠ k (step SB4 is no), m + 1 is set to the lower limit pointer l (step SB5), and the process returns to step SB2.

ステップSB6では、A[m-1]=kであるか否かを調べる。   In step SB6, it is checked whether A [m-1] = k.

そして、A[m-1]=kである場合(ステップSB6がyes)は、m−1を上限ポインタuに設定し(ステップSB7)、ステップSB2に戻る。これに対して、A[m-1]≠kの場合(ステップSB6がno)は、mが目的キーの先頭位置になるので、mを検出位置ポインタk0に設定し(ステップSB10)、重複キー先頭検索処理を終了する。   If A [m-1] = k (step SB6 is yes), m-1 is set as the upper limit pointer u (step SB7), and the process returns to step SB2. On the other hand, when A [m−1] ≠ k (step SB6 is no), m is the start position of the target key, so m is set as the detection position pointer k0 (step SB10), and the duplicate key is set. The head search process ends.

また、ステップSB8では、A[l]=kであるか否かを調べる。   In step SB8, it is checked whether A [l] = k.

そして、A[l]=kの場合(ステップSB8がyes)は、lが目的キーの先頭位置になるので、lを検出位置ポインタk0に設定し(ステップSB9)、重複キー先頭検索処理SBを終了する。これに対して、A[l]≠kの場合(ステップSB8がno)は、mが目的キーの先頭位置になるので、mを検索位置ポインタk0に設定し(ステップSB10)、重複キー先頭検索処理(二分検索用)を終了する。   If A [l] = k (step SB8 is yes), l becomes the start position of the target key, so l is set as the detection position pointer k0 (step SB9), and the duplicate key head search process SB is executed. finish. On the other hand, if A [l] ≠ k (step SB8 is no), m is the start position of the target key, so m is set as the search position pointer k0 (step SB10), and duplicate key head search is performed. The process (for binary search) is terminated.

〔実施の形態の効果〕
本実施の形態によれば、配列型インデックスAに含まれている同一キー値を有する検索キーの数にかかわらず、検索対象キー値を有する検索キーの内の、先頭の検索キーを高速に検索できるという効果を得ることができる。その理由は、配列型インデックスAの検索キーの重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、線形検索法または二分検索法の内の一方を選択し、選択した検索方法により、キー検索部SKで検索された検索キーを検索開始キーにして、検索対象キー値を有する検索キーの内の、先頭の検索キーを検索する境界検索部11を備えているからである。
[Effect of the embodiment]
According to the present embodiment, regardless of the number of search keys having the same key value included in the array type index A, the first search key among the search keys having the search target key value is searched at high speed. The effect that it is possible can be obtained. The reason is that one of the linear search method and the binary search method is selected and selected based on the redundancy of the search key of the array type index A and the ratio of the average cost of the linear search method and the binary search method. Because the search method includes a boundary search unit 11 that searches the search key searched by the key search unit SK as a search start key and searches for the first search key among the search keys having the search target key value. is there.

また、本実施の形態は、配列型インデックスAに検索キーが追加された場合や、配列型インデックスAから検索キーが削除された場合であっても、検索対象キー値を有する検索キーの内の、先頭の検索キーを高速に検索することができるという効果を得ることができる。その理由は、配列型インデックスAに検索キーが追加された場合および配列型インデックスAから検索キーが削除された場合、重複度管理表DTを更新し、更新後の重複度管理表DTの内容に基づいて、キー値毎のキー数の平均値を重複度として算出する重複度決定部Dを備えているからである。   Further, in the present embodiment, even when a search key is added to the array type index A or when a search key is deleted from the array type index A, the search key among the search keys having the search target key value Thus, it is possible to obtain the effect that the head search key can be searched at high speed. The reason is that when the search key is added to the array type index A and when the search key is deleted from the array type index A, the duplication degree management table DT is updated, and the contents of the updated duplication degree management table DT are added. This is because there is provided a duplication degree determining unit D that calculates an average value of the number of keys for each key value as the duplication degree.

本発明によれば、配列型インデックスをはじめ、重複するキーをもつデータ列の検索全般に適用できる。   INDUSTRIAL APPLICABILITY According to the present invention, the present invention can be applied to general search for data strings having overlapping keys including array type indexes.

本発明にかかるキー検索装置1の実施の形態の構成例を示すブロック図である。It is a block diagram which shows the structural example of embodiment of the key search device 1 concerning this invention. キー検索部SKが行う処理の概要を示す図である。It is a figure which shows the outline | summary of the process which the key search part SK performs. 重複度管理表DTの内容例を示すと共に、重複度決定部Dが行う処理の概要を示す図である。It is a figure which shows the example of the content of the duplication degree management table | surface DT, and shows the outline | summary of the process which the duplication degree determination part D performs. 第1の重複キー境界検索部SLが行う処理の概要を示す図である。It is a figure which shows the outline | summary of the process which 1st duplication key boundary search part SL performs. 第2の重複キー境界検索部SBが行う処理の概要を示す図である。It is a figure which shows the outline | summary of the process which 2nd duplication key boundary search part SB performs. 重複度決定部Dの処理例を示すフローチャートである。6 is a flowchart illustrating an example of processing of a redundancy determining unit D. 図6のフローチャートのステップD2の詳細を示すフローチャートである。It is a flowchart which shows the detail of step D2 of the flowchart of FIG. 図6のフローチャートのステップD3の詳細を示すフローチャートである。It is a flowchart which shows the detail of step D3 of the flowchart of FIG. キー検索部SKの処理例を示すフローチャートである。It is a flowchart which shows the process example of the key search part SK. 検索法決定部SMの処理例を示すフローチャートである。It is a flowchart which shows the process example of the search method determination part SM. 第1の重複キー境界検索部SLの処理例を示すフローチャートである。It is a flowchart which shows the process example of 1st duplication key boundary search part SL. 第2の重複キー境界検索部SBの処理例を示すフローチャートである。It is a flowchart which shows the process example of 2nd duplication key boundary search part SB. データ数が1〜10のときの、線形検索法および二分検索法の最大比較回数を示す図である。It is a figure which shows the maximum frequency | count of comparison of a linear search method and a binary search method when the number of data is 1-10. 線形検索法と二分検索法の平均コストの一例を示す図である。It is a figure which shows an example of the average cost of a linear search method and a binary search method. データ数が1〜10のときの、線形検索法および二分検索法のコストを示す図である。It is a figure which shows the cost of a linear search method and a binary search method when the number of data is 1-10. 配列型インデックスの一例を示す図である。It is a figure which shows an example of an array type | mold index.

符号の説明Explanation of symbols

1…キー検索装置
D…重複度決定部
DT…重複度管理表
SK…キー検索部
11…境界検索部
SM…検索法決定部
SL…第1の重複キー境界検索部(線形検索法)
SB…第2の重複キー境界検索部(二分検索法)
2…記憶装置
A…配列型インデックス
3…入力装置
DESCRIPTION OF SYMBOLS 1 ... Key search device D ... Duplication degree determination part DT ... Duplication degree management table SK ... Key search part 11 ... Boundary search part SM ... Search method determination part SL ... 1st duplicate key boundary search part (linear search method)
SB: Second duplicate key boundary search unit (binary search method)
2 ... Storage device A ... Array type index 3 ... Input device

Claims (12)

複数の検索キーが昇順または降順に並び、且つキー値が同一の検索キーを含んだ検索対象キー列の中から、指示された検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを検索するキー検索装置であって、
前記検索対象キー列から、前記検索対象キー値を有する検索キーを二分検索法によって検索するキー検索部と、
前記検索対象キー列の検索キーの重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、線形検索法または二分検索法の内の一方を選択し、該選択した検索方法により、前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを検索する境界検索部とを備えたことを特徴とするキー検索装置。
A plurality of search keys arranged in ascending or descending order, and a key having a designated search target key value and different from the search target key value out of a search target key string including a search key having the same key value A key search device for searching a search key that is a boundary with a search key having a value,
A key search unit for searching a search key having the search target key value from the search target key string by a binary search method;
Based on the search key duplication degree of the search target key column and the ratio of the average cost of the linear search method and the binary search method, one of the linear search method and the binary search method is selected, and the selected search method By using the search key searched by the key search unit as a search start key, a search key serving as a boundary with a search key having the search target key value and having a key value different from the search target key value A key search device comprising a boundary search unit for searching.
請求項1記載のキー検索装置において、
前記境界検索部が、
前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを、線形検索法によって検索する第1の重複キー境界検索部と、
前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを、二分検索法によって検索する第2の重複キー境界検索部と、
前記検索対象キー列の検索キーの重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、前記第1の重複キー境界検索部または前記第2の重複キー境界検索部を動作させる検索法決定部を備えたことを特徴とするキー検索装置。
The key search device according to claim 1,
The boundary search unit
Using the search key searched by the key search unit as a search start key, a search key that is a boundary between a search key having the search target key value and a key value different from the search target key value is linearly A first duplicate key boundary search unit for searching by a search method;
Using a search key searched by the key search unit as a search start key, a search key that is a boundary between a search key having the search target key value and a key value different from the search target key value is divided into two A second duplicate key boundary search unit for searching by a search method;
The first duplicate key boundary search unit or the second duplicate key boundary search unit is based on the degree of duplication of the search key of the search target key column and the ratio of the average cost of the linear search method and the binary search method. A key search device comprising a search method determination unit to be operated.
請求項1または2記載のキー検索装置において、
前記重複度が、同一キー値を有する検索キーのキー数が多くなるほど、大きな値となることを特徴とするキー検索装置。
The key search device according to claim 1 or 2,
The key search device according to claim 1, wherein the degree of duplication increases as the number of search keys having the same key value increases.
請求項3記載のキー検索装置において、
前記検索対象キー列中の各キー値毎に、そのキー値を有する検索キーのキー数が登録された重複度管理表と、
前記検索対象キー列に検索キーが追加された場合および前記検索対象キー列から検索キーが削除された場合、前記重複度管理表を更新し、更新後の前記重複度管理表の内容に基づいて、キー値毎のキー数の平均値を求め、該平均値を重複度とする重複度決定部とを備えたことを特徴とするキー検索装置。
The key search device according to claim 3, wherein
For each key value in the search target key column, a duplication degree management table in which the number of search keys having the key value is registered;
When a search key is added to the search target key column and when a search key is deleted from the search target key column, the duplication degree management table is updated, based on the contents of the updated duplication degree management table And a duplication degree determining unit that obtains an average value of the number of keys for each key value and uses the average value as a duplication degree.
複数の検索キーが昇順または降順に並び、且つキー値が同一の検索キーを含んだ検索対象キー列の中から、指示された検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを検索するキー検索方法であって、
前記検索対象キー列から、前記検索対象キー値を有する検索キーを二分検索法によって検索するキー検索ステップと、
前記検索対象キー列の検索キーの重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、線形検索法または二分検索法の内の一方を選択し、該選択した検索方法により、前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを検索する境界検索ステップとを含むことを特徴とするキー検索方法。
A plurality of search keys arranged in ascending or descending order, and a key having a designated search target key value and different from the search target key value out of a search target key string including a search key having the same key value A key search method for searching a search key that is a boundary with a search key having a value,
A key search step of searching a search key having the search target key value from the search target key string by a binary search method;
Based on the duplication degree of the search key of the search target key column and the ratio of the average cost of the linear search method and the binary search method, one of the linear search method and the binary search method is selected, and the selected search method By using the search key searched by the key search unit as a search start key, a search key serving as a boundary with a search key having the search target key value and having a key value different from the search target key value And a boundary search step for searching.
請求項5記載のキー検索方法において、
前記境界検索ステップが、
前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを、線形検索法によって検索する第1の重複キー境界検索ステップと、
前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを、二分検索法によって検索する第2の重複キー境界検索ステップと、
前記検索対象キー列の検索キーの重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、前記第1の重複キー境界検索ステップまたは前記第2の重複キー境界検索ステップを起動させる検索法決定ステップとを含むことを特徴とするキー検索方法。
The key search method according to claim 5, wherein
The boundary search step includes:
Using the search key searched by the key search unit as a search start key, a search key that is a boundary between a search key having the search target key value and a key value different from the search target key value is linearly A first duplicate key boundary search step for searching by a search method;
Using a search key searched by the key search unit as a search start key, a search key that is a boundary between a search key having the search target key value and a key value different from the search target key value is divided into two A second duplicate key boundary search step for searching by a search method;
The first duplicate key boundary search step or the second duplicate key boundary search step is performed based on the degree of duplication of the search key of the search target key string and the ratio of the average cost of the linear search method and the binary search method. A key retrieval method comprising: a retrieval method determination step to be activated.
請求項5または6記載のキー検索方法において、
前記重複度が、同一キー値を有する検索キーのキー数が多くなるほど、大きな値となることを特徴とするキー検索方法。
The key search method according to claim 5 or 6,
The key search method according to claim 1, wherein the degree of duplication increases as the number of search keys having the same key value increases.
請求項7記載のキー検索方法において、
前記検索対象キー列に検索キーが追加された場合および前記検索対象キー列から検索キーが削除された場合、前記検索対象キー列中の各キー値毎に、そのキー値を有する検索キーのキー数が登録された重複度管理表を更新し、更新後の前記重複度管理表の内容に基づいて、キー値毎のキー数の平均値を求め、該平均値を重複度とする重複度決定ステップを含むことを特徴とするキー検索方法。
The key search method according to claim 7,
When a search key is added to the search target key column and when a search key is deleted from the search target key column, for each key value in the search target key column, the key of the search key having that key value The duplication degree management table in which the number is registered is updated, the average value of the number of keys for each key value is obtained based on the contents of the updated duplication degree management table, and the duplication degree is determined by using the average value as the duplication degree A key search method comprising steps.
コンピュータを、複数の検索キーが昇順または降順に並び、且つキー値が同一の検索キーを含んだ検索対象キー列の中から、指示された検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを検索するキー検索装置として機能させるためのプログラムであって、
前記コンピュータを、
前記検索対象キー列から、前記検索対象キー値を有する検索キーを二分検索法によって検索するキー検索部、
前記検索対象キー列の検索キーの重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、線形検索法または二分検索法の内の一方を選択し、該選択した検索方法により、前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを検索する境界検索部として機能させるためのプログラム。
A plurality of search keys arranged in ascending or descending order, and a search target key string including a search key having the same key value, the specified search target key value and the search target key value; Is a program for functioning as a key search device that searches for a search key that is a boundary with a search key having a different key value,
The computer,
A key search unit for searching a search key having the search target key value from the search target key string by a binary search method;
Based on the search key duplication degree of the search target key column and the ratio of the average cost of the linear search method and the binary search method, one of the linear search method and the binary search method is selected, and the selected search method By using the search key searched by the key search unit as a search start key, a search key serving as a boundary with a search key having the search target key value and having a key value different from the search target key value A program for functioning as a boundary search unit for searching.
請求項9記載のプログラムにおいて、
前記境界検索部が、
前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを、線形検索法によって検索する第1の重複キー境界検索部と、
前記キー検索部で検索された検索キーを検索開始キーにして、前記検索対象キー値を有し且つ前記検索対象キー値とは異なるキー値を有する検索キーとの境界となる検索キーを、二分検索法によって検索する第2の重複キー境界検索部と、
前記検索対象キー列の検索キーの重複度と、線形検索法と二分検索法の平均コストの比とに基づいて、前記第1の重複キー境界検索部または前記第2の重複キー境界検索部を動作させる検索法決定部を備えたことを特徴とするプログラム。
The program according to claim 9, wherein
The boundary search unit
Using the search key searched by the key search unit as a search start key, a search key that is a boundary between a search key having the search target key value and a key value different from the search target key value is linearly A first duplicate key boundary search unit for searching by a search method;
Using a search key searched by the key search unit as a search start key, a search key that is a boundary between a search key having the search target key value and a key value different from the search target key value is divided into two A second duplicate key boundary search unit for searching by a search method;
The first duplicate key boundary search unit or the second duplicate key boundary search unit is based on the degree of duplication of the search key of the search target key column and the ratio of the average cost of the linear search method and the binary search method. A program characterized by comprising a search method determination unit to be operated.
請求項9または10記載のプログラムにおいて、
前記重複度が、同一キー値を有する検索キーのキー数が多くなるほど、大きな値となることを特徴とするプログラム。
The program according to claim 9 or 10,
The degree of duplication becomes a larger value as the number of search keys having the same key value increases.
請求項11記載のプログラムにおいて、
前記コンピュータを、
前記検索対象キー列に検索キーが追加された場合および前記検索対象キー列から検索キーが削除された場合、前記検索対象キー列中の各キー値毎に、そのキー値を有する検索キーのキー数が登録された重複度管理表を更新し、更新後の前記重複度管理表の内容に基づいて、キー値毎のキー数の平均値を求め、該平均値を重複度とする重複度決定部として機能させるためのプログラム。
The program according to claim 11, wherein
The computer,
When a search key is added to the search target key column and when a search key is deleted from the search target key column, for each key value in the search target key column, the key of the search key having that key value The duplication degree management table in which the number is registered is updated, the average value of the number of keys for each key value is obtained based on the contents of the updated duplication degree management table, and the duplication degree determination is performed using the average value as the duplication degree Program to function as a part.
JP2006069198A 2006-03-14 2006-03-14 Key search device, key search method, and program Withdrawn JP2007249369A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2006069198A JP2007249369A (en) 2006-03-14 2006-03-14 Key search device, key search method, and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2006069198A JP2007249369A (en) 2006-03-14 2006-03-14 Key search device, key search method, and program

Publications (1)

Publication Number Publication Date
JP2007249369A true JP2007249369A (en) 2007-09-27

Family

ID=38593630

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2006069198A Withdrawn JP2007249369A (en) 2006-03-14 2006-03-14 Key search device, key search method, and program

Country Status (1)

Country Link
JP (1) JP2007249369A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009265875A (en) * 2008-04-24 2009-11-12 Aisin Aw Co Ltd Search device and program
CN101477550B (en) * 2009-01-22 2012-12-12 华为终端有限公司 Built-in equipment based data search method and apparatus, and built-in equipment thereof
JP2018124633A (en) * 2017-01-30 2018-08-09 株式会社デンソー Electronic control device

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009265875A (en) * 2008-04-24 2009-11-12 Aisin Aw Co Ltd Search device and program
CN101477550B (en) * 2009-01-22 2012-12-12 华为终端有限公司 Built-in equipment based data search method and apparatus, and built-in equipment thereof
JP2018124633A (en) * 2017-01-30 2018-08-09 株式会社デンソー Electronic control device

Similar Documents

Publication Publication Date Title
JP6327234B2 (en) Event analysis device, event analysis system, event analysis method, and event analysis program
JP5985040B2 (en) Data analysis apparatus and method
WO2013094003A1 (en) Method, program, and device for determining software installation sequence
WO2007077993A1 (en) Information processing device and method, and recording medium
JP2017091178A (en) Event analysis device, event analysis system, event analysis method, and event analysis program
JPWO2008108297A1 (en) Homology search system
RU2716553C1 (en) Signature creation device, signature creation method, recording medium in which signature creation program is recorded, and software determination system
JP2007249369A (en) Key search device, key search method, and program
JP2007304796A (en) Database analysis system, database analysis method and program
JP4992301B2 (en) Search processing method and apparatus
JP4887777B2 (en) Performance information recording device
KR20090083972A (en) Method for building music database for music search, method and apparatus for searching music based on humming query
JP2006155344A (en) Data analyzer, data analysis program, and data analysis method
CN113495901B (en) Quick retrieval method for variable-length data blocks
JP2012247948A (en) Dictionary management apparatus, dictionary management method and dictionary management program
JP6549786B2 (en) Data cleansing system, method and program
JP2007323664A (en) Information processor, information processing method and program
JP7059599B2 (en) Search processing program, search processing method and search processing device
JP4416644B2 (en) Character processing apparatus with prediction function, method, recording medium, and program
JP2020123035A (en) Sort method and sort program and sort device
JP4181723B2 (en) Index creating apparatus, index creating method, and recording medium
JP2015156084A (en) Search device, and control method and program of the same
JP2005085109A (en) Information retrieval device and program
JP4547998B2 (en) Recording information management apparatus and program
JP5768561B2 (en) Input support program, input support apparatus, and input support method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20070710

RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20090610

RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7423

Effective date: 20090610

A761 Written withdrawal of application

Free format text: JAPANESE INTERMEDIATE CODE: A761

Effective date: 20091223