CN101315628B - Internal memory database system and method and device for implementing internal memory data base - Google Patents

Internal memory database system and method and device for implementing internal memory data base Download PDF

Info

Publication number
CN101315628B
CN101315628B CN 200710105890 CN200710105890A CN101315628B CN 101315628 B CN101315628 B CN 101315628B CN 200710105890 CN200710105890 CN 200710105890 CN 200710105890 A CN200710105890 A CN 200710105890A CN 101315628 B CN101315628 B CN 101315628B
Authority
CN
China
Prior art keywords
table
database
information
storage area
index
Prior art date
Application number
CN 200710105890
Other languages
Chinese (zh)
Other versions
CN101315628A (en
Inventor
周丹弟
李向东
Original Assignee
华为技术有限公司
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 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN 200710105890 priority Critical patent/CN101315628B/en
Publication of CN101315628A publication Critical patent/CN101315628A/en
Application granted granted Critical
Publication of CN101315628B publication Critical patent/CN101315628B/en

Links

Abstract

The invention discloses a memory database system which comprises a communication interface, a establishing device, a write operation device, a query operation device and a relief operation device; the establishing device is used for establishing a first storage area of the description information of a memory database in a shared memory, storing a second storage area used for locating the index information of table records and a third storage area used for storing the table records, and storing the description information of the memory database into the first storage area; the third storage area comprises storage units which are matched with the table records in size, and each storage unit stores one table record of the database, a physical block is formed by the storage units which have the same size and are continuous in physical space, and a logical block is linked by one physical block or a plurality of the same physical blocks. The invention also discloses a method for establishing the memory database, a method and the device for establishing multiple indexes. The invention realizes the loose coupling of the memory database table structure and the data storage structure, and can flexibly establish and manage the memory database.

Description

内存数据库系统及实现内存数据库的方法和装置 Method and apparatus to implement memory-memory database system and database

技术领域 FIELD

[0001] 本发明涉及计算机及通信领域的数据库技术,特别涉及一种内存数据库技术。 [0001] The present invention relates to the field of computer communications and database technology, particularly to a memory database. 背景技术 Background technique

[0002] 目前的内存数据库是通过将系统中常用数据库表中的数据全部映射到主机共享内存中,通过使用一个固定的数据结构数组将每个固定的数据库表保存在共享内存中,也就是将内存中的一个存储区作为一个数据库表的表空间,根据表记录的实际大小将该存储区划分为多个内存块来保存数据库表中的数据;在数据库表中的关键字段上建立内存索引,通过该内存索引对关键数据进行实时访问。 [0002] It is by the in-memory database systems commonly used are all mapped data to the host database table in shared memory, by using a fixed structure fixed array data each database table stored in shared memory, that is, a memory space of a memory area as a table in the database table, the actual size of the recording sheet storage area into a plurality of blocks of memory to store the data in a database table; creating a memory index table in the database key field , real-time access to critical data through the memory index. 内存系统提供用于对内存数据库表中的数据进行修改和检索的应用编程接口API (Application Programming Interface)接口,应用程序在访问这些数据库表时,通过调用内存数据库的API来访问共享内存中的数据,而不是直接访问物理数据库表中的数据,因此,能够提高系统对关键数据的实时访问性能。 Memory systems provide data memory for the data in the database table will be modified and retrieved application programming interface API (Application Programming Interface) interfaces, application program when accessing these tables, accessed by calling the API shared memory database in memory instead of direct access to physical data in a database table, therefore, can improve system performance real-time access to critical data.

[0003] 由于通过使用一个固定的数据结构数组将每个固定的数据库表保存在共享内存中,所述数据的存储和数据库表记录的结构之间耦合度较大,导致不能灵活创建和管理数据库表。 [0003] Because a fixed array by using a data structure of each table stored in a fixed database shared memory, and the degree of coupling between the storage structure of the database table record data is large, resulting in not flexibly create and manage databases table. 例如,在内存数据库中增加数据库表时,必须修改内存数据库的底层(即需要重新编写或修改代码);又如,在对数据库的表结构进行变更时,也需要修改内存数据库的底层。 For example, a database table is increased in the database memory, the memory must modify the underlying database (i.e., to rewrite or modify the code); another example, when the structure of the database table changes also need to modify the underlying database memory. 因此,现有内存数据库存储方式难以实现数据表空间的动态扩充;另外,由于采用固定的数据结构保存表记录,所以对于带有变长字段的数据库表的表空间浪费也比较严重。 Accordingly, the conventional storage memory database data difficult to achieve dynamic expansion of table space; Further, since the fixed structure maintains a data table records, so the wasted space table database table with variable length fields is relatively serious.

发明内容 SUMMARY

[0004] 本发明实施例提供一种内存数据库系统及实现内存数据库的方法和装置,以降低内存数据库中数据存储与内存数据库的表结构之间的耦合度提高创建、管理数据库的灵活性。 Embodiment [0004] The present invention provides a memory system and a database memory database implement the method and apparatus to reduce the degree of coupling between the data in the database table structure stored in memory and memory to create a database increases, the flexibility of the management database.

[0005] 一种内存数据库系统,包括: [0005] A database memory system, comprising:

[0006] 通信接口,用于接收请求操作数据库的各种消息和输出操作结果; [0006] a communication interface for receiving various messages and outputs an operation result of the requested database operation;

[0007] 创建装置,用于在共享内存中建立存储数据库的描述信息的第一存储区、存储用于定位表记录的索引信息的第二存储区和存储表记录的第三存储区,以及将数据库的描述信息保存到所述第一存储区,其中,所述第三存储区包括与表记录大小匹配的存储单元,每个存储单元存储一条数据库表记录,相同大小并且在物理空间上连续的存储单元构成一个物理块,一个物理块或多个相同的物理块关联成一个逻辑块; Third memory area and a second storage area storing table records [0007] creating means for establishing a first storage area description information in the database shared memory location table for storing index information recorded, and the description information database stored to the first storage area, wherein said storage area comprises a third storage unit match the size of the table records, each memory cell stores a database table record, continuous in the same size and physical space the storage unit constituting a physical block, a physical block associated with the physical block or more identical to a logical block;

[0008] 写操作装置,用于在所述操作需要向数据库表中添加表记录时,查询所述描述信息以选择包含的存储单元大小与所述表记录的大小匹配的一个逻辑块,以及将表记录写入选择的逻辑块中空闲的存储单元内,并将表记录的位置信息写入到所述索引信息中; [0008] The write operation means for operating when the table needs to be added to the records in the database table, query the description information to select the size of a logical block of the storage unit match the size of the recording sheet contained, and the table records written into the memory cell selected idle logical block, and writes information to the location table records the index information;

[0009] 查询操作装置,用于在所述操作需要从数据库表查询表记录时,查询第二存储区的索引信息和根据查询结果从第三存储区中相应的存储单元读取表记录,并选择满足查询条件的表记录; [0009] Query operation means, the operation required for the database table record from the table query, the query index information and the respective second storage area from the third storage area according to the recording table unit to read the results of the query, and select the table records meet the query conditions;

8[0010] 释放操作装置,用于在所述操作需要从数据库表删除指定的表记录时,从第三存储区释放存储所述指定的表记录的存储单元,并从第二存储区中删除所述与指定的表记录相关的索引信息。 8 [0010] releasing operation means for, when specified to be deleted from the database table records the operating table, releases the memory cell storing the specified table records from the third storage area, and removed from the second storage area the records associated with the specified table index information.

[0011] 一种创建内存数据库的方法,包括步骤: [0011] A method of creating a database memory, comprising the steps of:

[0012] 确定数据库表结构及各数据库表中表记录的大小; [0012] The size of the database table structure determination table and each database table record;

[0013] 在共享内存中建立存储数据库的描述信息的第一存储区、存储用于定位表记录的索引信息的第二存储区和存储表记录的第三存储区,其中,所述第二存储区包括与一条索引信息大小匹配的存储单元,所述第三存储区包括与表记录大小匹配的存储单元,所述第三存储区的每个存储单元存储一条数据库表记录,相同大小并且在物理空间上连续的存储单元构成一个物理块,一个物理块或多个相同的物理块关联成一个逻辑块; Third memory area [0013] description information to establish a database of shared memory in the first memory area, stores a location table records the index information stored in a second storage area and the table records, wherein said second storage and an area including the index information storage unit to match the size of the third storage area comprises a storage unit match the size of the table records, each memory cell stores a database table record said third storage area of ​​the same size and physical contiguous memory space on a physical block units, one associated physical block or physical blocks into a same logical block;

[0014] 将数据库的描述信息保存到所述第一存储区,所述数据库的描述信息包括各数据库表的描述信息。 [0014] database to save description information to the first storage area, said description information includes description information of each database table in the database.

[0015] 一种创建内存数据库的装置,包括: [0015] A memory database creating apparatus, comprising:

[0016] 确定单元,用于确定数据库表结构及各数据库表中表记录的大小; [0016] The determination unit, for determining the size of the database table structure of database tables and each table record;

[0017] 创建单元,用于在共享内存中建立存储数据库的描述信息的第一存储区、存储用于定位表记录的索引信息的第二存储区和存储表记录的第三存储区,其中,所述第二存储区包括与一条索引信息大小匹配的存储单元,所述第三存储区包括与表记录大小匹配的存储单元,所述第三存储区的每个存储单元存储一条数据库表记录,相同大小并且在物理空间上连续的存储单元构成一个物理块,一个物理块或多个相同的物理块关联成一个逻辑块; [0017] creating unit, for establishing a first storage area description information database stored in shared memory, a third memory area for storing the second memory area and storing the index information table records the location record table, wherein, the second storage area comprises a storage unit to match the size of the index information, the third storage area comprises a table records match the size of the memory cell, each memory cell stores a database table record said third storage area, the same size and the contiguous memory locations in the physical block constituting a physical space, a plurality of associated physical block or physical blocks into a same logical block;

[0018] 保存单元,用于将数据库的描述信息保存到所述第一存储区,所述数据库的描述信息包括各数据库表的描述信息,所述数据库表的描述信息包括各数据库表关联的所述逻辑块和各逻辑块中存储单元大小。 [0018] The storage unit, configured to save the database description information to the first storage area, said description information includes description information of each database database tables, the database tables includes the description information associated with each database table said logic blocks and a logical block size of each memory cell.

[0019] 一种访问内存数据库系统的方法,包括步骤: [0019] A database system accessing memory, comprising the steps of:

[0020] 接收操作内存数据库的请求消息; [0020] The request message receiving operation of the memory database;

[0021] 当所述操作需要向数据库表中添加表记录时,根据该数据库表查询第一存储区中的描述信息以选择一个逻辑块,该逻辑块包含的存储单元大小与所述表记录的大小相匹配,并且,将所述表记录写入选择的逻辑块中空闲的存储单元内,以及将存储表记录的位置信息记录到第二存储区的索引信息中; [0021] When the table needs to be added to the database table records the operation, based on the database query descriptor table information of the first storage area to select a logical block, the size of the memory cells included in the logical block table records sizes match, and the storage unit to write the table records the selected logic blocks are idle, and the recording position information stored in the index information table recorded in the second storage area;

[0022] 或者,当所述操作需要从数据库查询表记录时,根据该数据库表和查询条件中的字段查询第一存储区中的描述信息确定对应的索引信息,并且,从第二存储区查询确定的索引信息和根据查询结果从第三存储区中相应的存储单元读取表记录,选择满足所述查询条件的表记录; [0022] Alternatively, when the operation requires a look-up table record from the database, the index is determined according to the description information corresponding to the information field of the database tables and queries the query conditions in the first storage area, and the second storage area from a query and determining the index information corresponding to the third storage area from the cell table record to read the results of the query, the query table records satisfying a condition;

[0023] 或者,当所述操作需要从数据库表删除指定的表记录时,从第三存储区释放存储所述指定的表记录的存储单元,并从第二存储区中删除所述与指定的表记录相关的索引信肩、ο [0023] Alternatively, when it is necessary to delete the specified records from the database table of the operating table, releases the memory cell storing the specified table records from the third storage area, and removed from the second storage area specified in the table index records related letter shoulder, ο

[0024] 一种访问内存数据库系统的装置,所述装置包括: [0024] An apparatus for accessing memory database system, the apparatus comprising:

[0025] 接收单元,用于接收操作内存数据库的请求消息; [0025] The receiving means for receiving a message requesting the operation memory database;

[0026] 逻辑块选择单元,用于在所述操作需要向数据库表中添加表记录时,根据该数据 [0026] The logical block selection unit, when the need to add a record to a database table of the operating table, according to the data

9库表查询第一存储区中数据库的描述信息以选择一个逻辑块,该逻辑块包含的存储单元大小与所述表记录的大小相匹配; 9 query the database table description information in the first storage area of ​​the database to select a logical block, the size of the memory cells included in the logical block table records matched to the size;

[0027] 写操作单元,用于将表记录写入选择的逻辑块中空闲的存储单元内,以及将存储表记录的位置信息记录到第二存储区的索引信息中; [0027] The write unit for the storage unit to write the table records the logical block selection are idle, and the recording position information stored in the index information table recorded in the second storage area;

[0028] 索引信息查询单元,用于在所述操作需要从数据库查询表记录时,根据该数据库表和查询条件中的字段查询第一存储区中数据库的描述信息确定对应的索引信息; [0028] The index information query unit, when required for the recording operation from a database lookup table, the first storage area description information in the database is determined based on the index information corresponding to query the database tables and fields in the query;

[0029] 索引单元,用于从第二存储区查询所述索引信息查询单元确定的索引信息和根据查询结果从第三存储区中相应的存储单元读取表记录,并选择满足所述查询条件的表记录; [0029] The indexing unit, from a second storage area for querying the index information and corresponding index from the third storage area information query unit reads the recording table unit determined according to the results of the query, and that satisfies the query condition the table records;

[0030] 释放单元,用于在所述操作需要从数据库表删除指定的表记录时,从第三存储区释放存储所述指定的表记录的存储单元,并从第二存储区中删除所述与指定的表记录相关的索引信息。 [0030] The releasing unit, configured to, when need to delete the specified records from the database table of the operating table, releases the memory cell storing the specified table records from the third storage area, and removed from the second storage area associated with the specified table records the index information.

[0031] 本发明实施例中,在共享内存中建立存储数据库的描述信息的第一存储区、存储用于定位表记录的索引信息的第二存储区和存储表记录的第三存储区,通过描述信息确定索引信息,通过索引信息确定表记录,因而实现了内存数据库表结构与数据存储结构的松耦合,可以灵活创建和管理内存数据库。 [0031] The embodiments of the present invention, establishing a first storage area description information database stored in shared memory, a third memory area for storing the second memory area and storing the index information table records the recording location table by descriptive information to determine the index information, the index information is determined by the table records, and thus achieve a loosely coupled memory database table structure and data storage structure, you can create and manage flexible memory database. 在第三存储区分配与数据库表中表记录的大小相匹配的存储单元,因此,可以实现不同长度的表记录的灵活存储,从而降低共享内存的资源 The storage unit in the third storage area allocation table records database table that matches the size, and therefore, allows flexible record storage table of different lengths, thereby reducing the resources shared memory

占用。 Occupancy. [0032] 附图说明 [0033] 图 IA为本发明实施例中内存数据库的存储空间示意图;[0034] 图 IB为本发明实施例中内存数据库系统的结构示意图;[0035] 图 2为本发明实施例中存储单元与物理块的关系示意图;[0036] 图 3A为本发明实施例中存储单元的存储结格式意图;[0037] 图 3B为本发明实施例中空闲存储单元的链表结构示意图;[0038] 图 4A为本发明实施例中创建内存数据库的流程图;[0039] 图 4B为本发明实施例中创建内存数据库的装置结构示意图;[0040] 图 4C为本发明实施例中内存数据库访问共享内存空间的关系示意;[0041] 图 5A为本发明实施例中访问内存数据库的流程图;[0042] 图 5B为本发明实施例中动态扩充物理块的示意图;[0043] 图 6为本发明实施例中多索引结构的示意图;[0044] 图 7为本发明实施例中叶子节点树的结构示意图;[0045] 图 8A、图8B、图8C为本发明实施 [0032] BRIEF DESCRIPTION [0033] FIG IA is a schematic diagram of the memory storage space of the database embodiment embodiment the invention; [0034] FIG. IB is a schematic diagram of memory structure of the database system embodiment of the invention; [0035] 2 of the present invention, FIG. Examples showing the relationship between the physical blocks of the memory cell embodiment; [0036] FIG 3A of the present embodiment is intended to form the storage node of the memory cell embodiment of the invention; [0037] FIG. 3B is a schematic diagram structure of the linked list of free memory cell embodiment of the invention; [0038] FIG. 4A is a flowchart of a database to create a memory in the embodiment of the present invention; [0039] FIG. 4B is a schematic view of the device structure to create the database memory of the present embodiment of the invention; [0040] FIG 4C embodiment memory database embodiment of the present invention access to the shared memory space relationship schematically; [0041] FIG. 5A flowchart access memory database embodiment of the invention; [0042] FIG 5B is a schematic diagram of the dynamic expansion of the physical blocks in the present embodiment of the invention; [0043] FIG 6 is a multi-index structure diagram of embodiment of the present invention; [0044] FIG. 7 is a schematic structure of the leaf node tree embodiment of the present invention; [0045] FIGS. 8A, 8B, 8C embodiment of the present invention 例中访问内存数据库的装置的相关结构示意图;[0046] 图 9为本发明实施例中创建多索引的流程图;[0047] 图 10为本发明实施例中利用多索引查询表记录的流程图;[0048] 图 11为本发明实施例中创建多索引的装置的结构示意图;[0049] 图 12为本发明实施例中利用多索引查询表记录的装置的结构示意图。 Correlation means according to structural diagram of the memory access database; [0046] FIG. 9 is a flowchart of creating a multi-index invention embodiment; [0047] The flowchart of FIG. 10 embodiment using a multi-record index LUT embodiment of the present invention. ; [0048] FIG. 11 is a schematic diagram of the structure of the apparatus to create a multi-index invention embodiment; [0049] FIG 12 a schematic view of the structure utilized in the apparatus of recording a multi-index LUT embodiment of the invention. [0050] 具体实施方式 [0051] 在本发明实施例中,根据内存数据库在共享内存中的存储空间的功能,将所述存 储空间划分为第一存储区、第二存储区和第三存储区,如图IA所示。 [0050] DETAILED DESCRIPTION [0051] embodiment, the database function according to the memory stored in the shared memory space in the embodiment of the present invention, the storage space is divided into a first storage area, second storage area, and a third storage area , as shown in Figure IA. 其中,第一存储区存储数据库的描述信息(或称数据库系统定义信息),第二存储区存储用于定位表记录的索引信息,第三存储区用于存储数据库表的表记录。 Wherein the description information of the first storage area of ​​a database (or database system definition information), a second storage area for recording location table index information, a third memory area for storing a database table record table. 第一存储区、第二存储区和第三存储区在物理空间上可以连续分布,也可以是非连续分布;同样的,第一存储区、第二存储区和第三存储区中的每个存储区在物理空间上可以是连续分布的,也可以是非连续分布的。 A first storage area, second storage area and the third storing area may be continuously distributed in physical space, may be non-continuous distribution; same, the first memory area, the second memory area and third memory area each memory region on the physical space can be continuously distributed, it may be non-continuous distribution.

[0052] 本实施例中一种内存数据库系统的结构如图IB所示,包括:通信接口10、创建装置11、写操作装置12、查询操作装置13和释放操作装置14 ;为了能够动态的扩充存储空间,内存数据库系统还进一步包括一个扫描装置15。 [0052] The structure of one memory database system according to the present embodiment shown in FIG the IB, comprising: a communication interface 10, creating means 11, write means 12, means 13 and releasing query operation means 14; to be able to dynamically expand storage space, memory database system further comprises a scanning device 15 further.

[0053] 通信接口10作为数据库与外部应用进程之间的接口,用于接收访问数据库的各种消息和输出操作结果,通信接口可以包括操作界面和/或应用编程接口API ;所述的操作包括增加记录、删除记录、查询记录和编辑记录等;创建装置11在共享内存中建立存储数据库的描述信息的第一存储区、存储用于定位表记录的索引信息的第二存储区和存储表记录的第三存储区,以及将数据库的描述信息保存到所述第一存储区;写操作装置12在访问数据库的操作需要向数据库表中添加表记录时,查询第一存储区中的描述信息以选择包含的存储单元大小与所述表记录的大小匹配的一个逻辑块,然后将表记录写入选择的逻辑块中空闲的存储单元内,以及将表记录的位置信息写入到第二存储区的索引信息中;查询操作装置13在访问数据库的操作需要从数据库查询表记录时 [0053] The communication interface 10 as an interface between the database and the external application process, various messages and for outputting operation result received access to the database, the communication interface may include a user interface and / or application programming interface to the API; comprises the operation of increase records, delete records, recording and editing records query; creating a first storage area 11 to establish the description information stored in the database shared memory means for storing the index information recorded in the positioning table, and a second storage area storing table records third storage area, and holds the descriptor information database to said first memory area; write operation device 12 to add records to the database table in the operating table to access the database, query the description information to the first storage area select a logical block size storage unit match the size of the table records contained, and then written into the memory cell table record logical block selection are idle, and the location information table recorded in the second storage area is written the index information; operating apparatus 13 needs to query a database record from the look-up table operation to access the database 查询第二存储区的索引信息和根据查询结果从第三存储区中相应的存储单元读取表记录,并选择满足查询条件的表记录;释放操作装置14在访问数据库的操作需要删除表记录时,通过查询操作装置13定位到第三存储区中存储指定的表记录的存储单元,释放该存储单元并从第二存储区中删除该表记录的索引信息;扫描装置15扫描逻辑块中空闲的存储单元,如果发现逻辑块中空闲的存储单元小于阈值时,产生提示信息,由网管通过手动方式为逻辑块分配物理块,以保证内存数据库需要的存储空间;在保证扫描装置15能够获得共享内存空间的场景下,也可以由扫描装置15为该逻辑块分配一个物理块并将其关联到所述逻辑块。 When the release operation unit 14 needs to be removed to access the operation table is recorded in the database; query index information of the second storage area and the corresponding storage unit reads the recording sheet from the third storage area according to the query result, and query table records satisfying a condition , by querying the operating means 13 is positioned to the third storage unit table records specified storage area, releasing the storage unit and delete the record from the second table in the index information storage region; scanning means scan logic block 15 idle a storage unit, if discovery logic blocks are idle in the storage unit is less than the threshold value, an alarm message, the network logical blocks allocated physical block, to ensure that the storage memory required for the database manually to; ensuring the scanning device 15 can obtain the shared memory space scenario, a physical block may be assigned by the scanning device 15 for the logic block and associated to the logical block.

[0054] 参阅图2所示,第三存储区中包括与数据库表的表记录大小匹配的存储单元Slot,该存储单元是内存数据库的最小存储单元,每个存储单元存储一条数据库表记录。 [0054] Referring to FIG. 2, the third storage area comprises a table storage unit database table records matching Slot size, the memory cell is the smallest storage unit of the database memory, each memory cell stores a database table record. 大小(即存储容量)相同并且在物理空间上连续的存储单元构成一个物理块Extent,每个物理块包含的存储单元数量可以不同;一个物理块Extent或多个相同的物理块Extent关联(或称绑定)成一个逻辑块Chunk。 Size (i.e., storage capacity) and the same memory cell constituting a continuous Extent physical block in the physical space, number of memory cells included in each physical block may be different; a plurality of physical blocks associated with the same or Extent of Extent of physical blocks (or called binding) into a logical block Chunk. 在本实施例中,物理块是绑定到逻辑块的基本单元。 In the present embodiment, the physical block is a basic unit is bound to the logic block.

[0055] 在一个实例中,第二存储区中也可以采用类似于第三存储区的存储结构,大小(即存储容量)相同并且在物理空间上连续的存储单元构成一个物理块Extent,每个物理块包含的存储单元数量可以不同;一个物理块Extent或多个相同的物理块Extent关联(或称绑定)成一个逻辑块Chunk。 [0055] In one example, the second storage area may be used similar to the third storage structure of the storage area, the size (i.e., storage capacity) and the same memory cell constituting a continuous Extent physical block in the physical space, each physical block number of memory cells may comprise different; or a plurality of physical blocks associated with physical blocks of Extent Extent same (or bound) into a logical block Chunk. 这样,一个表记录的位置信息即可存储在一个存储单元Slot中。 Thus, a table can record location information is stored in a storage unit in Slot. 将第二存储区和第三存储区域的存储结构统一,可以简化管理和维护。 The second storage area and storage structures unified third storage area, can simplify administration and maintenance. 在另一实例中,第二存储区域采用普通的存储结构,即按现有存储方式存储信息,例如,分配在物理空间上连续并且大小统一的存储单元存储表记录的位置信息。 In another example, the second storage area of ​​the ordinary storage structure, i.e., according to conventional memory stores information, e.g., position information is allocated continuous and uniform size table storage unit storing recorded on a physical space.

[0056] 在本实施例中,根据实际需要可以限定组成一个逻辑块的最大物理块数量,例如, 一个逻辑块最多关联40个物理块。 [0056] The embodiment, according to actual needs can be a maximum number of physical blocks defined logical block, e.g., a logical block associated with up to 40 physical blocks in the present embodiment. 相应的,也可以设置物理块支持的寻址位数,以确定每个物理块包含存储单元的最大数量;例如,每个物理块支持24位寻址空间,则每个物理块最多包括16777216个(224)存储单元。 Accordingly, the address bits may be provided to support the physical block to determine a maximum quantity of each physical block including memory cells; for example, each 24-bit physical block address space, each physical block including a maximum of 16,777,216 (224) The storage unit. [0057] 第一存储区中的数据库的描述信息包含了实现数据库功能需要的信息,例如,系统锁、存储空间的描述信息、数据库表的描述信息等;其中,系统锁在使用数据库维护进程对数据库中的数据库表进行调整(如备份和恢复表记录过程或调整表记录间的关联关系) 时加载到相应的数据库表中,以防止其他应用进程访问该数据库表。 [0057] The description of the first storage area database contains information needed to implement a database function, e.g., a lock system, the description information storage space, the database table description information and the like; wherein the lock system is maintained in the process of using the database when loading a database table in the database is adjusted (e.g., backup and restore relationships between tables or adjustment table recording process records) into the corresponding database table, in order to prevent other application processes accessing the database table. 存储空间的描述信息包含逻辑块的数量、各逻辑块包含的物理块数量、物理块包含的存储单元数量和存储单元的大小(即存储容量);数据库表的描述信息包含表锁、表索引定义信息等,表索引定义信息包含构成索引的字段,各索引在第二存储区中对应的索引信息和索引锁等,其中的表锁用于防止两个进程同时对同一条记录进行修改,表索引锁可防止索引不被其他进程操作。 Description Quantity storage information comprises a logical block, the number, the size of the physical blocks physical block included in the storage unit number and the storage unit of each of logic blocks included in (i.e., storage capacity); database table description information includes a table lock table index is defined field information, configuration information includes the index table of the index, the index corresponding to each storage area in the second index information and index lock, wherein the lock table to prevent the two processes simultaneously make changes to the same record table index the index is not operated lock prevents other processes.

[0058] 第二存储区中的索引信息可以采用多种索引类型,例如,数组、索引树等。 [0058] The index information in the second storage area may take many index types, e.g., array, index trees. 索引树也可以采用多种树结构,例如,二叉树,平衡树,以及特征值表与叶子节点树。 Index tree may be employed a variety of tree structures, e.g., a binary tree, balanced tree, and a feature value table and the leaf node tree. 在特征值与叶子节点树结构中,索引字段对应的键值的特征值构成特征值表(特征值表中的特征值不同),每个特征值对应一个叶子节点树,叶子节点树由存储表记录位置信息的叶子节点构成,通过遍历树上的叶子节点定位到相应的存储单元。 Eigenvalues ​​and leaf nodes in a tree structure, the key index field corresponding to the feature value constituting the feature value table (eigenvalues ​​different values ​​in the table), each eigenvalue of a leaf node in the tree, the tree leaf node is stored by the table leaf nodes constituting the recording position information, to the node location corresponding memory cells by traversing the tree leaves. 所述特征值可以根据需要选择各种算法得到,典型的,采用哈希Hash运算。 The feature value may be selected according to various algorithms needed to give, typically using the Hash operation.

[0059] 通过数组类型组织索引信息时,可采用直线整数线性索引方式,该索引方式下索引字段采用4字节大小的整数(索引字段的键值连续并唯一),并提供两个整数型的参数, 第一个整数代表索引字段键值的最小值,第二个整数代表索引字段键值的最大值;内存数据库系统创建索引时直接把索引字段建成一个没有哈希冲突的整数数组,数据组中的每个元素指向一个存储表记录的存储单元。 [0059] The type of tissue through an array index information, the index can be linear integer linear manner, this index fields using integer mode index (key index field is continuously and the only) 4 byte size, type and provides two integers parameters, representative of the minimum value of the first integer keys index field, a second integer representing the maximum value of the index key field; memory database system to create an index built index field directly without a hash conflict integer array, the data set each element in the table points to the storage unit stores a record. 由于各键值是唯一的,所以可以通过直接访问函数进行快速存取。 Since each key is unique, it can be quickly accessed through direct access function. 通过哈希表与叶子节点树组织索引信息时,可采用二进制字节串索引方式, 该方式将被索引字段当成一个二进制字节串,并对该二进制字节串进行哈希Hash运算,该索引方式提供一个表示表大小的整数,该整数影响着哈希表中哈希值散列的效果。 Through hash table index with the leaf nodes of the tree organization information, a binary byte string can be indexed manner which is byte index field as a binary string, and the Hash operation on the binary string of bytes, the index embodiment provides a table showing the size of the integer, the integer hash table affects the results of the hash value of the hash. 在本实施例中以哈希表与叶子节点树记录表记录位置信息的结构为例进行说明。 Examples recording position information recording table to the hash table with the leaf nodes in the tree structure of the present embodiment will be described as an example.

[0060] 第三存储中的存储单元为内存数据库中的最小存储单位,为了方便维护和管理, 一个存储单元存储的信息可由多个字段构成。 [0060] The third storage unit is stored in the memory smallest unit of storage in the database, in order to facilitate maintenance and management, information stored in a storage unit constituted by a plurality of fields. 如图3A所示,一个存储单元包括头信息字段和数据字段。 Shown, one memory cell comprises a header field and a data field in FIG. 3A. 当存储单元存储表记录后,数据字段则存储表记录内容,头信息字段可以描述表记录的所属数据库表的信息和该表记录的实际长度等。 When the table storage unit stores recorded data field is recorded content storage table, header information field may describe the actual length of the table information and the record belongs table records database table or the like. 头信息字段占用的字节数根据需要存储的信息量预先确定,例如,头信息字段占用8个字节。 The number of bytes occupied by the header information field according to a predetermined amount of information need to be stored, for example, header information field occupies 8 bytes. 当存储单元为空闲时,头信息可以用于存放当前逻辑块中另一个空闲存储单元的位置信息,该位置信息可以包括逻辑块标识、物理块标识和存储单元标识;这样,一个逻辑块内所有空闲存储单元通过自身的头信息连接成一个空闲链表。 When the storage unit is idle, header information may be used to store the location information of the current free storage location to another logical block, the location information may comprise identifying a logical block, a physical block ID and the storage unit identification; Thus, a logical block all idle memory cells connected to a free list header information by itself. 当需要从逻辑块中申请存储单元时,则从该空闲链表中的表头位置取出一个存储单元;当释放一个表记录时,就将对应的存储单元添加到空闲链表的尾部。 When the need to apply logical memory cell block from the free list header position of a memory cell removed; when a table record is released, the corresponding memory cell will be added to the end of the free list. 在这种空闲链表结构中,指向空闲存储单元的指针始终指向链表的表头位置的空闲存储单元,由于访问和释放存储单元的时间和周期不同,所以该空闲链表在物理空间上可能不是连续的。 In this configuration the free list, the free point pointer always points to the memory cell free storage location of the header position list, since the access time and release the storage unit and different cycles, so that the free list in the physical space may not be continuous . 如图3B所示的一实例中,一个逻辑块Chunk中的物理块有η个物理块Extent 1至Extent n,物理块Extent 1和物理块Extent η中有空闲存储单元,这些空闲存储单元形成空闲链表。 An example shown in FIG. 3B, a physical block in the logical block has Chunk [eta] to physical blocks Extent 1 Extent n, the physical block and a physical block Extent 1 Extent η idle in the storage unit, the storage unit is formed Idle Idle list.

[0061] 在第三存储区采用逻辑块、物理块和存储单元存储结构后,内存数据库的数据库表存储区域的分配可以采用多种方式。 [0061] The logical block in the third storage area, and the storage unit stores the physical block structure, a database table storage area allocation memory database may be employed in various ways. 在一个实施例中,采用表绑定逻辑块方式分配数据 In one embodiment, the binding table using the mode logic block assignment data

12库表的存储区域,即,将一个数据库表映射到指定的一个或多个逻辑块中,当在数据库表中增加表记录时,每次在该数据库表绑定的逻辑块中寻找空闲并且大小与表记录匹配的存储单元以存放指定的表记录。 Database table storage area 12, i.e., a database mapping table to specify one or more logical blocks, when increasing the recording table in a database table, each logical block find free tables in the database and the bound size table storing unit to store records that match the specified table records. 在另一个实施例中,通过表动态分配逻辑块方式分配数据库表的存储区域,即,不固定数据库表绑定的逻辑块,当在数据库表中增加表记录时,根据待存储表记录的大小选择包含的存储单元大小与表记录大小匹配的逻辑块,然后在逻辑块中选择存储单元存储表记录;如果存在多个逻辑块可供选择时,则从这些逻辑块中选择空闲空间最大的一个逻辑块存储表记录,以平衡使这些逻辑块中被占用的存储单元的数量。 In another embodiment, the storage area allocated by the database tables Table dynamic allocation mode logic block, i.e., no fixed bindings database table logic block, when increasing the table record in a database table, the table records to be stored in accordance with the size the selected memory cell logical block size matching the size of the recording sheet contained, then the selected memory cell is stored in the table is recorded in a logical block; if the presence of a plurality of logical blocks to choose from, selecting from the logic blocks a maximum of free space logical block storage table records, to balance the number of memory cells in the logic blocks occupied.

[0062] 由于一个数据库表可以关联到多个逻辑块,而且不同的逻辑块包含的存储单元大小可以不相同,例如,绑定在同一数据库表上的逻辑块A、B;其中逻辑块A包含的存储单元的大小为20字节,而逻辑块B包含的存储单元大小为25字节,因此,对于带有变长字段的表记录可以根据实际大小选择匹配的逻辑块,从而能够实现按表记录大小分配表存储空间,节约共享内存中数据库表的存储资源。 [0062] Since a database table can be linked to a plurality of logical blocks, and the size of the memory cell blocks containing different logic may not be the same, e.g., binding in the same logical block A database table, B; where A comprises logic blocks the size of the memory cell is 20 bytes, the size of the memory cell is a logical block B comprises 25 bytes, and therefore, the recording sheet with respect to the variable-length fields may be the actual size of the selection logic in accordance with the block matching, thereby enabling table storage allocation table record size, saving storage resources shared memory database tables.

[0063] 参阅图4A所示,本实施例中创建内存数据库的处理流程如下: [0063] Referring to FIG. 4A, and the process flow to create a memory database in the embodiment are as follows:

[0064] 步骤400、确定数据库表结构(如,数据库表包括的字段)及各数据库表中表记录的大小。 [0064] Step 400, determining the size of the database table structure (e.g., database table including fields) and each database table record table.

[0065] 步骤401、在共享内存中申请存储区,并在申请到的存储区中建立存储数据库的描述信息的第一存储区、存储用于定位表记录的索引信息的第二存储区和存储表记录的第三存储区。 [0065] Step 401, the application is stored in the shared memory area, and to establish a first storage area description information stored in the application database to the storage area, the index information stored in the location table for recording a second memory area and memory third memory area table records.

[0066] 步骤402、将数据库的描述信息保存到所述第一存储区。 [0066] Step 402, holds the descriptor information database to the first storage area. 所述数据库的描述信息包括各数据库表的描述信息,所述数据库表的描述信息包括各数据库表关联的所述逻辑块和各逻辑块中存储单元大小。 The description information includes description information of each database table in the database, the database table comprises the description information of each logic block and the logical block table stored in the database associated with the respective unit size.

[0067] 相应的,一种创建内存数据库的装置如图4B所示,包括:确定单元40、创建单元41 和保存单元42 ;其中,确定单元40确定数据库表结构及各数据库表中表记录的大小;创建单元41根据所述确定单元40的得到的结果,在共享内存中建立所述第一存储区、第二存储区和第三存储区;保存单元42将数据库的描述信息保存到所述第一存储区。 [0067] Accordingly, an apparatus for creating memory database shown in Figure 4B, comprising: a determination unit 40, creation unit 41 and holding unit 42; wherein the determining unit 40 determines the structure of the database tables and each table in the database table records size; creating unit 41 according to the determined result obtained unit 40, establishing the first storage area, second storage area, and a third storage area in the shared memory; description information stored in a database holding unit 42 to the The first storage area.

[0068] 内存数据库创建后,内存数据库应用编程接口API实例化时会产生一个进程内的内存数据库地址映射数据结构ChimkMap,用于保存所有物理块映射到本进程后的虚拟内存地址BaseAddr,同时也记录下与逻辑块的对应关系。 After [0068] the memory to create a database, the database is generated when the memory of the application programming interface API instance mapping data structure memory address of the database in a process ChimkMap, for storing all of the physical block is mapped to the virtual memory address BaseAddr the present process, but also the correspondence between the logical block is recorded. 当内存数据库API需要定位指定的表记录或空闲的存储单元时,通过逻辑块标识ChunkId和物理块标识Extentld,查找到物理块映射到本进行的虚拟内存地址BaseAddr,然后根据存储单元的标识Slot Id结合存储单元大小SlotSize计算出相对于虚拟内存地址BaseAddr的偏移量Offset,然后得到存储单元真实的进程虚拟内存地址RecPtr,进行数据访问。 When the memory database API need to locate the specified table records or idle memory locations identified by the logical block ChunkId and physical block identification Extentld, find the physical block is mapped to the present for the virtual memory address BaseAddr, then according to the identifier storage unit Slot Id SlotSize binding storage unit size is calculated with respect to the offset BaseAddr the virtual memory address, then the memory cell resulting real process virtual memory address RecPtr, data access. 这样,实现了内存数据库程序对共享内存的访问,其关系如图4C所示。 Thus, to achieve a database program memory access to the shared memory, the relationship shown in Figure 4C.

[0069] 本实施例中,每个逻辑块具有一个时间戳,逻辑块中增加物理块时更新该时间戳。 [0069] In this embodiment, each logical block has a time stamp, the time stamp updating logical block increases physical block. 内存数据库的应用进程根据逻辑块的时间戳确定已映射到本应用进程的逻辑块与第三存储区中相应的逻辑块是否同步,如果不同步则重新进行映射,以保证每个应用进程都可以访问到最新的内存数据库的存储空间。 Memory database application process determines whether the process has been mapped to the logical block of the present application and the third storage area corresponding logical block synchronization logic block according to the time stamp, if the remapping is not synchronized to ensure that each application process can access to the latest storage memory database.

[0070] 访问内存数据库的操作类型包括对表记录的查询操作、修改(更新)操作、添加操作和删除操作,这些操作可归结为查询表记录、添加表记录和删除表记录三种操作中的一种操作或多种操作。 [0070] the type of operation, including access memory database query operations on the table record, modify (update) operation, add and delete operations, these operations can be attributed to the lookup table records, add and delete table records in three operating table records A method of operating or more operations. 例如,删除操作和修改操作均要先查询相应的表记录,然后再执行后续的操作。 For example, delete, and modify operations are respective first query table record, then perform the subsequent operations. 为了防止数据库的应用进程读到脏数据,对于修改表记录操作,可以在查询到相应的表记录后,先添加修改后的表记录,然后再删除原来的表记录。 To prevent the application process database read dirty data, to modify the operating table records, you can post a query to the appropriate table records, first add the modified table records, and then delete the original table record.

[0071] 参阅图5A所示,本实施例中,访问内存共享数据库的主要流程如下: [0071] Referring to FIG. FIG. 5A, in this embodiment, the main memory access shared database processes as follows:

[0072] 步骤500、内存数据库接收访问内存数据库的请求消息。 [0072] Step 500, receives a request message to access memory database memory database.

[0073] 步骤501、确定所述访问的操作类型,若该操作需要向数据库表中添加表记录,则进行步骤502、若该操作需要定位表记录,则进行步骤504,若该操作需要删除指定的表记录,则进行步骤506。 [0073] Step 501, determining the type of the access operation, if the operation needs to be added to the database table record table, step 502, if the operation requires the recording location table, step 504, if the need to remove the specified operation table record, step 506 is performed.

[0074] 步骤502、根据需要操作的数据库表查询所述第一存储区中的描述信息,选择包含的存储单元大小与所述表记录的大小匹配的一个逻辑块。 [0074] Step 502, the first query descriptor information storage area in accordance with the need to operate a database table, a logical block size of the selected memory cells included in the table matches the size of the record.

[0075] 步骤503、将所述表记录写入选择的逻辑块中空闲的存储单元内,以及将存储表记录的位置信息记录到所述第二存储区的索引信息中,并结构该写入处理。 [0075] Step 503, the storage unit to write the table records the selected logic blocks are idle, and the position information recorded in the recording table to store the index information in the second storage area, and the structure of the write deal with.

[0076] 步骤504、根据需要操作的数据库表和查询条件中的字段查询第一存储区中的描述信息确定对应的索引信息。 [0076] Step 504, and query the database tables to be operated in accordance with the description information query fields in the first storage area information corresponding to the determined index.

[0077] 步骤505、从第二存储区查询确定的索引信息和根据查询结果从第三存储区中相应的存储单元读取表记录,选择满足所述查询条件的表记录,并结束该次查询处理。 [0077] Step 505, determining a query from the second storage area and the corresponding index information from the third storage area according to the recording table unit to read the results of the query, the query table records satisfying a condition, and ends the queries deal with.

[0078] 步骤506、释第三存储区中存储表记录的单元和从第二存储区中删除该表记录的索引信息,并结束该删除处理。 [0078] Step 506, the third storage area release table recording unit which records and deleting from the second storage area of ​​the index information, and ends the deletion processing.

[0079] 在步骤502中,如果逻辑块中没有空闲的存储单元,则可以进行动态扩充,即申请分配一个物理块。 [0079] In step 502, if there is no empty logical blocks in the storage unit, it can be dynamically expanded, i.e. for allocation of a physical block. 一个动态扩充空间的处理流程如图5B所示: A dynamic expansion of a process flow of the space shown in Figure 5B:

[0080] 步骤550、根据物理块的大小从操作系统申请相应大小的共享内存空间。 [0080] Step 550, depending on the size of the physical block from the operating system to apply shared memory space corresponding size.

[0081] 步骤551、将申请到的物理块绑定到相应的逻辑块。 [0081] Step 551, the request to the physical block bound to the corresponding logical block.

[0082] 步骤552、更新第一存储区中存储空间的描述信息,如,该逻辑块的时间戳,物理块信息和存储单元信息等。 [0082] step 552, updating the first storage area space description information, e.g., the timestamp of the logical block, the physical block information storage means information and the like.

[0083] 步骤553、构建逻辑块中存储单元的空闲链表。 [0083] Step 553, the free list constructing logical block of memory cells.

[0084] 在本实施例中,内存数据库的数据库表采用多索引方式以提高查询速度和提高数据库的整体性能,每个索引采用哈希值表与叶子节点树方式(当然也可以采用其他运算得到的特征值表)。 [0084] In the present embodiment, a database table using multi-memory database indexing methods to speed up the search and improve the overall performance of the database, each index value of the hash table using the leaf nodes of the tree manner to give other operations (of course, may be employed feature value table). 每个数据库表具有多个索引,数据库表的一个索引可以包含该数据库表中的一个索引字段,也可以包含多个索引字段。 Each database table having a plurality of indexes, an index database table may contain an index field in the database table may include a plurality of index fields. 例如,对于一个具有A(如“姓名”字段)、B、C、 D、E、F 6个字段的数据库表可以有3个索引,第一个索引包含A字段,第二个索引包含B、C、 D字段,第三个索引包含E、F字段。 For example, with a A (such as "name" field), database tables B, C, D, E, F 6 field can have three indexes, the first index fields A, B comprises a second index, C, D field, comprising a third index E, F fields. 当然,根据需要可以建立4个索引或更多索引;而根据需要,其中某些字段也可以不用于建立索引。 Of course, if necessary, can be established more or four indices index; and if necessary, some of the fields may not be used for indexing. 在每个索引下,表记录对应于索引字段的键值Key (—个索引由多个索引字段组成时,键值是指各索引字段的键值按预定的顺序组合成的键值。)通过哈希运算后得到的哈希值构成一个哈希表,其中的每个哈希值关联到一个由存储表记录位置信息的叶子节点构成的叶子节点树,同一叶子节点树上各叶子节点对应的表记录在对应的索引字段下,其键值产生哈希碰撞,也就是说虽然其键值不同但其经哈希运算后得到相同的哈希值,参阅图6所示。 In each index, the table record corresponding to the index key field Key (- when a plurality of indexed by index fields, each index key refers to a key combination of fields in a predetermined order into which key value) by a hash value obtained after calculating the hash constitutes a hash table associated with a tree leaf node corresponding to each hash value which is recorded by the position information to a storage table composed of leaf nodes, the leaf nodes of the same tree leaf node of each in the recording table corresponding to the index field, which is generated key hash collision, that is to say, although its value different but the same hash value obtained by the hash operation, refer to FIG. 6.

[0085] 采用多索引方式后,第一存储区中表索引定义信息具体包括:使用一个名称描述一个字段或几个字段的索引名、索引标识(如一个表中所有索引的编号)、索引属性(如键值是否唯一、索引方法和重键排序方法等)、索引表大小、索引字段(包括字段在记录中的偏移量和长度的数组)、索引参数(如哈希Hash表长、最大值、该索引所在的位置信息)、重键排序字段和索引数据叶子节点所在逻辑块标识等。 [0085] With multiple indexes, the first index table definition information storage region comprises: using a name or a field name description index several fields, index label (e.g., a list of all index numbers), the attribute index (e.g., if a unique key, heavy key indexing method and sorting method, etc.), the size of the index table, the index field (including an array of offset and length fields in the record), index parameter (e.g., the hash table length, the maximum values, the position where the index information), and re-sort field key index data identifying the leaf node as the logical blocks and the like.

[0086] 在第二存储区中,一个哈希表可以保存在一个存储单元中,由于在同一个存储单元查询哈希值,能够进一步提高索引速度和数据库的整体性能。 [0086] In the second storage area, a hash table may be stored in one memory cell, since in the same storage unit queries the hash value, it is possible to further improve the overall performance and speed of the database index. 叶子节点树上的叶子节点可以采用相同大小的存储单元存储,一个索引树上的叶子节点可以存储于同一个逻辑块包含的存储单元中,也可以分别存储在多个逻辑块包含的存储单元中。 Leaf nodes on the tree leaf node may employ a storage unit to store the same size, an index tree leaf node may be stored in the same storage unit included in a logical block may be stored in a storage unit included in a plurality of logical blocks, respectively .

[0087] 参阅图7所示,在一个哈希值关联到的一个叶子节点树上具有第一关联关系(图7中的横向叶子节点)和第二关联关系(图7中的纵向叶子节点)。 [0087] Referring to Figure 7, in a tree leaf node associated with a first hash value having a relationship to the (transverse leaf nodes of FIG. 7) and a second relationship (longitudinal leaf node in FIG. 7) . 在同一索引下,第一关联关系中的叶子节点所对应的表记录的键值不同,第二关联关系中的叶子节点所对应的表记录的键值相同,而哈希表中每个非零的哈希值指向叶子节点树上第一关联关系中的头叶子节点。 In the same index, different from the first leaf node in the association table corresponding record key, the same key value in the leaf node in the second association table corresponding to the record, the hash table for each nonzero the hash value of the leaf node points to the first leaf node of the tree in the first relationship. 在叶子节点树上,每个叶子节点可以有三个指针,其中,第一个指针用于指向第一关联关系中的后继叶子节点,以形成一个链表,第二个指针用地指向第二关联关系中的后继叶子节点,以形成另一个链表,第三个指针则用于指向第三存储区中存储表记录的存储单元(图7中仅示出了哈希值1和哈希值m关联的叶子节点树,其他哈希值关系的叶子节点树未示出)。 Leaf nodes in the tree, each leaf node may have three pointers, wherein a first pointer for pointing to the subsequent leaf nodes in a first relationship, to form a linked list, the second pointer points to the second relationship in the land subsequent leaf node, the other to form a linked list, a third pointer is used to point to the storage unit stores the leaf table records the third storage area (FIG. 7 shows only the hash value of m and the hash value associated with a node tree, the relationship between the hash value of the other leaf nodes of the tree are not shown).

[0088] 相应的,一种访问内存数据库的装置如图8A所示,包括:逻辑块选择单元81、写操作单元82、索引信息查询单元83、索引单元84和释放单元85。 [0088] Accordingly, an apparatus for accessing memory database 8A, comprising: a logic block selection unit 81, write unit 82, the index information query unit 83, the index unit 84 and discharge unit 85. 其中,逻辑块选择单元81在访问内存数据库系统的操作需要向数据库表中添加表记录时,根据数据库表查询第一存储区中的描述信息来选择一个逻辑块,该逻辑块包含的存储单元大小与待在座的表记录的大小相匹配;如,对于前述包括头信息字段和数据字段的存储单元,相匹配是指数据字段大小与表记录大小一致;写操作单元82将表记录写入逻辑块选择单元81选择的逻辑块中空闲的存储单元内,并将存储表记录的位置信息(即存储单元的地址)写入到所述第二存储区的索引信息中。 Wherein the logic block selection unit 81 to access the memory during operation of the database system need to be added to the database table record table, a logical block is selected based on the database query descriptor table information in the first storage area, the memory cell size of the logical block contains match the size of the table to be recorded here; e.g., for the memory cell comprises a header field and a data field, means to match the size of the data field is consistent with the size of the recording sheet; write unit 82 records written to the logical block table logical block storage unit selection unit 81 selects an idle position information table records and stores (i.e., address storage unit) is written to the index information in the second storage area. 索引信息查询单元83在访问内存数据库系统的操作需要从数据库查询表记录时,根据该数据库表和查询条件中的字段查询第一存储区中的描述信息来确定对应的索引信息;索引单元84从第二存储区查询所述索引信息查询单元83确定的索引信息和根据查询结果从第三存储区中相应的存储单元读取表记录,并选择满足所述查询条件的表记录;释放单元85在所述操作需要从数据库表删除指定的表记录时,从第三存储区释放存储所述指定的表记录的存储单元,并从第二存储区中删除所述与指定的表记录相关的索引信息;所述指定的表记录可以是访问操作请求消息中指定的记录,如果访问操作请求消息中是删除记录的条件,则先由索引信息查询单元83和索引单元84定位到满足条件的表记录, 然后再删除。 Index information query unit 83 during operation of the database system need to access memory from the database record lookup table, according to the description of the information field of the database tables and queries in the query first memory area is determined corresponding to the index information; index unit 84 from querying the second storage area corresponding to the index and index information from the third storage area information query unit reads the recording table unit 83 is determined according to the query result, and the recording sheet that satisfies the query condition; release unit 85 in when the operation requires to delete the specified table records from a database table, releases the memory cell storing the specified table records from the third storage area, and deletes the record associated with the specified table index information from the second storage area ; record the specified table access operation may be specified in the request message records, if the access operation request message to delete the recording condition is, first by the index information query unit 83 and the indexing unit 84 is positioned to satisfy the condition of the recording sheet, then remove.

[0089] 写操作单元82可包括:第一存储操作模块820和第二存储操作模块821 ;第一存储操作模块820从选择的一个逻辑块中获取一个空闲的存储单元,并将待存储的表记录存储到该空闲的存储单元内;第二存储操作模块821将存储表记录的位置信息记录到第二存储区的索引信息中。 [0089] The write unit 82 may include: a first storage and a second storage module 820 operating operation module 821; a first storage unit storing operation module 820 acquires a free block from a logical choice, and the tables to be stored the record stored in the idle memory means; second storage module 821 operating the recording position information stored in the index information table recorded in the second storage area.

[0090] 在采用多索引方式的实施例中,写操作单元82中第二存储操作模块821如图8B 所示,包括:第一模块8210、第二模块8211和第三模块8212 ;其中,第一模块8210根据表记录所在数据库表查询第一存储区中相应的描述信息,获得该数据库表预先定义的多个索引 [0090] In an embodiment of the multi-indexing methods, the write operation in the second storage unit 82 operation module 821 shown in Figure 8B, comprising: a first module 8210, second module 8211, and a third module 8212; wherein the first a query module 8210 corresponding to a first storage area description information recorded based on the table where the database table, the indexes to obtain a plurality of pre-defined database table

15字段;第二模块8211从所述表记录中提取各索引字段对应的键值,并获得各键值对应的特征值;第三模块8212根据各哈希值分别查询第二存储区中相应的哈希值表,若特征值表中存在该哈希值,则在该哈希值关联的索引树上增加包含表记录位置信息的节点,否则,将哈希值加入哈希值表和创建与该哈希值关联的包含表记录位置信息的节点。 Field 15; a second module 8211 extracts a key value corresponding to each index field records from the table, and the key value is obtained for each characteristic value; third module 8212 queries each second storage area corresponding to the hash value in accordance with various hash value table, if there is the hash value of the feature value in the table, the table containing the node to increase recording position information in the index tree associated with the hash value, otherwise, the value of a hash of the hash table and create recording position information table contains a node associated with the hash value. 其中,在包含第一关联关系和第二关联关系的叶子节点树上,所述第三模块8212在索引树上增加包含表记录位置信息的节点时,先在第一关联关系中搜索键值相同的表记录关联的节点,若未搜索到,则在第一关联关系上增加包含表记录位置信息的节点,若搜索到,则在该节点所在的第二关联关系上增加包含表记录位置信息的节点。 Wherein, in a tree leaf node comprising a first and a second relationship of association, the third module 8212 increases the node table comprising recording position information in the index tree, the search key value to the first association relationship in the same table record associated with the node, if no search is increased node table containing position information recorded on the first association relationship, if the search, comprises increasing the recording position information table on the second node where the relationship node.

[0091] 在第二关联关系上增加包含表记录位置信息的节点,可以按一定顺序进行排序插入节点,该一定顺序可以有多种,例如:按表记录插入的先后正序、按表记录插入的先后倒序、按当前索引的排序字段的大小正序或者按当前索引的排序字段的大小倒序。 [0091] increases in the second association table node contains storage location information, the insertion node can be sorted according to a certain order, the certain order may have multiple, for example: Table record insertion has positive sequence, according to Table record insert the reverse has, according to the size of the current index or sort fields of positive sequence current sort column in the index of the size of the reverse.

[0092] 在采用多索引方式时,图8A所示索引信息查询单元83和索引单元84的一种结构如图8C所示,索引信息查询单元83包括特征值表确定模块830,用于根据需要操作的数据库表和字段查询第一存储区确定需要在第二存储区中查询的哈希值表;索引单元84包括: 特征值表查询模块840和索引模块841 ;其中,特征值表查询模块840根据所述查询条件中的键值获得对应的哈希值,并查询特征值表确定模块830确定的哈希值表,得到该哈希值关联的叶子节点树;索引模块841搜索所述索引树中的节点和从第三存储区读取节点关联的表记录,将表记录中对应于索引字段的键值与所述查询条件比较,得到满足查询条件的表记录。 [0092] When using multiple indexing methods, a configuration as shown in FIG. 8A index information query unit 83 and the indexing unit 84 is shown in Figure 8C, the index information query unit 83 includes a feature value table module 830, as required for a first database tables and fields store the query operation determines that the hash value table lookup in the second storage area; indexing unit 84 comprises: a characteristic value module 840 and the index table query module 841; wherein the characteristic value table query module 840 obtained according to the query conditions key corresponding to the hash value, the query feature value table and the hash value determination module 830 determines the table to obtain the hash value associated with the leaf node of the tree; indexing module 841 searches the index tree and reading the nodes associated with the node from the third block table records the table record corresponding to the index key field is compared with the query conditions, to give table records that satisfy the query. 由于在表索引定义信息中包括索引字段在表记录中的偏移量,因此,索引模块841 在选择满足查询条件的表记录时,根据所述偏移量从读取的记录中选择相应的键值与查询条件进行比较,其中的查询条件一般是该索引字段中健值需要满足的条件,如,对于一个数据库表,对于其中的索引字段“性别”而言,查询条件是:性别=“男”,即键值为“男”;而对于其中的索引字段“员工号”而言,查询条件可以是:员工号> 123450。 Since the offset field comprises an index table recorded in the index definition information table, therefore, when the indexing module 841 records that satisfies the query criteria table, based on the offset select the key from the read record and to compare the value of the query, the query in which the condition is generally healthy index field values ​​need to be met, such as for a database table, index fields for which "sex", the query is: gender = "male "that is the key for the" male "; and for which the index fields" employee number ", the query can be: No. of employees> 123 450. 索引模块841在包含第一关联关系和第二关联关系的叶子节点树上搜索节点时,先在第一关联关系中搜索键值相同的表记录关联的节点,若未搜索到,则停止搜索,若搜索到,则在搜索到的节点所在的第二关联关系上依次遍历各节点。 When indexing module 841 comprises a leaf node in the search tree and the second node of the first association relationship, the first search for the same key value in the first association table record associated with the node, if not the search, the search is stopped, If the search is, traversing each node in the second association found node is located.

[0093] 在一个具体实例中,在第二存储区中创建多索引的主要处理流程如图9所示,包括步骤: [0093] In one particular example, multiple index created in the second storage area in the main process flow shown in Figure 9, comprising the steps of:

[0094] 步骤900、在数据库表中定义多个索引字段,并在第二存储区中建立各索引字段对应的哈希值表。 [0094] Step 900, defining a plurality of index fields in the database table, each index field and establish the corresponding hash value table in the second storage area. 在初始创建时,哈希值表为空。 When initially created, the hash value table is empty.

[0095] 步骤901、将数据库表的表记录存储到存储单元后,在该数据库表的各索引字段下获取所述表记录中对应的键值。 [0095] Step 901, the table records database table to the storage unit after obtaining the key value recorded in the corresponding table index field in each table of the database.

[0096] 步骤902、对各键值进行哈希运算,得到相应的哈希值。 [0096] Step 902, for each hashing the key value, the corresponding hash value.

[0097] 步骤903、利用各特征值分别查询相应的索引字段所关联的哈希值表,若特征值表中存在相应的哈希值,则进行步骤904,否则,进行步骤905。 [0097] Step 903, by each query feature values ​​associated with the hash value table corresponding to the index field, if there is a corresponding hash value of the feature values ​​in the table, step 904, otherwise, proceeds to step 905.

[0098] 步骤904、在哈希值关联的索引树上增加包含表记录位置信息的节点,并结束该次操作。 [0098] Step 904, the index tree nodes associated table containing the hash value to increase the recording position information, and ends the operations.

[0099] 步骤905、将哈希值加入哈希值表,创建与该哈希值关联的并包含表记录位置信息的节点。 [0099] Step 905, the hash value of a hash of the table, to create an association with the hash value and the node table comprising storage location information. [0100] 步骤904中,在包含第一关联关系和第二关联关系的叶子节点树上搜索节点上增加包含表记录位置信息的节点时,先在第一关联关系中查询键值相同的表记录关联的节点,若未查询到,则在第一关联关系上增加包含表记录位置信息的节点,若查询到,则在该节点所在的第二关联关系上增加包含表记录位置信息的节点。 When the [0100] step 904, the node comprising increasing the recording position information table on the leaf nodes of the search tree nodes comprises a first and a second association relationship, the first query same key recorded in the first table in association associated node, if no inquiries to increase the node table comprising recording position information on the first relationship, when queried, the node is increased comprising recording position information table on the relationship of the second node is located.

[0101] 当索引字段对应的键值与叶子节点树中某节点关联的索引字段对应的键值相同时,可以按顺序在第二关联关系中进行排序插入节点,该顺序可以有多种,例如:按表记录插入的先后正序、按表记录插入的先后倒序、按当前索引的排序字段的大小正序或者按当前索引的排序字段的大小倒序。 [0101] When the same key index field associated with a leaf node the key corresponding to a node in the tree corresponding to the index field may be sequentially inserted into the second sort association node, the sequence can have multiple, e.g. : table record insertion has positive sequence, according to table record has reverse insertion, ordered by the index field of the current or the magnitude of the positive sequence current sort field is reverse indexed size.

[0102] 根据第二存储区中建立的多索引查询表记录的处理流程如图10所示,包括步骤: [0102] The process flow of FIG index LUT plurality of records created in the second storage area 10, comprising the steps of:

[0103] 步骤1000、根据需要操作的数据库表和索引字段查询数据库表的描述信息确定需要查询的哈希值表。 [0103] Step 1000, the hash value table database tables and queries database table index fields required for describing the operation according to the information determined to be queried.

[0104] 步骤1001、对查询条件中的键值进行哈希运算获得对应的哈希值。 [0104] Step 1001, the query conditions hashing key corresponding to the hash value obtained.

[0105] 步骤1002、查询确定的哈希值表得到对应的索引树。 [0105] Step 1002, the determined hash value table query to obtain a corresponding index tree.

[0106] 步骤1003、搜索所述索引树中的节点和从节点关联的存储单元读取表记录,并将表记录中对应于索引字段的键值与所述查询条件比较,得到满足所述查询条件的表记录。 [0106] Step 1003, the search index node in the tree and the storage unit is read from the record table associated with the node, and the comparison table record corresponding to the index key field of the query, the query is satisfied table recording conditions.

[0107] 在一个具体实例中创建多索引的装置如图11所示,包括:定义模块1100、第一模块1101、第二模块1102和第三模块1103,其中,定义模块1100在数据库表中定义多个索引字段,并在第二存储区中建立各索引字段对应的特征值表;第一模块1101根据表记录所在数据库表查询第一存储区中相应的描述信息,获得该数据库表预先定义的多个索引字段; 第二模块1102从所述表记录中提取各索引字段对应的键值,并对各键值进行哈希运算获得各键值对应的哈希值;第三模块1103根据各哈希值分别查询第二存储区中相应的哈希值表,如果该哈希值表中存在相应的哈希值,则在该哈希值关联的索引树上增加包含表记录位置信息的节点,否则,将哈希值加入哈希值表和创建与该哈希值关联的包含表记录位置信息的节点。 [0107] means to create multiple indexes in a specific example shown in Figure 11, comprising: defining module 1100, a first module 1101, second module 1102, and third module 1103, wherein module 1100 is defined in a database table defined a plurality of index fields, each index field and establish the corresponding feature value table in the second storage area; module 1101 according to a first table record query a database table where the corresponding description information in the first storage area, to obtain the pre-defined database table index column; and a second module 1102 extracts a key value corresponding to each index field from the table of records, and each key is hashed to obtain a hash value corresponding to each key; Ha according to a third module 1103 Xi values ​​query second storage area corresponding to the hash value table, if there is a corresponding hash value to the hash value in the table, the table containing the node to increase recording position information in the index tree associated with the hash value, otherwise, record the location information table containing the hash value of the node to join the hash table, and create value associated with the hash value.

[0108] 相应的,利用多索引查询表记录的装置如图12所示,包括:特征值表确定模块1200、特征值表查询模块1201和索引模块1202,其中,特征值表确定模块1200根据需要操作的数据库表和字段查询第一存储区确定需要在第二存储区中查询的哈希值表;特征值表查询模块1201根据查询条件中的键值获得对应的特征值并查询确定的特征值表,得到该特征值关联的索引树;索引模块1202搜索所述索引树中的节点和从第三存储区读取节点关联的表记录,将表记录中对应于索引字段的键值与所述查询条件比较,得到满足所述查询条件的表记录。 [0108] Accordingly, the use of multiple lookup tables recorded indexing means 12, comprising: a characteristic value table determination module 1200, a feature value table 1201, and query module indexing module 1202, wherein the characteristic value table module 1200 as needed a first database tables and fields store the query operation determines that the hash value table lookup in the second storage area; feature value table query module 1201 to obtain a feature value corresponding to the key according to the query conditions and query the determined characteristic value table, index tree to obtain a value associated with the feature; indexing module 1202 searches the index tree node and the read node from the third association table record storage area, the table record corresponding to the key field in the index Comparative query give table records that satisfy the query criteria.

[0109] 本实施例中,表记录的查询功能借助于表的多索引结构实现,在通过多索引进行查询时可以保存一个游标结构到进程空间,该游标结构用于保存当前叶子节点的位置和当前叶子节点所在第二索引关系中第一个叶子节点的位置,采用游标方式实际上并没有取出全部数据,而是指向分支节点的标识指针,这样能够大幅度提高查询的速度。 [0109] embodiment, the multi-table queries index structure record table implemented by means of, when queried by a multi-index structure can save a cursor into the process space, the structure for retaining the current cursor position and the leaf nodes of the present embodiment the current position of the second leaf node index relationship where the first leaf node using the cursor mode does not actually remove all the data, but the marker pointer pointing to a branch node, this can greatly improve the speed of the query.

[0110] 在使用内存数据库应用编程接口API提供的查询函数查询表记录时,可以预先设置一个内部过滤条件对表记录进行过滤查询,该过滤条件可以采用一个三层数据结构,其中,最底层定义一个原子过滤条件,每个原子过滤条件通过记录中的偏移量和长度指定一个要判断的字段,然后指定一个运算符,再指定运算的参数,即指定一个Operator (field, [0110] When using the memory database query application programming interface API functions provided by the lookup table records, may be preset inside a filter condition table records query filtered, the filter conditions can be employed a three-layer data structure in which the bottom is defined a filter condition atom, each atom of the filter condition specifies a field to be determined by recording the offset and length, and then specify an operator, then the specified operation parameters, i.e., specifies a operator (field,

17para, [,para2])这样的判断条件;多个原子过滤条件进行“与”运算后组成一个第二层过滤条件;多个第二层过滤条件进行“或”运算后组成了第三层过滤条件。 17para, [, para2]) Such a determination condition; a plurality of filter criteria atoms "and" after calculation filter layer composed of a second condition; "or" condition after a plurality of the second layer was filtered computes a third layer composed of a filter condition. 原子过滤条件和第二层过滤条件的最大数量可以进行限制,例如,原子过滤条件最多为8个,第二层过滤条件最多为8个。 The maximum number of atoms in the second layer filters and filter conditions may be limited, for example, the filter condition atoms up to 8, the second layer up to eight filter conditions. 一个过滤条件的数据结构定义的实例如下: Examples of a data structure definition of the filter conditions is as follows:

[0111] typedef struct [0111] typedef struct

[0112] { [0112] {

[0113] int or_item_num;//表示一个结构中有多少个“或”关系 [0113] int or_item_num; // represents a structure in how many "or" relationship

[0114] struct [0114] struct

[0115] { [0115] {

[0116] int ancLitenuium;//表示一个结构中有多少个“与”关系 [0116] int ancLitenuium; // represents a structure in how many "and" relationship

[0117] struct [0117] struct

[0118] { [0118] {

[0119] int field_offset ;//定义字段偏移量 [0119] int field_offset; // field offset defined

[0120] int field_length ;// 定义字段长度 [0120] int field_length; // definition field length

[0121] int operator ;//定义操作 [0121] int operator; // define operations

[0122] struct [0122] struct

[0123] { [0123] {

[0124] int para_length ;//参数长度 [0124] int para_length; // Parameter Length

[0125] void ^paraptr ;//定义用于指向条件中的值的指针 [0125] void ^ paraptr; // definition of a value of a pointer pointing to the condition

[0126] }op_para[2] ;//定义保存运算参数值的数组 Operation parameter value array holds // defined; [0126]} op_para [2]

[0127] }and_itemS[8] ;//定义8个比较单元,比较单元之间的关系为“与” 关系 [0127]} and_itemS [8]; // define the comparing unit 8, the relationship between the comparison unit relationship "and"

[0128] }or_items[8] -JI定义8个比较单元,比较单元之间的关系为“与”关系 [0128]} or_items [8] -JI 8 define the relationship between the comparison unit, the comparison unit relationship "and"

[0129] }t_Filter ; [0129]} t_Filter;

[0130] 在本实施例中,可进一步对运算符和相应的参数进行定义,以使在进行条件判断时能够得到参数返回的值。 [0130] In the present embodiment, the operator may be further defined and the corresponding parameters, so that the condition can be obtained during the return value of the parameter is determined. 例如: E.g:

[0131] 大于运算:如果过滤条件的字段与参数进行二进制比较后,字段大于参数时返回真; [0131] greater than operator: if the filter condition parameter fields binary comparison, when the field is greater than the parameter returns true;

[0132] 大于等于运算:如果过滤条件的字段与参数进行二进制比较后,字段大于等于参数时返回真; [0132] greater than or equal to operator: if the filter criteria field binary comparison parameters, returns true if the field is greater than equal to the parameter;

[0133] 等于运算:如果过滤条件的字段与参数进行二进制比较后,字段等于参数时返回真; [0133] The operation is equal to: If the filter criteria field binary comparison parameter, the parameter field is equal Returns true;

[0134] 不等于运算:如果过滤条件的字段与参数进行二进制比较后,字段不等于参数时返回真; [0134] does not equal operator: if the binary comparator filter condition with a field parameter field not equal Returns true parameters;

[0135] 小于等于运算:如果过滤条件的字段与参数进行二进制比较后,字段小于等于参数时返回真: [0135] less than or equal to operator: if the filter criteria field is compared with the binary parameter field is less than equal to the parameter returned true:

[0136] 小于运算:如果过滤条件的字段与参数进行二进制比较后,字段小于参数时返回真: [0136] less than operator: if the filter criteria field binary comparison parameters, returns true if the parameter field is less than:

[0137] between运算:如果过滤条件的字段与参数进行二进制比较后,字段大于等于参 [0137] between operation: If the filter condition parameter fields binary comparison, the reference field is greater than equal to

18数1小于等于参数2时返回真。 Number 1 18 2:00 parameter less than or equal Returns true.

[0138] 本领域普通技术人员可以理解,实现上述实施例方法中的全部或部分步骤是可以通过程序指令相关的硬件来完成,所述的程序可以存储于一计算机可读取存储介质中,该程序在执行时,可执行图4A、图5A、图5B、图9和图10所示流程中包含的处理步骤。 [0138] Those of ordinary skill in the art can be appreciated, the foregoing embodiments of the method steps may be all or part by a program instructing relevant hardware to finish, the program may be stored in a computer readable storage medium, the the program, when executed, perform FIGS. 4A, figures 5A, 5B, the flow of the processing steps shown in FIGS. 9 and 10 included.

[0139] 本实施例中提供的内存数据库实现了内存数据库表结构与数据存储结构的松耦合,在存储表记录时,通过选取与表记录大小相匹配的逻辑块可以实现同一个表的变长记录的存储模式,降低了共享内存中表空间资源的占用;本实施例中动态扩充表空间的方式保证了内存数据库表结构与数据存储结构之间不存在耦合关系,并且,在系统通过一个内存数据库进程动态扩充表空间时,其他内存数据库应用进程更新本进程内逻辑块的时间戳与系统定义区中该逻辑志的时间戳一致,保证了内存空间映射的同步。 [0139] Examples memory database provided in this embodiment to achieve a loose coupling memory database structure and data structure is stored, when the record storage table, the variable length may be achieved by selecting the same logical block table and the size of the recording sheet matches storage pattern records, reducing the resources shared memory space occupied table; in the present embodiment dynamically expanding manner as in Example tablespace guarantees coupling relationship exists between the memory and the data storage structure of the database table structure, and, by a system memory when the time stamps match the dynamic expansion process database table space, database applications other memory update process in this process timestamp logical blocks of the logical system definition area Chi ensure the synchronization of the memory space mapping.

[0140] 本实施例提供的内存数据库能够满足对数据进行大量访问的实时性要求,可应用在实时要求较高的系统中,例如,在一个实时计费系统中采用本实施例提供的内存数据库来提高系统的实时响应性能,数据库存储用户的相关信息及使用业务的计费信息。 [0140] Memory database provided in the present embodiment can meet real-time requirements of a large number of data access, it can be applied in real-time demanding, for example, using the memory database provided in the present embodiment is a real-time charging system to improve the response performance information in real time billing system, database stores information about users and use of services.

[0141] 显然,本领域的技术人员可以对本发明进行各种改动和变型而不脱离本发明的精神和范围。 [0141] Obviously, those skilled in the art can make various modifications and variations to the invention without departing from the spirit and scope of the invention. 这样,倘若对本发明的这些修改和变型属于本发明权利要求及其等同技术的范围之内,则本发明也意图包含这些改动和变型在内。 Thus, if part of the claimed invention for such modifications and variations within the scope of the present invention and equivalents thereof, the present invention intends to include these modifications and variations.

19 19

Claims (39)

  1. 一种内存数据库系统,其特征在于,包括:通信接口,用于接收请求操作数据库的各种消息和输出操作结果;创建装置,用于在共享内存中建立存储数据库的描述信息的第一存储区、存储用于定位表记录的索引信息的第二存储区和存储表记录的第三存储区,以及将数据库的描述信息保存到所述第一存储区,其中,所述第三存储区包括与表记录大小匹配的存储单元,每个存储单元存储一条数据库表记录,相同大小并且在物理空间上连续的存储单元构成一个物理块,一个物理块或多个相同的物理块关联成一个逻辑块;写操作装置,用于在所述操作需要向数据库表中添加表记录时,查询所述描述信息以选择包含的存储单元大小与所述表记录的大小匹配的一个逻辑块,以及将表记录写入选择的逻辑块中空闲的存储单元内和将表记录的位置信息记录到第二存 A memory-database system, characterized by comprising: a communication interface for various messages and outputs an operation result of the operation of the database receiving a request; creating means for establishing a first storage area description information in the database shared memory third storage area for storing index information recording location table of the second memory area and memory table records and holds the descriptor information database to said first storage region, wherein said third storage region comprises table records match the size of the memory cell, each memory cell stores a database record table, the same size and the contiguous memory locations in the physical block constituting a physical space, a plurality of associated physical block or physical blocks into a same logical block; write operation means for operating when the table needs to be added to the records in the database table, query the description information to select the size of a logical block of the storage unit match the size of the recording sheet contained, and the table records written the storage unit into the selected logic blocks and the spare recording position information is recorded into the second memory table 区中;查询操作装置,用于在所述操作需要从数据库表查询表记录时,查询第二存储区的索引信息和根据查询结果从第三存储区中相应的存储单元读取表记录,并选择满足查询条件的表记录;释放操作装置,用于在所述操作需要从数据库表删除指定的表记录时,从第三存储区释放存储所述指定的表记录的存储单元,并从第二存储区中删除所述与指定的表记录相关的索引信息。 Region; query operation means, the operation required for the database table record from the table query, the query index information and the second storage area corresponding storage unit reads the recording sheet from the third storage area according to the query result, and table records that satisfies the query condition; release operation means for, when specified to be deleted from the database table records the operating table, the table records the release of the memory cell storing the designated storage area from the third, and the second deletes the storage area associated with the specified table records the index information.
  2. 2.如权利要求1所述的内存数据库系统,其特征在于,还包括:扫描装置,用于扫描逻辑块中空闲的存储单元,并且在发现逻辑块中空闲的存储单元小于阈值时,产生提示信息或直接为该逻辑块分配一个物理块并将其关联到所述逻辑块。 2. The memory database system according to claim 1, characterized in that, further comprising: scanning means for scanning logical block storage unit is idle, and when the free logical block of the storage unit is smaller than the threshold value is found, generating a prompt or assign a physical block information that is directly associated to the logical block and the logical block.
  3. 3.如权利要求1所述的内存数据库系统,其特征在于,所述第二存储区包括与一条索引信息大小匹配的存储单元,相同大小并且在物理空间上连续的存储单元构成一个物理块,一个物理块或多个相同的物理块关联成一个逻辑块。 3. The memory database system according to claim 1, wherein said second storage area comprises a storage unit and a size matching the index information, and the same size of memory cells constituting a continuous physical blocks on the physical space, a plurality of associated physical block or physical block into a same logical block.
  4. 4.如权利要求1所述的内存数据库系统,其特征在于,所述创建装置包括: 确定单元,用于确定数据库表结构及各数据库表中表记录的大小;创建单元,用于在共享内存中建立所述第一存储区、第二存储区和第三存储区; 保存单元,用于将数据库的描述信息保存到所述第一存储区,所述数据库的描述信息包括各数据库表的描述信息。 4. The memory database system according to claim 1, characterized in that said creating means comprises: determining means for determining the size of the database table structure of database tables and each table records; creating unit for shared memory establishing in the first storage area, second storage area, and a third storage area; saving unit configured to save the database description information to the first storage area, said description information comprises a description of a database of database tables information.
  5. 5.如权利要求1所述的内存数据库系统,其特征在于,所述查询操作装置包括:索引信息查询单元,用于在所述操作需要从数据库表查询表记录时查询第一存储区中的描述信息确定索引信息;索引单元,用于从第二存储区查询确定的索引信息和根据查询结果从第三存储区中相应的存储单元读取表记录,并选择满足所述查询条件的表记录。 5. The memory database system according to claim 1, wherein said query means comprises: an index information query unit configured to query a database table needs to be recorded from the operation of the first look-up table storage area determining index information descriptive information; indexing unit configured to query the index information determined from the respective second storage area and from the third storage area according to the recording table unit to read the results of the query, and select the table record meets the query conditions .
  6. 6.如权利要求5所述的内存数据库系统,其特征在于,所述写操作装置包括: 逻辑块选择单元,用于在所述操作需要向数据库表中添加表记录时,根据该数据库表查询所述第一存储区中的描述信息以选择一个逻辑块,该逻辑块包含的存储单元大小与所述表记录的大小相匹配;写操作单元,用于将需要添加的表记录写入选择的逻辑块中空闲的存储单元内,以及在第二存储区中保存表记录的位置信息。 When the operation record table needs to be added to the database table, based on the database query logic block table selecting unit, configured to: memory database system as claimed in claim 5, wherein said write means comprises description information of the first storage area to select a logical block, the size of the memory cells included in the logical block table records matches the size; write unit for writing records to add the selected table logical block storage unit is idle, and the storage location information table recorded in the second storage area.
  7. 7.如权利要求6所述的内存数据库系统,其特征在于,所述写操作单元包括:第一存储操作模块,用于从所述一个逻辑块中获取一个空闲的存储单元,并将待存储的表记录存储到该空闲的存储单元内;第二存储操作模块,用于在第二存储区的索引信息中记录所述表记录的位置信息。 7. The memory database system according to claim 6, wherein said write means comprises: a first storage operation module, configured to obtain a storage unit from the idle in a logical block, to be stored and table records stored in the memory of the idle cell; and a second module storing operation, position information of the recording table for recording the index information in the second storage area.
  8. 8.如权利要求7所述的内存数据库系统,其特征在于,所述第二存储操作模块包括: 第一模块,用于根据表记录所在数据库表查询第一存储区中相应的描述信息,获得该数据库表的多个索引;其中,每个索引包含一个或多个索引字段,在每个索引下根据各表记录的键值所得到的特征值在第二存储区中分别形成与索引关联的一个特征值表,在同一索引下具有相同特征值的表记录的位置信息分别存储在与该特征值关联的一个叶子节点树的叶子节点上;第二模块,用于从所述表记录中提取在各索引下对应的键值,并获得各键值对应的特征值;第三模块,用于根据各特征值分别查询第二存储区中相应的特征值表,若特征值表中存在该特征值,则在该特征值关联的叶子节点树上增加包含表记录位置信息的叶子节点, 否则,将特征值加入特征值表和创建与该特 8. The memory database system according to claim 7, wherein said second storing operation module comprising: a first module, configured to query the description information corresponding to the first storage area based on the table where the database table records, to obtain a plurality of index tables in the database; wherein each index comprising one or more index fields, according to the characteristic values ​​of key value of each record in the table are formed of the obtained index associated with the second storage area in each index location information of a feature value table, having a table of records with the same value in the feature index are stored in the same leaf node on a tree leaf node associated with the feature value; a second module, configured to extract records from the table in each corresponding index key, and obtains feature values ​​corresponding to the respective key; a third module, configured to query a second storage area respectively corresponding characteristic value table according to the respective characteristic value, the characteristic feature if the present value in the table then increasing leaf node comprising recording position information table in the tree leaf node associated with the feature value, otherwise the feature value added feature value table and creating the Laid 值关联的包含表记录位置信息的叶子节点。 Leaf node table records comprising values ​​associated with the position information.
  9. 9.如权利要求8所述的内存数据库系统,其特征在于,所述索引信息查询单元包括: 特征值表确定模块,用于根据需要操作的数据库表和字段查询第一存储区确定需要在第二存储区中查询的特征值表; 所述索引单元包括:特征值表查询模块,用于根据所述查询条件中的键值获得对应的特征值并查询确定的特征值表,得到该特征值关联的叶子节点树;索引模块,用于搜索所述叶子节点树中的叶子节点和从第三存储区读取节点关联的表记录,将表记录中对应于索引的键值与所述查询条件比较,得到满足该查询条件的表记录。 9. The memory database system according to claim 8, wherein said index information query unit comprises: a feature value table determination module, according to the database tables and queries a first field memory area in need of operations required to determine table II characteristic value store query; the index unit comprises: a feature value table query module, configured to obtain a feature value according to the query condition corresponding to the key value in the query and the determined characteristic value table, the feature value obtained tree leaf node associated; indexing means for searching the leaf nodes of the leaf node in the tree and the node table records read from the third memory area associated with the table record corresponding to the index key values ​​of the query condition comparison table records that met the query criteria.
  10. 10.如权利要求9所述的内存数据库系统,其特征在于,所述数据库的描述信息中包括索引字段在表记录中的偏移量;所述索引模块在选择满足查询条件的表记录时,根据所述偏移量从读取的表记录中选择相应的键值与查询条件进行比较。 10. The memory database system according to claim 9, wherein the description information comprises an index of the database in the field offset table record; the index table module records that satisfies the query criteria, the select the appropriate key is compared with the query based on the offset read from the table of records.
  11. 11.如权利要求9所述的内存数据库系统,其特征在于,在一个叶子节点树中,在索引下具有不同键值的表记录对应的叶子节点形成第一关联关系,具有相同键值的记录对应的叶子节点形成第二关联关系。 Recording database 11. The memory system according to claim 9, wherein, in a leaf node in the tree, table records with different keys in the leaf node corresponding to the index to form a first relationship, with the same key forming a second leaf node corresponding relationship.
  12. 12.如权利要求11所述的内存数据库系统,其特征在于,所述第三模块在叶子节点树上增加包含表记录位置信息的叶子节点时,先在第一关联关系中搜索键值相同的表记录关联的叶子节点,若未搜索到,则在第一关联关系上增加包含表记录位置信息的叶子节点,若搜索到,则在该叶子节点所在的第二关联关系上增加包含表记录位置信息的叶子节点。 12. The database memory system of claim 11, wherein the third module comprises increasing leaf node table records location information in a tree leaf node, searching for the same first key in the first association relationship table records associated leaf node, if no search is increased leaf nodes contain location information table recorded on the first association relationship, if the search is to increase the recording position on the table comprising a second relationship where the leaf node leaf node information.
  13. 13.如权利要求11所述的内存数据库系统,其特征在于,所述索引模块在搜索叶子节点树中的叶子节点时,先在第一关联关系中搜索键值相同的表记录关联的叶子节点,若未搜索到,则停止搜索,若搜索到,则在搜索到的叶子节点所在的第二关联关系上依次遍历各叶子节点。 13. The leaf node of the memory database system as claimed in claim 11, wherein said indexing module leaf node in the search tree leaf node, the first key value associated with the same search recorded in the first table in association , if not searched, the search is stopped, if the search is on to search for the second association leaf node is located, traversing each leaf node.
  14. 14.如权利要求8-13任一项所述的内存数据库系统,其特征在于,所述特征值为哈希值,相应的,所述特征值表为哈希表。 14. The memory database system of any one of claims 8-13, wherein said characteristic value is a hash value, accordingly, the characteristic value table as a hash table.
  15. 15. 一种创建内存数据库的方法,其特征在于,包括步骤:确定数据库表结构及各数据库表中表记录的大小;在共享内存中建立存储数据库的描述信息的第一存储区、存储用于定位表记录的索引信息的第二存储区和存储表记录的第三存储区,其中,所述第二存储区包括与一条索引信息大小匹配的存储单元,所述第三存储区包括与表记录大小匹配的存储单元,所述第三存储区的每个存储单元存储一条数据库表记录,相同大小并且在物理空间上连续的存储单元构成一个物理块,一个物理块或多个相同的物理块关联成一个逻辑块;将数据库的描述信息保存到所述第一存储区,所述数据库的描述信息包括各数据库表的描述信息。 15. A method for creating a database memory, characterized by comprising the steps of: determining the size of the database table structure and each database table record table; establishing a first storage area description information database stored in shared memory, for storing third memory area and a second storage area storing the index information table records the record location table, wherein the second storage area comprises a storage unit to match the size of the index information, the third storage area comprises a table record a storage unit to match the sizes, each memory cell stores a database table record said third storage area of ​​the same size and the contiguous memory locations to form a physical block, a physical block or physical blocks which are associated in a plurality of the same physical space into a logical block; save description information database to the first storage area, said description information includes description information of each database table in the database.
  16. 16.如权利要求15所述的方法,其特征在于,所述第三存储区的存储单元包括头信息字段和数据信息字段;当该存储单元被表记录占用时,该存储单元的头信息字段保存该表记录所属表的信息和该表记录的实际长度;当存储单元空闲时,该存储单元的头信息字段保存同一逻辑块中的另一个空闲存储单元的位置信息,使该逻辑块中的空闲存储单元形成链表。 16. The method according to claim 15, wherein the storage unit includes a third storage area header field and data field; when the memory cell is occupied table records, field of the header information storage unit save the table information and the actual length of the record table records department table; when the memory unit is idle field of the header information storage unit to another storage location information of the idle storage units in the same logical block, so that the logic blocks the free list memory cells are formed.
  17. 17.如权利要求16所述的方法,其特征在于,每个所述的逻辑块具有一个时间戳,所述逻辑块中增加物理块时更新所述时间戳;所述数据库的应用进程根据所述时间戳确定已映射到本应用进程的逻辑块与第三存储区中相应的逻辑块是否同步。 17. The method according to claim 16, wherein each logic block has a time stamp, the time stamp updating of the logical blocks increases physical block; the application process in accordance with the database determining said time stamp is mapped to the corresponding logic block application process according to the third storage area are synchronized.
  18. 18. —种创建内存数据库的装置,其特征在于,包括:确定单元,用于确定数据库表结构及各数据库表中表记录的大小;创建单元,用于在共享内存中建立存储数据库的描述信息的第一存储区、存储用于定位表记录的索引信息的第二存储区和存储表记录的第三存储区,其中,所述第二存储区包括与一条索引信息大小匹配的存储单元,所述第三存储区包括与表记录大小匹配的存储单元,所述第三存储区的每个存储单元存储一条数据库表记录,相同大小并且在物理空间上连续的存储单元构成一个物理块,一个物理块或多个相同的物理块关联成一个逻辑块;保存单元,用于将数据库的描述信息保存到所述第一存储区,所述数据库的描述信息包括各数据库表的描述信息,所述数据库表的描述信息包括各数据库表关联的所述逻辑块和各逻辑块中存储单元大小。 18. - Species memory database creating apparatus, characterized by comprising: determining means for determining the size of the database table structure of database tables and each table records; creating unit, information describing the establishment of a database stored in shared memory third memory area and a second storage area storing the index information table records a first storage area for storing recording location table, wherein the second storage area includes an index information storage unit to match the size of the said third storage area comprises a storage unit match the size of the table records, each memory cell stores a database table record said third storage area of ​​the same size and constituting a memory cell contiguous physical blocks on the physical space, a physical a plurality of identical blocks or into a physical block associated with logical block; saving unit configured to save the database description information to the first storage area, said description information includes description information of each database table of a database, the database table description information includes the logical block table database associated with each memory cell and the size of each logical block.
  19. 19. 一种访问内存数据库系统的方法,其特征在于,所述方法应用于权利要求1〜14任一所述的系统中,所述方法包括步骤:接收操作内存数据库的请求消息;当所述操作需要向数据库表中添加表记录时,根据该数据库表查询第一存储区中的描述信息以选择一个逻辑块,该逻辑块包含的存储单元大小与所述表记录的大小相匹配;并且,将所述表记录写入选择的逻辑块中空闲的存储单元内,以及将存储表记录的位置信息记录到第二存储区的索引信息中;或者,当所述操作需要从数据库查询表记录时,根据该数据库表和查询条件中的字段查询第一存储区中的描述信息确定对应的索引信息;并且,从第二存储区查询确定的索引信息和根据查询结果从第三存储区中相应的存储单元读取表记录,选择满足所述查询条件的表记录;或者,当所述操作需要从数据库表 19. A method of accessing memory database system, wherein a system according to any one of the method applied 1~14 claim, said method comprising the steps of: receiving a request message database memory operation; when the when the operation record table needs to be added to the database table, based on the database query descriptor table information of the first storage area to select a logical block, the size of the memory cells included in the logical block table records matches the size; and, or, when the operation requires a look-up table record from the database; the storage unit to write the table records the selected logic blocks are idle, and stores the location information table to record the index information recorded in the second storage area description information of the first storage area is determined based on the index information corresponding to query the database tables and fields in the query; and, determining a query from the second storage area and the corresponding index information from the third storage area according to the query result the storage unit reads the recording sheet, the recording sheet that satisfies the query condition; alternatively, when the operation requires a table from the database 删除指定的表记录时,从第三存储区释放存储所述指定的表记录的存储单元,并从第二存储区中删除所述与指定的表记录相关的索引信息。 Delete the specified table records, release the storage unit stores the specified table records from the third storage area, and deletes the index information associated with the specified table records from said second storage area.
  20. 20.如权利要求19所述的方法,其特征在于,选择的一个逻辑块是指包含的存储单元大小与所述表记录的大小相匹配的所有逻辑块中空闲的存储单元最多的逻辑块。 20. The method according to claim 19, characterized in that a logical block selection means all logic blocks included in the memory cell size of the table records matches the size of the free memory cell in the most logical block.
  21. 21.如权利要求19所述的方法,其特征在于,所述操作为添加表记录操作时,若查询所述第一存储区确定需要操作的数据库表绑定了存储该数据库表的表记录的逻辑块,则从绑定的逻辑块中选择一个逻辑块。 21. The method according to claim 19, wherein said operation is a recording operation to add the table, querying the database table when the first memory area is determined to be operated to bind the database table stored in the table records logical block, the logical block from binding a selected logic block.
  22. 22.如权利要求19所述的方法,其特征在于,所述操作为修改表记录操作时,在第三存储区中先添加修改后的表记录,然后再删除被修改的表记录。 22. The method according to claim 19, characterized in that the operating table when modifying the recording operation, in the third storage area to add the modified record table, and then delete the record table to be modified.
  23. 23.如权利要求19-22任一项所述的方法,其特征在于,所述存储单元包括头信息字段和数据信息字段;当该存储单元被表记录占用时,该存储单元的头信息字段保存该表记录所属表的信息和该表记录的实际长度;当存储单元空闲时,该存储单元的头信息字段保存同一逻辑块中的另一个空闲存储单元的位置信息,使同一个逻辑块中的空闲存储单元形成链表。 23. The method of any one of claims 19-22, wherein the storage unit comprises a header field and data field; when the memory cell is occupied table records, field of the header information storage unit save the table information and the record of the table the actual length of the recording sheet; a storing unit when the idle field of the header information storage unit to another storage location information of the idle storage units in the same logical block, so that the same logical block the free list of memory cells are formed.
  24. 24.如权利要求23所述的方法,其特征在于,当需要占用逻辑块中的存储单元时,从所述链表的表头获取一个存储单元;或者,当释放所述逻辑块中的存储单元时,将释放的存储单元加入到所述链表的尾部。 24. The method according to claim 23, wherein, when the logic blocks need to occupy the storage unit, acquires a list of the storage unit from the header; alternatively, when releasing the logical block storage unit when the release of the memory cells is added to the tail of the linked list.
  25. 25.如权利要求19所述的方法,其特征在于,在第二存储区中采用数据库表的多索引方式存储表记录的位置信息,该多索引方式将数据库表的多个字段作为索引字段,在每个索引字段下根据各表记录的键值所得到的特征值分别形成一个特征值表,在同一索引字段下具有相同特征值的表记录的位置信息分别存储在与特征值表中所述相同的特征值关联的一个叶子节点树的叶子节点上,并且在第一存储区的数据库的描述信息中将相应的索引字段关联到对应的特征值表。 25. The method according to claim 19, wherein using a database table in the second storage area stores position information of the multi indexing table records, the plurality of multi-mode index field in the database as table index field, a feature value table formed according to the characteristic values ​​of key value of each record in the table obtained at each index field having the same characteristic value table records at the same index field position information are stored in the feature value in the table the leaf nodes of the tree a leaf node values ​​associated with the same characteristics, and associated with the corresponding description information in the index field in a database of the first storage area corresponding to the characteristic value table.
  26. 26.如权利要求25所述的方法,其特征在于,将存储表记录的位置信息记录到所述第二存储区的索引信息中包括步骤:根据表记录所在数据库查询第一存储区确定该数据库表的各索引字段;从所述表记录中提取各索引字段对应的键值,并获得各键值对应的特征值;利用各特征值分别查询第二存储区中相应的特征值表,若特征值表中存在该特征值, 则在该特征值关联的叶子节点树上增加包含表记录位置信息的叶子节点,否则,将特征值加入特征值表和创建与该特征值关联的包含表记录位置信息的叶子节点。 26. The method according to claim 25, wherein the recording position information stored in the index table to record the information in the second storage area comprises the step of: determining the location record database tables according to a database query of the first storage area each table index field; extracting from the table index field of each record corresponding to the key value, and obtains feature values ​​corresponding to the respective key; by each query feature values ​​in the second storage area corresponding characteristic value table, if the feature the characteristic values ​​in the table value exists, the value of the leaf node associated with the feature tree leaf nodes contain increased recording position information table, otherwise, the value added feature and feature value table to create an association with the feature value comprises location table records leaf node information.
  27. 27.如权利要求25所述的方法,其特征在于,所述查询第一存储区中的描述信息确定对应的索引信息是指,根据需要操作的数据库表和字段查询第一存储区确定需要在第二存储区中查询的特征值表;所述从第二存储区查询确定的索引信息并从第三存储区中相应的存储单元读取表记录得到满足所述查询条件的表记录是指,根据所述条件中的键值获得对应的特征值并查询确定的特征值表,得到该特征值关联的叶子节点树,以及搜索所述叶子节点树中的叶子节点和从第三存储区读取叶子节点关联的表记录,将表记录中对应于索引字段的键值与所述条件比较,得到满足所述查询条件的表记录。 27. The method according to claim 25, wherein said query descriptor information of the first storage area corresponding to the index information determining means, a first memory area based on the database query tables and fields need to be operated is determined wherein the second storage area value table query; determining the query from a second storage area storing the index information and the corresponding table recording unit reads satisfied from the third storage area in the recording condition lookup table means, obtaining feature values ​​corresponding to the conditions according to the query keys and the determined characteristic value table, to obtain the value associated with the feature tree leaf nodes, the leaf node and the search tree and the leaf nodes are read from the third storage area table record associated leaf node, the index table record corresponding to the key field in comparison with the condition, the lookup table is satisfied recording conditions.
  28. 28.如权利要求27所述的方法,其特征在于,数据库的描述信息中包括索引字段在表记录中的偏移量,在选择满足查询条件的表记录时,根据所述偏移量从读取的表记录中选择相应的键值与查询条件进行比较。 28. The method according to claim 27, wherein the description information comprises an index database field offset table in the record, when the selected table records satisfy the query criteria, based on the offset read from taken table record corresponding to the selected key value is compared with the query.
  29. 29.如权利要求25-28任一项所述的方法,其特征在于,所述叶子节点树中,在索引下具有不同键值的表记录对应的叶子节点形成第一关联关系,具有相同键值的记录对应的叶子节点形成第二关联关系。 29. The method according to any one of claims 25-28, characterized in that the leaf node in the tree, table records with different keys corresponding to index the leaf node at a first association is formed, with the same key recording the corresponding leaf node to form a second association value.
  30. 30.如权利要求29所述的方法,其特征在于,在叶子节点树上增加包含表记录位置信息的叶子节点时,先在第一关联关系中查询键值相同的表记录关联的叶子节点,若未查询到,则在第一关联关系上增加包含表记录位置信息的叶子节点,若查询到,则在该叶子节点所在的第二关联关系上增加包含表记录位置信息的叶子节点。 30. The method according to claim 29, characterized in that the leaf nodes contain increased recording position information table in the tree leaf node, recording the first key value query associated with the same leaf node in the first table the association relationship, If not the query is increased leaf nodes contain location information table recorded on the first relationship, if the query is increased leaf nodes contain the location information table recorded in the second association located leaf node.
  31. 31.如权利要求29所述的方法,其特征在于,在搜索叶子节点树中的叶子节点时,先在第一关联关系中搜索键值相同的表记录关联的叶子节点,若未搜索到,则停止搜索,若搜索到,则在搜索到的叶子节点所在的第二关联关系上依次遍历各叶子节点。 31. The method according to claim 29, characterized in that the leaf node when the leaf node in the search tree, the leaf nodes to search for the same key value associated with the record in the first table the association relationship, if no search, then stop the search, if the search is on to search for the second association leaf node is located, traversing each leaf node.
  32. 32. —种访问内存数据库系统的装置,其特征在于,所述装置包括:接收单元,用于接收操作内存数据库的请求消息;逻辑块选择单元,用于在所述操作需要向数据库表中添加表记录时,根据该数据库表查询第一存储区中数据库的描述信息以选择一个逻辑块,该逻辑块包含的存储单元大小与所述表记录的大小相匹配;写操作单元,用于将表记录写入选择的逻辑块中空闲的存储单元内,以及将存储表记录的位置信息记录到所述第二存储区的索引信息中;索引信息查询单元,用于在所述操作需要从数据库查询表记录时,根据该数据库表和查询条件中的字段查询第一存储区中数据库的描述信息确定对应的索引信息;索引单元,用于从第二存储区查询所述索引信息查询单元确定的索引信息和根据查询结果从第三存储区中相应的存储单元读取表记录,并选择满 32. - means a kind of database system to access the memory, characterized in that said apparatus comprises: receiving means for receiving a request message database memory operation; logical block selecting means configured to add to the database table in the operation table records, based on the database query descriptor table information of the first storage area of ​​the database to select a logical block, the size of the memory cells included in the logical block table records matches the size; write unit for the table the memory cell selected by the write logic block records are idle, and the position information recorded in the recording table to store the index information in the second storage area; index information query unit, required for the operation from a database query table records, based on the database tables and queries in the query condition field described in the first storage area information database corresponding to the index information is determined; indexing means for indexing the query index information inquiry unit determines from the second storage area from the third information and corresponding storage area according to the recording table unit to read the results of the query, and select full 足所述查询条件的表记录;释放单元,用于在所述操作需要从数据库表删除指定的表记录时,从第三存储区释放存储所述指定的表记录的存储单元,并从第二存储区中删除所述与指定的表记录相关的索弓I fe息O The foot table records query condition; release unit configured to, when specified to be deleted from the database table records the operating table, the table records the release of the memory cell storing the designated storage area from the third, and the second deletes the storage area associated with the specified table records index information bow I fe O
  33. 33.如权利要求32所述的装置,其特征在于,当所述操作为添加表记录操作时,所述逻辑块选择单元若查询所述第一存储区确定需要操作的数据库表绑定了存储该数据库表的表记录的逻辑块,则从绑定的逻辑块中选择一个逻辑块。 33. The apparatus according to claim 32, wherein, when the operation is add a table recording operation, the logic of the block selection unit if a query operation determines that the first storage area of ​​the database table stored bound logical block table records the database table, from the logical block binding of a selected logic block.
  34. 34.如权利要求32所述的装置,其特征在于,当所述操作为修改表记录操作时,释放单元在第三存储区中先添加修改后的表记录,然后再删除被修改的表记录。 34. The apparatus according to claim 32, wherein, when the recording operation is to modify the operating table, in the third storage area release unit in the table is added to the modified recording, and then delete the record table to be modified .
  35. 35.如权利要求32〜34任一项所述的装置,其特征在于,所述存储单元包括头信息字段和数据信息字段;当该存储单元被表记录占用时,该存储单元的头信息字段保存该表记录所属表的信息和该表记录的实际长度;当存储单元空闲时,该存储单元的头信息字段保存同一逻辑块中的另一个空闲存储单元的位置信息,使同一个逻辑块中的空闲存储单元形成链表。 35. The apparatus according to any one of claims 32~34, wherein the storage unit comprises a header field and data field; when the memory cell is occupied table records, field of the header information storage unit save the table information and the record of the table the actual length of the recording sheet; a storing unit when the idle field of the header information storage unit to another storage location information of the idle storage units in the same logical block, so that the same logical block the free list of memory cells are formed.
  36. 36.如权利要求32所述的装置,其特征在于,所述写操作单元在第二存储区中采用数据库表的多索引方式存储表记录的位置信息,该多索引方式将数据库表的多个字段作为索引字段,在每个索引字段下根据各表记录的键值所得到的特征值分别形成一个特征值表, 在同一索引字段下具有相同特征值的表记录的位置信息分别存储在与特征值表中所述相同的特征值关联的一个叶子节点树的叶子节点上,并且在第一存储区的数据库的描述信息中将相应的索引字段关联到对应的特征值表。 36. The apparatus according to claim 32, wherein said write means using position information of multiple database table index table records stored in the second storage area, the multi-indexing multiple database tables field as the index field, a feature value table formed according to the characteristic values ​​of key value of each record in the table obtained at each index field having the same characteristic value table records at the same index field position information are stored in the feature the leaf nodes of the tree a leaf node values ​​associated with values ​​in the table of the same features, and associated with the corresponding description information in the index field in a database of the first storage area corresponding to the characteristic value table.
  37. 37.如权利要求36所述的装置,其特征在于,所述写操作单元将存储表记录的位置信息记录到所述第二存储区的索引信息中包括:根据表记录所在数据库查询第一存储区确定该数据库表的各索引字段;从所述表记录中提取各索引字段对应的键值,并获得各键值对应的特征值;利用各特征值分别查询第二存储区中相应的特征值表,若特征值表中存在该特征值, 则在该特征值关联的叶子节点树上增加包含表记录位置信息的叶子节点,否则,将特征值加入特征值表和创建与该特征值关联的包含表记录位置信息的叶子节点。 37. The apparatus according to claim 36, wherein said write information storage unit recording location table records the index information to the second storage region comprises: storing a query according to a first database table with records determining the area of ​​each database table index field; extraction field corresponding to each index key value from the table records, and obtaining feature values ​​corresponding to the respective key; query by each eigenvalue corresponding eigenvalue second storage area, respectively, table, if the feature value exists in the feature value table is increased leaf nodes contain location information table recorded in a tree leaf node associated with the feature value, otherwise the feature value added feature value table and create value associated with the feature comprising recording position information table leaf node.
  38. 38.如权利要求37所述的装置,其特征在于,所述写操作单元在叶子节点树上增加包含表记录位置信息的叶子节点时,先在第一关联关系中搜索键值相同的表记录关联的叶子节点,若未搜索到,则在第一关联关系上增加包含表记录位置信息的叶子节点,若搜索到, 则在该叶子节点所在的第二关联关系上增加包含表记录位置信息的叶子节点。 38. The apparatus according to claim 37, wherein, when the write operation unit increase leaf node tree leaf nodes contain the recording position information table, searching for the same first key in the first table records the association relationship associated leaf node, if no search is increased leaf nodes contain location information table recorded on the first association relationship, if the search is increased in the second association table comprising a leaf node where the recording position information leaf node.
  39. 39.如权利要求37所述的装置,其特征在于,所述索引单元在搜索叶子节点树中的叶子节点时,先在第一关联关系中搜索键值相同的表记录关联的叶子节点,若未搜索到,则停止搜索,若搜索到,则在搜索到的叶子节点所在的第二关联关系上依次遍历各叶子节点。 39. The apparatus according to claim 37, wherein, when the leaf node index cell leaf node in the search tree, the leaf nodes to search for records associated with the same key in the first table the association relationship, if No search, the search is stopped, if the search is on to search for the second association leaf node is located, traversing each leaf node.
CN 200710105890 2007-06-01 2007-06-01 Internal memory database system and method and device for implementing internal memory data base CN101315628B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 200710105890 CN101315628B (en) 2007-06-01 2007-06-01 Internal memory database system and method and device for implementing internal memory data base

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN 200710105890 CN101315628B (en) 2007-06-01 2007-06-01 Internal memory database system and method and device for implementing internal memory data base

Publications (2)

Publication Number Publication Date
CN101315628A CN101315628A (en) 2008-12-03
CN101315628B true CN101315628B (en) 2011-01-05

Family

ID=40106640

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 200710105890 CN101315628B (en) 2007-06-01 2007-06-01 Internal memory database system and method and device for implementing internal memory data base

Country Status (1)

Country Link
CN (1) CN101315628B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636349A (en) * 2013-11-07 2015-05-20 阿里巴巴集团控股有限公司 Method and equipment for compression and searching of index data

Families Citing this family (31)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101714167B (en) 2009-11-03 2013-03-06 北京九合创胜网络科技有限公司 Method and device for accessing monofile database
CN101826106B (en) * 2010-04-09 2012-07-04 上海交通大学 Telemetering data access method for ground station of unmanned airship system
CN101859139B (en) * 2010-06-01 2012-02-08 杭州和利时自动化有限公司 Data sharing realizing method of distribution type control system and device thereof
CN102447604B (en) * 2010-09-30 2016-01-27 迈普通信技术股份有限公司 Routing table information storing method, and a routing device
CN102117338B (en) * 2011-04-02 2013-03-13 天脉聚源(北京)传媒科技有限公司 Data base caching method
CN102346783B (en) * 2011-11-09 2014-09-17 华为技术有限公司 Data retrieval method and device
CN103106144B (en) * 2011-11-15 2015-10-28 北京新媒传信科技有限公司 A memory-index compression method and apparatus
CN102420814A (en) * 2011-11-21 2012-04-18 航天科工深圳(集团)有限公司 Data access method and device, and server
CN103229164B (en) * 2011-11-24 2016-08-03 华为技术有限公司 Data access methods and apparatus
CN102411632B (en) * 2011-12-27 2014-08-20 北京人大金仓信息技术股份有限公司 Chain table-based memory database page type storage method
CN103593721B (en) * 2012-08-13 2016-10-05 中国商用飞机有限责任公司 Based on complex event processing business process monitoring method
CN102880704A (en) * 2012-09-25 2013-01-16 上海证券交易所 Novel concurrent memory data organization and access method
CN103729304B (en) * 2012-10-11 2017-03-15 腾讯科技(深圳)有限公司 Data processing method and apparatus
CN102929979A (en) * 2012-10-17 2013-02-13 华为技术有限公司 Method and device for locating page memory space
CN103020146A (en) * 2012-11-22 2013-04-03 华为技术有限公司 Data processing method and equipment
CN103902548B (en) * 2012-12-25 2017-06-23 航天信息股份有限公司 An access database system and method and registration, booking, online shopping system
CN104298681B (en) * 2013-07-18 2018-06-19 华为技术有限公司 Seed data storage method and apparatus
CN103473314A (en) * 2013-09-11 2013-12-25 北京思特奇信息技术股份有限公司 Key value pair storing method and device based on shared memory
CN103473321A (en) * 2013-09-12 2013-12-25 华为技术有限公司 Database management method and system
CN103530067B (en) * 2013-10-09 2017-06-09 华为技术有限公司 A method and apparatus for data manipulation
CN103577553A (en) * 2013-10-18 2014-02-12 汉柏科技有限公司 Data storage method
CN103593485B (en) * 2013-12-04 2017-06-16 网易传媒科技(北京)有限公司 To achieve real-time database operation method and apparatus
CN104731799B (en) * 2013-12-20 2018-09-04 中国银联股份有限公司 Memory database management system
CN104866502A (en) * 2014-02-25 2015-08-26 深圳市中兴微电子技术有限公司 Data matching method and device
CN104657467B (en) * 2015-02-11 2017-09-05 南京国电南自维美德自动化有限公司 Subscribe with a real-time memory database / data released by the push framework
CN104809183B (en) * 2015-04-17 2018-06-22 北京奇艺世纪科技有限公司 Method and apparatus for reading and writing of data types
CN106796588A (en) * 2015-06-03 2017-05-31 华为技术有限公司 Updating method and device for index table
CN105515868A (en) * 2015-12-12 2016-04-20 中国航空工业集团公司西安航空计算技术研究所 Configuration and storage method of AFDX data acquisition recorder
CN106021488A (en) * 2016-05-19 2016-10-12 乐视控股(北京)有限公司 Key value database management method and apparatus
CN106604043A (en) * 2016-12-30 2017-04-26 Ut斯达康(深圳)技术有限公司 Internet-based live broadcast method and live broadcast server
CN108334541A (en) * 2017-12-18 2018-07-27 中兴通讯股份有限公司 Data storing method, device and equipment and storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1838124A (en) 2006-02-20 2006-09-27 南京联创科技股份有限公司 Grid and T-tree index method for rapid positioning in main memory database
CN1877573A (en) 2005-06-10 2006-12-13 华夏科技股份有限公司 Multilayer database system structure

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1877573A (en) 2005-06-10 2006-12-13 华夏科技股份有限公司 Multilayer database system structure
CN1838124A (en) 2006-02-20 2006-09-27 南京联创科技股份有限公司 Grid and T-tree index method for rapid positioning in main memory database

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104636349A (en) * 2013-11-07 2015-05-20 阿里巴巴集团控股有限公司 Method and equipment for compression and searching of index data
CN104636349B (en) * 2013-11-07 2018-05-22 阿里巴巴集团控股有限公司 Kind of index data compression method and index data searching and equipment

Also Published As

Publication number Publication date
CN101315628A (en) 2008-12-03

Similar Documents

Publication Publication Date Title
US7451290B2 (en) Method and mechanism for on-line data compression and in-place updates
US7895216B2 (en) Method and system for sorting database tables according to a sort pattern and sort order
US6243718B1 (en) Building indexes on columns containing large objects
US5404510A (en) Database index design based upon request importance and the reuse and modification of similar existing indexes
US9430390B2 (en) Core in-memory space and object management architecture in a traditional RDBMS supporting DW and OLTP applications
US6405198B1 (en) Complex data query support in a partitioned database system
US7469241B2 (en) Efficient data aggregation operations using hash tables
US5878409A (en) Method and apparatus for implementing partial declustering in a parallel database system
CN1292371C (en) Inverted index storage method, inverted index mechanism and on-line updating method
US7860907B2 (en) Data processing
US9449005B2 (en) Metadata storage system and management method for cluster file system
US6175835B1 (en) Layered index with a basic unbalanced partitioned index that allows a balanced structure of blocks
AU2007317574B2 (en) Managing storage of individually accessible data units
US6658437B1 (en) System and method for data space allocation using optimized bit representation
US5974427A (en) Method and computer system for implementing concurrent accesses of a database record by multiple users
US6738790B1 (en) Approach for accessing large objects
AU759360B2 (en) Database apparatus
CN1264107C (en) Integrating tablespaces with different block sizes
US8161244B2 (en) Multiple cache directories
US6502086B2 (en) Mapping binary objects in extended relational database management systems with relational registry
CA2125606C (en) Efficient storage of objects in a file system
US20030074348A1 (en) Partitioned database system
JP2761389B2 (en) File sequential access method and apparatus
JP4313323B2 (en) Searchable archive
CN103577123B (en) Hdfs based optimization method for storing small files

Legal Events

Date Code Title Description
C06 Publication
C10 Entry into substantive examination
C14 Grant of patent or utility model
EXPY Termination of patent right or utility model