WO2020238546A1 - 一种kv数据库配置方法、查询方法、设备和存储介质 - Google Patents
一种kv数据库配置方法、查询方法、设备和存储介质 Download PDFInfo
- Publication number
- WO2020238546A1 WO2020238546A1 PCT/CN2020/087827 CN2020087827W WO2020238546A1 WO 2020238546 A1 WO2020238546 A1 WO 2020238546A1 CN 2020087827 W CN2020087827 W CN 2020087827W WO 2020238546 A1 WO2020238546 A1 WO 2020238546A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- index
- query
- index data
- database
- Prior art date
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2282—Tablespace storage structures; Management thereof
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2228—Indexing structures
- G06F16/2264—Multidimensional index structures
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/22—Indexing; Data structures therefor; Storage structures
- G06F16/2228—Indexing structures
- G06F16/2272—Management thereof
Definitions
- This application relates to the field of information storage technology, and specifically relates to a KV database configuration method, query method, equipment and storage medium.
- the KV database is a non-relational database, which is not suitable for business data storage involving some data relational services.
- relational databases such as using TiKV's TiDB database
- this kind of database is generally It is customized to meet the needs of developers for certain data relationships. It is difficult to use this database to query non-customized ordinary relationship data.
- the present invention provides a KV database configuration method, including:
- the first index information includes the name of the first index and index data of the first index in the first data.
- the first index information also includes unique index data of the first data.
- the unique index data is automatically configured for the first data table.
- the unique index data is a fixed number of bits. If it is not satisfied, zeros are added before the unique index data to satisfy the number of bits.
- the method also includes:
- association table includes index data combinations of several data tables, and each unique index data corresponding to the index data combinations in the several data tables.
- the present invention provides a kv database query method, which is suitable for single-table query, and is characterized in that the method includes:
- the present invention provides a kv database query method, which is suitable for querying related tables, and is characterized in that the method includes:
- the present invention also provides a device that includes one or more processors and a memory, where the memory contains instructions executable by the one or more processors to make the one or more processors execute each of the processors according to the present invention.
- the kv database configuration method and query method provided by the embodiment.
- the present invention also provides a storage medium storing a computer program, which causes the computer to execute the kv database configuration method and query method provided according to the embodiments of the present invention.
- a KV database configuration method, query method, device and storage medium store data in a data storage area by using unique index data of a data table as a key value and several ordinary index data as value values;
- the first index information in the data table is used as the key value, and the unique index data of the first data is used as the value value.
- Several index data are generated and stored in the index storage area, so as to realize the automatic operation of all relational data in the data table.
- Stored in the kv database greatly simplifies the workload of manually constructing the kv, and at the same time enables the ordinary kv database to achieve the effect of the relational database, and realizes the query of all data relationships through the kv database database.
- FIG. 1 is a schematic diagram of a user data table provided by an embodiment of the present invention.
- Figure 2 is a flowchart of a kv database configuration method provided by an embodiment of the present invention.
- Fig. 3 is a schematic diagram of a scenario of a preferred embodiment of the method shown in Fig. 2.
- Fig. 4 is a schematic diagram of a preferred embodiment of the method shown in Fig. 2.
- Fig. 5 is a flowchart of a preferred embodiment of the method shown in Fig. 2.
- FIG. 6 is a schematic diagram of a scenario of a preferred embodiment of the method shown in FIG. 5.
- Fig. 7 is a flowchart of a kv database query method provided by an embodiment of the present invention.
- FIG. 8 is a flowchart of a kv database query method provided by another embodiment of the present invention.
- FIG. 9 is a schematic structural diagram of a device provided by an embodiment of the present invention.
- Fig. 1 is a schematic diagram of a user data table provided by an embodiment of the present invention.
- the id in the table is used as the unique index primary of the table, and the corresponding 1, 2, 3, etc. under the id are the unique index data of the table; the unique index data represents The data that is not repeated with the data in the user data table corresponds to the rows in the user data table one-to-one, and the name, address, gender, etc. are ordinary index indexes, and the corresponding data below are ordinary index data.
- Figure 2 is a flowchart of a kv database configuration method provided by an embodiment of the present invention.
- the present invention provides a kv database configuration method, including:
- the first index information includes the name of the first index, and index data of the first index in the first data.
- the id in the user data table is used as the unique index
- the unique index data primaryid:1 is used as the key value of the kv database
- the id is 1
- the other data in this row is processed as the value value of the kv database.
- the processing method of the other data in this row is the existing processing technology.
- the generated key-value data is stored in the data storage area; the name is used as a common index, then name:Lucy as the key value, primaryid:1 as the value value; similarly, if address is used as a common index, address:Lucy as the key value, primaryid:1 as the value value, and gender as the common index index, then gender:Lucy as the value
- the key value, primaryid:1 is the value value, and the above-mentioned ordinary index data is stored in the index storage area; in this way, all the data with id 1 has been automatically stored in the kv database.
- the same principle is to store the data with id 2 in the kv database, and store the data with id 3 in the kv database...
- the definition of the key value can also add other content that can identify the data table on the basis of the above.
- the above user table can be represented by userprimaryid:1, username:Lucy, useraddress:Lucy, and the game table (b The common index of the row where the id is a in) can be represented by gamename: game 1, gamestatus: open, and is not limited by the foregoing embodiment.
- the above embodiment realizes relational data by generating corresponding key values and value values for different data in the data table according to their corresponding configuration methods, and storing the generated key values and value values in corresponding storage areas.
- the content of this can automatically store all relational data in the kv database, which greatly saves all the costs of manually storing the data relationships in the data table in the kv database, and improves the efficiency of work.
- All of the data relationships can be stored in the kv database without omission, and it is more reliable and convenient for data query to obtain the required data.
- Fig. 4 is a schematic diagram of a preferred embodiment of the method shown in Fig. 2. As shown in FIG. 4, the first index information described in the above method also includes unique index data of the first data.
- the first index information also includes unique index data, that is, the unique index is id1, and the first index information whose common index is name also includes primaryid:1, and the corresponding key is name:Lucy: primaryid:1, the key corresponding to the common index address is address:Lucy:primaryid:1, the key corresponding to the common index gender is gender:Lucy:primaryid:1; similarly, the key and value of the common index whose unique index is id2
- the generation method is the same as above, so I won't repeat it here.
- the data content is not redundant. Even if there is the same index data content, the generated first index information is also different because the unique index data is different. Will not be the same, have uniqueness.
- the first index information in addition to the unique index data, can also be 1, 2, 3, A, B, C, a, b, c... such data information as long as the first index
- the index information only needs to be unique in the data table, and the specific content is not limited by the foregoing embodiment.
- the first data table is automatically configured with unique index data, that is, if the data is not unique in the data table, the system will automatically assign unique index data to the data table , Such as according to the serial number 1, 2, 3 and other numbers, can also be allocated according to letters such as A, B, C, or any combination of these data, as long as it can be unique in the table.
- the unique index data is a fixed number of digits. If it is not satisfied, zeros should be added before the unique index data to meet the number of digits; specifically, as shown in the data table shown in Figure 1, the number under id is 1, 2, 3 «Wait, in the kv database, we set the number of unique index data to 20 digits. If it is not 20 digits, add zeros in the front. For example, after 1 is completed, it is 00000000000000000001, 2 is 0000000000000002, ... 10 is 00000000000000000010 ,11 is 00000000000000000011.
- Fig. 5 is a flowchart of a preferred embodiment of the method shown in Fig. 2. As shown in FIG. 5, in a preferred embodiment, the above method further includes: S13. Generating association tables of several data tables according to several data tables; wherein the association table includes index data combinations of several data tables, and the index data combination is Each unique index data corresponding to several data tables.
- Fig. 7 is a flowchart of a kv database query method provided by the present invention.
- a kv database query method the database is generated by the method shown in Fig. 4, the method is suitable for single-table query, and is characterized in that the method includes:
- S21 Generate first query index data according to the first information query content information, and determine whether the first query index data is the same as the unique index data:
- the query path is name:Lucy:primaryid:1 ⁇ primaryid:1, after obtaining primaryid:1, go to the data storage area to obtain all the data about Lucy (Lucy, abc, female). If you need to query all the data with id 1, after constructing the first query index data based on the query data, it is judged that the data is unique index data, and then the data is directly queried in the data storage area, the query path is primaryid:1 ⁇ Lucy, abc, female.
- FIG 8 is a flowchart of another kv database query method provided by the present invention. As shown in Figure 8, a kv database query method. The database is generated by the method shown in Figure 5. The method is suitable for querying related tables, and is characterized in that the method includes:
- the second query index data is generated according to " ⁇ # ⁇ 1", and the corresponding key value is obtained in the index storage area according to the corresponding key value. value value, and obtain primaryuserid:1, then query game:a according to primaryuserid:1, and then query the required data in the kv database of game table ( Figure 1b) according to game:a.
- the above method is also suitable for querying multiple union tables, and the construction principle is the same as the above method, so it will not be repeated here.
- FIG. 9 is a schematic structural diagram of a device provided by an embodiment of the present invention.
- the present application also provides a device 700, including one or more central processing units (CPU) 701, which can be based on a program stored in a read-only memory (ROM) 702 or The program loaded from the storage section 708 into the random access memory (RAM) 703 executes various appropriate actions and processing. In the RAM 703, various programs and data required for the operation of the device 700 are also stored.
- the CPU 701, the ROM 702, and the RAM 703 are connected to each other through a bus 704.
- An input/output (I/O) interface 705 is also connected to the bus 704.
- the following components are connected to the I/O interface 705: an input part 706 including a keyboard, a mouse, etc.; an output part 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage part 708 including a hard disk, etc. ; And a communication section 709 including a network interface card such as a LAN card, a modem, etc.
- the communication section 709 performs communication processing via a network such as the Internet.
- the drive 710 is also connected to the I/O interface 705 as needed.
- a removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that the computer program read therefrom is installed into the storage section 708 as needed.
- the kv database configuration method and query method described in any of the above embodiments can be implemented as a computer software program.
- an embodiment of the present disclosure includes a computer program product, which includes a computer program tangibly contained on a machine-readable medium, and the computer program includes program code for executing a kv database configuration method and a query method.
- the computer program may be downloaded and installed from the network through the communication part 709, and/or installed from the removable medium 711.
- the present application also provides a computer-readable storage medium.
- the computer-readable storage medium may be the computer-readable storage medium included in the device of the above-mentioned embodiment; or it may exist alone without being installed in The computer-readable storage medium in the device.
- the computer-readable storage medium stores one or more programs, and the programs are used by one or more processors to execute the kv database configuration method and query method described in this application.
- each block in the flowchart or block diagram can represent a module, program segment, or part of code, and the module, program segment, or part of code contains one or more for realizing the specified logical function Executable instructions.
- the functions marked in the block may also occur in a different order from the order marked in the drawings. For example, two blocks shown in succession can actually be executed substantially in parallel, and they can sometimes be executed in the reverse order, depending on the functions involved.
- each block in the block diagram and/or flowchart, and the combination of the blocks in the block diagram and/or flowchart can be implemented by a dedicated hardware-based system that performs the specified functions or operations Or it can be realized by a combination of dedicated hardware and computer instructions.
- the units or modules involved in the embodiments described in the present application can be implemented in software or hardware.
- the described units or modules may also be arranged in the processor.
- each of the described units may be a software program arranged in a computer or a mobile smart device, or may be a separately configured hardware device.
- the names of these units or modules do not constitute a limitation on the units or modules themselves under certain circumstances.
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Software Systems (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
一种KV数据库配置方法、查询方法、设备和存储介质,包括:将第一数据表的唯一索引数据作为key值、若干普通索引数据作为value值,将第一数据表存储到数据存储区中(S11);将根据第一数据表中的第一数据生成的第一索引信息作为key值、将第一数据的唯一索引数据作为value值,生成若干索引数据对并存储到索引存储区中(S12);其中,第一索引信息包括第一索引的名称、第一数据中第一索引的索引数据。本方法实现了将数据表中所有存在关系的数据自动存到kv数据库中,大大简化了手工构造kv的工作量,同时能够使普通的kv数据库也能实现关系型数据库的效果。
Description
本申请涉及信息存储技术领域,具体涉及一种KV数据库配置方法、查询方法、设备和存储介质。
目前通过kv数据库是一种非关系型数据库,不适合涉及一些数据关系业务的业务数据存储,当前业界有KV数据库实现关系型数据库的方案,如利用TiKV的TiDB数据库,但是这种数据库一般都是定制的满足开发者某种需要的数据关系而做的,利用这种数据库想要查询非定制的普通的关系数据很难实现。
发明内容
鉴于现有技术中的上述缺陷或不足,期望提供一种普遍性的的KV数据库配置方法、查询方法、设备和存储介质。
第一方面,本发明提供一种KV数据库配置方法,包括:
将第一数据表的唯一索引数据作为key值、若干普通索引数据作为value值,将第一数据表存储到数据存储区中;
将根据第一数据表中的第一数据生成的第一索引信息作为key值、将第一数据的唯一索引数据作为value值,生成若干索引数据对并存储到索引存储区中;
其中,第一索引信息包括第一索引的名称、第一数据中第一索引的索引数据。
进一步,第一索引信息还包括第一数据的唯一索引数据。
进一步,第一数据表中没有唯一索引数据时,为第一数据表自动配置唯一索引数据。
进一步,唯一索引数据为固定的位数,如果不满足,则在唯一索引数据前补零以满足位数。
进一步,该方法还包括:
根据若干数据表生成若干数据表的关联表;其中,关联表包括若干数据表的索引数据组合,和索引数据组合在若干数据表中所对应的各唯一索引数据。
第二方面,本发明提供一种kv数据库查询方法,该方法适用于单表查询,其特征在于,方法包括:
根据第一信息查询内容信息生成第一查询索引数据,判断第一查询索引数据是否与唯一索引数据相同:
是,则根据唯一索引数据存储区查询以生成查询结果;
否,则根据第一查询索引数据在索引存储区查询以生成查询结果。
第三方面,本发明提供一种kv数据库查询方法,该方法适用于关联表查询,其特征在于,方法包括:
根据第二信息查询内容生成第二查询索引数据,根据第二查询索引数据在关联表中获取若干索引数据;
根据各索引数据在对应的各数据表中获取所需要的数据信息。
第四方面,本发明还提供一种设备,包括一个或多个处理器和存储器,其中存储器包含可由该一个或多个处理器执行的指令以使得该一个或多个处理器执行根据本发明各实施例提供的kv数据库配置方法和查询方法。
第五方面,本发明还提供一种存储有计算机程序的存储介质,该计算机程序使计算机执行根据本发明各实施例提供的kv数据库配置方法和查询方法。
本发明的有益效果
本发明诸多实施例提供的一种KV数据库配置方法、查询方法、设备和存储介质通过将数据表的唯一索引数据作为key值,若干普通索引数据作为value值,将数据存储在数据存储区中;并将数据表中第一索引信息作为key值、将所述第一数据的唯一索引数据作为value值,生成若干索引数据并存储到索引存储区,实 现了将数据表中所有存在关系的数据自动存到kv数据库中,大大简化了手工构造kv的工作量,同时能够使普通的kv数据库也能实现关系型数据库的效果,实现了通过kv库数据库查询所有数据关系。
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:
图1为本发明一实施例提供用户数据表的示意图。
图2为本发明一实施例提供的一种kv数据库配置方法的流程图。
图3为图2所示方法一优选实施方式的场景示意图。
图4为图2所示方法的一优选实施方式的示意图。
图5为图2所示方法一优选实施方式的流程图。
图6为图5所示方法的一优选实施方式的场景示意图。
图7为本发明一实施例提供的一种kv数据库查询方法的流程图。
图8为本发明另一实施例提供的一种kv数据库查询方法的流程图。
图9为本发明一实施例提供的一种设备的结构示意图。
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与发明相关的部分。
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。
图1为本发明自一实施例提供的用户数据表的示意图。如图1所示,在一优选实施例中,将表中的id作为表的唯一索引primary,id下面对应的1,2,3……等为表的唯一索引数据;唯一索引数据代表的是与用户数据表中的数据不重复的数据,与用户数据表中的行一一对应,而name,address,gender等为普通索引index,其下对应的数据为普通索引数据。
图2为本发明一实施例提供的一种kv数据库配置方法的流程图。
如图2所示,在本实施例中,本发明提供一种kv数据库配置方法,包括:
S11、将第一数据表的唯一索引数据作为key值、若干普通索引数据作为value值,将所述第一数据表存储到数据存储区中;
S12、将根据所述第一数据表中的第一数据生成的第一索引信息作为key值、将所述第一数据的唯一索引数据作为value值,生成若干索引数据对并存储到索引存储区中;
其中,所述第一索引信息包括第一索引的名称、所述第一数据中所述第一索引的索引数据。
具体的,如图3所示,以图1所示数据表为例,将用户数据表中的id作为唯一索引,则将唯一索引数据primaryid:1作为kv数据库的key值,将id为1的该行其他数据经过处理后作为kv数据库的value值,其中该行其他数据的处理方法为现有的处理技术,将生成的若干key-value数据存储在数据存储区;将name作为普通索引,则name:Lucy作为key值,primaryid:1为value值;同样的,将address作为普通索引,则address:Lucy作为key值,primaryid:1作为value值,将gender作为普通索引index,则gender:Lucy作为key值,primaryid:1为value值,并将上述普通索引数据存储到索引存储区;这样,id为1的数据已经全部自动存储到kv数据库中了。
相同原理,将id为2的数据存储到kv数据库中,将id为3的数据存储到kv数据库中……。
在更多实施例中,key值的定义还可以在上述基础上添加其他能标识本数据表的内容,如上述用户表可以用userprimaryid:1,username:Lucy,useraddress:Lucy表示,游戏表(b)中id为a的那一行所在的普通索引可以用gamename:游戏1,gamestatus:open表示,并不受上述实施例的限制。
上述实施例通过将数据表中的不同的数据按照其对应的配置方式生成对应的key值,value值,并将生成的key值,value值对应的存储在相应的存储区,实现了关系型数据的内容可以将所有的关系型数据自动的存储在kv数据库中,大大节省了所有将数据表中的数据关系手工存储到kv数据库的成本,提高了工作的效率,同时,以这种方法将所有的数据关系能全部没有遗漏的存储到kv数据库中,也时数据查询获取需要的数据更加可靠方便。
图4为图2所示方法的一优选实施方式的示意图。如图4所示,上述方法中所描述的第一索引信息还包括第一数据的唯一索引数据。
具体地,如图4所示,第一索引信息后面还包括唯一索引数据,即唯一索引为id1,普通索引为name的第一索引信息还包括primaryid:1,则对应的key为name:Lucy:primaryid:1,普通索引为address对应的key为address:Lucy:primaryid:1,普通索引为gender对应的key为gender:Lucy:primaryid:1;同样地,唯一索引为id2的普通索引的key,value生成方法与上述一样,在此不再赘述。
上述实施例中,通过在第一索引信息中添加其对应的唯一索引数据,使得数据内容不冗余,即使有相同的索引数据内容,但是由于唯一索引数据不同,所以生成的第一索引信息也不会相同,具有唯一性。
在更多实施例中,第一索引信息后面除了可以是唯一索引数据,还可以1,2,3,A,B,C,a,b,c……这样的数据信息,只要能使第一索引信息在数据表中具有唯一性即可,具体的内容不受上述实施例限制。
进一步优选地,当第一数据表中没有唯一索引数据时,为第 一数据表自动配置唯一索引数据,即若数据在数据表中不是唯一的,那么系统将为该数据表自动分配唯一索引数据,如按照序列号1,2,3等数字分配,还可以按照A,B,C等字母分配,还可以是这些数据的任意组合,只要能在表中具有唯一性即可。
进一步,唯一索引数据为固定的位数,如果不满足,则在唯一索引数据前补零以满足位数;具体的,如图1所示数据表为例,id下面的数字为1,2,3……等,在kv数据库中,我们设置唯一索引数据的位数为20位,若不够20位,则在前面补零,如1补完以后为00000000000000000001,2为00000000000000000002,……10为00000000000000000010,11为00000000000000000011。
图5为图2所示方法一优选实施方式的流程图。如图5所示,在一优选实施例中,上述方法还包括:S13、根据若干数据表生成若干数据表的关联表;其中,关联表包括若干数据表的索引数据组合,和索引数据组合在若干数据表中所对应的各唯一索引数据。
具体地,如图6所示,以图1所示的用户表(a)和游戏表(b)为例,将用户表中的性别gender和游戏表中的name之间的关系存储在数据库中,关联表(a)的存储方式与图2所示方式一致,在此不再赘述。同理,还可以将图1所示的用户表(a)和游戏表(b)中的其他关系联系起来生成若干其他关联表。
图7为本发明提供的一种kv数据库查询方法的流程图。如图7所示,一种kv数据库查询方法,该数据库是通过图4所示的方法生成的,该方法适用于单表查询,其特征在于,该方法包括:
S21、根据第一信息查询内容信息生成第一查询索引数据,判断第一查询索引数据是否与唯一索引数据相同:
是,则根据唯一索引数据存储区查询以生成查询结果;
否,则根据第一查询索引数据在索引存储区查询以生成查询结果。
具体地,如需要查询Lucy的所有数据,则构造第一查询索引数据:name:Lucy,判断该数据是否为唯一索引数据,不是,则 通过该第一查询索引数据name:Lucy到索引存储区查找,查询路径为name:Lucy:primaryid:1→primaryid:1,获取到primaryid:1后,到数据存储区中获取关于Lucy的所有数据(Lucy,abc,女)。如需要查询id为1的所有数据,则根据查询数据构造第一查询索引数据后,判断出该数据为唯一索引数据,则直接通过该数据到数据存储区中查询,查询路径为primaryid:1→Lucy,abc,女。
图8为本发明提供的另一种kv数据库查询方法的流程图。如图8所示,一种kv数据库查询方法,数据库是通过图5所示的方法生成的,该方法适用于关联表查询,其特征在于,该方法包括:
S31、根据第二信息查询内容生成第二查询索引数据,根据第二查询索引数据在关联表中获取若干索引数据;
S32、根据各索引数据在对应的各数据表中获取所需要的数据信息。
具体地,如查询女性中玩游戏1的相关数据信息,如图6所示,根据“女#游戏1”生成第二查询索引数据,并根据对应的key值到索引存储区中获取到对应的value值,并获取primaryuserid:1,然后根据primaryuserid:1查询到game:a,然后根据game:a到游戏表(图1b)的kv数据库中查询所需要的数据。
上述方法还适用于多个联合表的查询,构造原理与上述方法相同,在此不再赘述。
图9为本发明一实施例提供的一种设备的结构示意图。
如图7所示,作为另一方面,本申请还提供了一种设备700,包括一个或多个中央处理单元(CPU)701,其可以根据存储在只读存储器(ROM)702中的程序或者从存储部分708加载到随机访问存储器(RAM)703中的程序而执行各种适当的动作和处理。在RAM703中,还存储有设备700操作所需的各种程序和数据。CPU701、ROM702以及RAM703通过总线704彼此相连。输入/输出(I/O)接口705也连接至总线704。
以下部件连接至I/O接口705:包括键盘、鼠标等的输入部分 706;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分707;包括硬盘等的存储部分708;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分709。通信部分709经由诸如因特网的网络执行通信处理。驱动器710也根据需要连接至I/O接口705。可拆卸介质711,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器710上,以便于从其上读出的计算机程序根据需要被安装入存储部分708。
特别地,根据本公开的实施例,上述任一实施例描述的kv数据库配置方法和查询方法可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括有形地包含在机器可读介质上的计算机程序,所述计算机程序包含用于执行kv数据库配置方法和查询方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分709从网络上被下载和安装,和/或从可拆卸介质711被安装。
作为又一方面,本申请还提供了一种计算机可读存储介质,该计算机可读存储介质可以是上述实施例的装置中所包含的计算机可读存储介质;也可以是单独存在,未装配入设备中的计算机可读存储介质。计算机可读存储介质存储有一个或者一个以上程序,该程序被一个或者一个以上的处理器用来执行描述于本申请的kv数据库配置方法和查询方法。
附图中的流程图和框图,图示了按照本发明各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这根据所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以通过执行规定 的功能或操作的专用的基于硬件的系统来实现,或者可以通过专用硬件与计算机指令的组合来实现。
描述于本申请实施例中所涉及到的单元或模块可以通过软件的方式实现,也可以通过硬件的方式来实现。所描述的单元或模块也可以设置在处理器中,例如,各所述单元可以是设置在计算机或移动智能设备中的软件程序,也可以是单独配置的硬件装置。其中,这些单元或模块的名称在某种情况下并不构成对该单元或模块本身的限定。
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离本申请构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。
Claims (9)
- 一种KV数据库配置方法,其特征在于,包括:将第一数据表的唯一索引数据作为key值、若干普通索引数据作为value值,将所述第一数据表存储到数据存储区中;将根据所述第一数据表中的第一数据生成的第一索引信息作为key值、将所述第一数据的唯一索引数据作为value值,生成若干索引数据对并存储到索引存储区中;其中,所述第一索引信息包括第一索引的名称、所述第一数据中所述第一索引的索引数据。
- 根据权利要求1所述的方法,其特征在于,所述第一索引信息还包括所述第一数据的唯一索引数据。
- 根据权利要求1或2所述的方法,其特征在于,所述第一数据表中没有所述唯一索引数据时,为所述第一数据表自动配置所述唯一索引数据。
- 根据权利要求3所述的方法,其特征在于,根据权利要求1或2所述的方法,其特征在于,所述唯一索引数据为固定的位数,如果不满足,则在所述唯一索引数据前补零以满足位数。
- 根据权利要求4所述的方法,其特征在于,还包括:根据若干数据表生成所述若干数据表的关联表;其中,所述关联表包括所述若干数据表的索引数据组合,和所述索引数据组合在所述若干数据表中所对应的各唯一索引数据。
- 一种kv数据库查询方法,所述方法基于按照权利要求2所述方法配置的kv数据库,所述方法适用于单表查询,其特征在于,所述方法包括:根据第一信息查询内容信息生成第一查询索引数据,判断所述第一查询索引数据是否与唯一索引数据相同:是,则根据所述唯一索引数据存储区查询以生成查询结果;否,则根据所述第一查询索引数据在索引存储区查询以生成查询结果。
- 一种kv数据库查询方法,所述方法基于按照权利要求5所述方法生成的kv数据库,所述方法适用于关联表查询,其特征在于,所述方法包括:根据第二信息查询内容生成第二查询索引数据,根据所述第二查询索引数据在所述关联表中获取若干索引数据;根据各所述索引数据在对应的各数据表中获取所需要的数据信息。
- 一种设备,其特征在于,所述设备包括:一个或多个处理器;存储器,用于存储一个或多个程序,当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器执行如权利要求1-7中任一项所述的方法。
- 一种存储有计算机程序的存储介质,其特征在于,该程序被处理器执行时实现如权利要求1-7中任一项所述的方法。
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
US17/604,996 US20220374406A1 (en) | 2019-05-31 | 2020-04-29 | KV Database Configuration Method, Query Method, Device, and Storage Medium |
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910470256.1 | 2019-05-31 | ||
CN201910470256.1A CN110175176A (zh) | 2019-05-31 | 2019-05-31 | 一种kv数据库配置方法、查询方法、设备和存储介质 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020238546A1 true WO2020238546A1 (zh) | 2020-12-03 |
Family
ID=67696189
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2020/087827 WO2020238546A1 (zh) | 2019-05-31 | 2020-04-29 | 一种kv数据库配置方法、查询方法、设备和存储介质 |
Country Status (3)
Country | Link |
---|---|
US (1) | US20220374406A1 (zh) |
CN (1) | CN110175176A (zh) |
WO (1) | WO2020238546A1 (zh) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114327268A (zh) * | 2021-12-27 | 2022-04-12 | 北京云思智学科技有限公司 | 一种应用于kv存储的自适应防护方法、装置及存储介质 |
Families Citing this family (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110175176A (zh) * | 2019-05-31 | 2019-08-27 | 杭州复杂美科技有限公司 | 一种kv数据库配置方法、查询方法、设备和存储介质 |
CN111552710B (zh) * | 2020-04-28 | 2023-07-04 | 电子科技大学 | 一种分布式数据库的查询优化方法 |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110093486A1 (en) * | 2009-10-15 | 2011-04-21 | Institute For Information Industry | Data query method, data query system and computer readable and writable recording medium |
CN106503040A (zh) * | 2016-09-20 | 2017-03-15 | 福建天晴数码有限公司 | 适用sql查询方法的kv数据库及其创建方法 |
CN108062384A (zh) * | 2017-12-13 | 2018-05-22 | 阿里巴巴集团控股有限公司 | 数据检索的方法和装置 |
CN108446363A (zh) * | 2018-03-13 | 2018-08-24 | 北京奇安信科技有限公司 | 一种kv引擎的数据处理方法及装置 |
CN110175176A (zh) * | 2019-05-31 | 2019-08-27 | 杭州复杂美科技有限公司 | 一种kv数据库配置方法、查询方法、设备和存储介质 |
Family Cites Families (14)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CA2451208A1 (en) * | 2001-06-21 | 2003-01-03 | Paul P. Vagnozzi | Database indexing method and apparatus |
US8412700B2 (en) * | 2008-01-11 | 2013-04-02 | International Business Machines Corporation | Database query optimization using index carryover to subset an index |
CN103810224B (zh) * | 2012-11-15 | 2017-04-12 | 阿里巴巴集团控股有限公司 | 信息持久化和查询方法及装置 |
CN103902698B (zh) * | 2014-03-31 | 2018-04-13 | 北京皮尔布莱尼软件有限公司 | 一种数据存储系统和存储方法 |
CN105005572A (zh) * | 2014-04-24 | 2015-10-28 | 中国移动通信集团云南有限公司 | 一种数据库映射方法及装置 |
CN105488043B (zh) * | 2014-09-15 | 2019-03-26 | 南京理工大学 | 基于Key-Value数据块的数据查询方法及系统 |
CN104750809B (zh) * | 2015-03-26 | 2018-05-18 | 中国科学院软件研究所 | 一种支持关系模型和键-值结构的混合数据存储方法 |
CN107515882B (zh) * | 2016-06-17 | 2020-12-25 | 阿里巴巴集团控股有限公司 | 数据查询方法及装置 |
CN107870935A (zh) * | 2016-09-27 | 2018-04-03 | 新华三技术有限公司 | 一种搜索方法及装置 |
CN106776955A (zh) * | 2016-12-02 | 2017-05-31 | 北京中交兴路车联网科技有限公司 | 一种数据存储和检索的方法及装置 |
US20190179948A1 (en) * | 2017-12-12 | 2019-06-13 | International Business Machines Corporation | Storing unstructured data in a structured framework |
US11132376B2 (en) * | 2018-02-28 | 2021-09-28 | Walmart Apollo, Llc | System and method for management of a database system |
US20190392047A1 (en) * | 2018-06-25 | 2019-12-26 | Amazon Technologies, Inc. | Multi-table partitions in a key-value database |
US20230054127A1 (en) * | 2021-08-18 | 2023-02-23 | Samsung Electronics Co., Ltd. | Key value storage device with hashing |
-
2019
- 2019-05-31 CN CN201910470256.1A patent/CN110175176A/zh active Pending
-
2020
- 2020-04-29 WO PCT/CN2020/087827 patent/WO2020238546A1/zh active Application Filing
- 2020-04-29 US US17/604,996 patent/US20220374406A1/en not_active Abandoned
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20110093486A1 (en) * | 2009-10-15 | 2011-04-21 | Institute For Information Industry | Data query method, data query system and computer readable and writable recording medium |
CN106503040A (zh) * | 2016-09-20 | 2017-03-15 | 福建天晴数码有限公司 | 适用sql查询方法的kv数据库及其创建方法 |
CN108062384A (zh) * | 2017-12-13 | 2018-05-22 | 阿里巴巴集团控股有限公司 | 数据检索的方法和装置 |
CN108446363A (zh) * | 2018-03-13 | 2018-08-24 | 北京奇安信科技有限公司 | 一种kv引擎的数据处理方法及装置 |
CN110175176A (zh) * | 2019-05-31 | 2019-08-27 | 杭州复杂美科技有限公司 | 一种kv数据库配置方法、查询方法、设备和存储介质 |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN114327268A (zh) * | 2021-12-27 | 2022-04-12 | 北京云思智学科技有限公司 | 一种应用于kv存储的自适应防护方法、装置及存储介质 |
Also Published As
Publication number | Publication date |
---|---|
US20220374406A1 (en) | 2022-11-24 |
CN110175176A (zh) | 2019-08-27 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020238546A1 (zh) | 一种kv数据库配置方法、查询方法、设备和存储介质 | |
WO2019128318A1 (zh) | 数据处理方法、装置和系统 | |
US10558659B2 (en) | Techniques for dictionary based join and aggregation | |
US9672272B2 (en) | Method, apparatus, and computer-readable medium for efficiently performing operations on distinct data values | |
TWI745702B (zh) | 資料查詢方法、裝置、電子設備及電腦可讀儲存媒體 | |
Wu et al. | Comparisons between mongodb and ms-sql databases on the twc website | |
US12056123B2 (en) | System and method for disjunctive joins using a lookup table | |
US11615086B2 (en) | System and method for disjunctive joins | |
US8589451B1 (en) | Systems and methods for generating a common data model for relational and object oriented databases | |
US9069817B2 (en) | Database row access control | |
WO2020215830A1 (zh) | 用于数据库的表的外连接的方法和系统 | |
US11113267B2 (en) | Enforcing path consistency in graph database path query evaluation | |
WO2016112502A1 (zh) | 存储查询结果的方法和装置、计算设备 | |
CN108874873B (zh) | 数据查询方法、装置、存储介质及处理器 | |
GB2516501A (en) | Method and system for processing data in a parallel database environment | |
CN111737537B (zh) | 基于图数据库的poi推荐方法、设备及介质 | |
Cai et al. | Effective temporal dependence discovery in time series data | |
CN106326295B (zh) | 语义数据的存储方法及装置 | |
CN116737753A (zh) | 业务数据处理方法、装置、计算机设备和存储介质 | |
EP4432117A1 (en) | Data model generation method and apparatus | |
JP2011113103A (ja) | マルチテナント型コンピュータシステム | |
US11157508B2 (en) | Estimating the number of distinct entities from a set of records of a database system | |
Shah et al. | A systematic review of in-memory database over multi-tenancy | |
US12019608B2 (en) | Storing and querying knowledge graphs in column stores using a global dictionary | |
Xu et al. | What-if query processing policy for big data in OLAP system |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 20813933 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 20813933 Country of ref document: EP Kind code of ref document: A1 |