WO2020238546A1 - Kv database configuration method, query method, device and storage medium - Google Patents

Kv database configuration method, query method, device and storage medium Download PDF

Info

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
Application number
PCT/CN2020/087827
Other languages
French (fr)
Chinese (zh)
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 US17/604,996 priority Critical patent/US20220374406A1/en
Publication of WO2020238546A1 publication Critical patent/WO2020238546A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2282Tablespace storage structures; Management thereof
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2264Multidimensional index structures
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/22Indexing; Data structures therefor; Storage structures
    • G06F16/2228Indexing structures
    • G06F16/2272Management thereof

Abstract

A KV database configuration method, a query method, a device, and a storage medium, wherein the method comprises: taking unique index data of a first data table as a key value, taking a plurality of common index data as value value, and storing the first data table into a data storage area (S11); taking first index information generated according to the first data in the first data table as the key value, taking the unique index data of the first data as the value value, and generating a plurality of index data pairs and storing the index data pairs into the index storage area (S12); wherein, the first index information comprises the name of the first index, and the index data of the first index in the first data. The method realizes automatically storing all relational data in the data table into the kv database, greatly simplifies the workload of manually constructing the kv, and meanwhile, a common kv database can also achieve the effect of a relational database.

Description

一种KV数据库配置方法、查询方法、设备和存储介质KV database configuration method, query method, equipment and storage medium 技术领域Technical field
本申请涉及信息存储技术领域,具体涉及一种KV数据库配置方法、查询方法、设备和存储介质。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.
背景技术Background technique
目前通过kv数据库是一种非关系型数据库,不适合涉及一些数据关系业务的业务数据存储,当前业界有KV数据库实现关系型数据库的方案,如利用TiKV的TiDB数据库,但是这种数据库一般都是定制的满足开发者某种需要的数据关系而做的,利用这种数据库想要查询非定制的普通的关系数据很难实现。At present, the KV database is a non-relational database, which is not suitable for business data storage involving some data relational services. Currently, there are solutions for KV databases in the industry to implement relational databases, such as using TiKV's TiDB database, but 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.
发明内容Summary of the invention
鉴于现有技术中的上述缺陷或不足,期望提供一种普遍性的的KV数据库配置方法、查询方法、设备和存储介质。In view of the above-mentioned shortcomings or deficiencies in the prior art, it is desirable to provide a universal KV database configuration method, query method, equipment and storage medium.
第一方面,本发明提供一种KV数据库配置方法,包括:In the first aspect, the present invention provides a KV database configuration method, including:
将第一数据表的唯一索引数据作为key值、若干普通索引数据作为value值,将第一数据表存储到数据存储区中;Use the unique index data of the first data table as the key value and several ordinary index data as the value value, and store the first data table in the data storage area;
将根据第一数据表中的第一数据生成的第一索引信息作为key值、将第一数据的唯一索引数据作为value值,生成若干索引数据对并存储到索引存储区中;Using the first index information generated according to the first data in the first data table as the key value, and the unique index data of the first data as the value value, generating several index data pairs and storing them in the index storage area;
其中,第一索引信息包括第一索引的名称、第一数据中第一索引的索引数据。Wherein, the first index information includes the name of the first index and index data of the first index in the first data.
进一步,第一索引信息还包括第一数据的唯一索引数据。Further, the first index information also includes unique index data of the first data.
进一步,第一数据表中没有唯一索引数据时,为第一数据表自动配置唯一索引数据。Further, when there is no unique index data in the first data table, the unique index data is automatically configured for the first data table.
进一步,唯一索引数据为固定的位数,如果不满足,则在唯一索引数据前补零以满足位数。Further, 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.
进一步,该方法还包括:Further, the method also includes:
根据若干数据表生成若干数据表的关联表;其中,关联表包括若干数据表的索引数据组合,和索引数据组合在若干数据表中所对应的各唯一索引数据。Generate association tables of several data tables according to several data tables; among them, the 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.
第二方面,本发明提供一种kv数据库查询方法,该方法适用于单表查询,其特征在于,方法包括:In the second aspect, the present invention provides a kv database query method, which is suitable for single-table query, and is characterized in that the method includes:
根据第一信息查询内容信息生成第一查询索引数据,判断第一查询索引数据是否与唯一索引数据相同:Generate the 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:
是,则根据唯一索引数据存储区查询以生成查询结果;If yes, query based on the unique index data storage area to generate query results;
否,则根据第一查询索引数据在索引存储区查询以生成查询结果。Otherwise, query the index storage area according to the first query index data to generate the query result.
第三方面,本发明提供一种kv数据库查询方法,该方法适用于关联表查询,其特征在于,方法包括:In a third aspect, the present invention provides a kv database query method, which is suitable for querying related tables, and is characterized in that the method includes:
根据第二信息查询内容生成第二查询索引数据,根据第二查询索引数据在关联表中获取若干索引数据;Generate second query index data according to the second information query content, and obtain several index data in the association table according to the second query index data;
根据各索引数据在对应的各数据表中获取所需要的数据信息。Obtain the required data information in the corresponding data tables according to the index data.
第四方面,本发明还提供一种设备,包括一个或多个处理器和存储器,其中存储器包含可由该一个或多个处理器执行的指令以使得该一个或多个处理器执行根据本发明各实施例提供的kv数据库配置方法和查询方法。In a fourth aspect, 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.
第五方面,本发明还提供一种存储有计算机程序的存储介质,该计算机程序使计算机执行根据本发明各实施例提供的kv数据库配置方法和查询方法。In the fifth aspect, 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.
本发明的有益效果The beneficial effects of the present invention
本发明诸多实施例提供的一种KV数据库配置方法、查询方法、设备和存储介质通过将数据表的唯一索引数据作为key值,若干普通索引数据作为value值,将数据存储在数据存储区中;并将数据表中第一索引信息作为key值、将所述第一数据的唯一索引数据作为value值,生成若干索引数据并存储到索引存储区,实 现了将数据表中所有存在关系的数据自动存到kv数据库中,大大简化了手工构造kv的工作量,同时能够使普通的kv数据库也能实现关系型数据库的效果,实现了通过kv库数据库查询所有数据关系。A KV database configuration method, query method, device and storage medium provided by many embodiments of the present invention 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.
附图说明Description of the drawings
通过阅读参照以下附图所作的对非限制性实施例所作的详细描述,本申请的其它特征、目的和优点将会变得更明显:By reading the detailed description of the non-limiting embodiments with reference to the following drawings, other features, purposes and advantages of the present application will become more apparent:
图1为本发明一实施例提供用户数据表的示意图。FIG. 1 is a schematic diagram of a user data table provided by an embodiment of the present invention.
图2为本发明一实施例提供的一种kv数据库配置方法的流程图。Figure 2 is a flowchart of a kv database configuration method provided by an embodiment of the present invention.
图3为图2所示方法一优选实施方式的场景示意图。Fig. 3 is a schematic diagram of a scenario of a preferred embodiment of the method shown in Fig. 2.
图4为图2所示方法的一优选实施方式的示意图。Fig. 4 is a schematic diagram of a preferred embodiment of the method shown in Fig. 2.
图5为图2所示方法一优选实施方式的流程图。Fig. 5 is a flowchart of a preferred embodiment of the method shown in Fig. 2.
图6为图5所示方法的一优选实施方式的场景示意图。FIG. 6 is a schematic diagram of a scenario of a preferred embodiment of the method shown in FIG. 5.
图7为本发明一实施例提供的一种kv数据库查询方法的流程图。Fig. 7 is a flowchart of a kv database query method provided by an embodiment of the present invention.
图8为本发明另一实施例提供的一种kv数据库查询方法的流程图。FIG. 8 is a flowchart of a kv database query method provided by another embodiment of the present invention.
图9为本发明一实施例提供的一种设备的结构示意图。FIG. 9 is a schematic structural diagram of a device provided by an embodiment of the present invention.
具体实施方式Detailed ways
下面结合附图和实施例对本申请作进一步的详细说明。可以理解的是,此处所描述的具体实施例仅仅用于解释相关发明,而非对该发明的限定。另外还需要说明的是,为了便于描述,附图中仅示出了与发明相关的部分。The application will be further described in detail below with reference to the drawings and embodiments. It can be understood that the specific embodiments described here are only used to explain the related invention, but not to limit the invention. In addition, it should be noted that, for ease of description, only the parts related to the invention are shown in the drawings.
需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。下面将参考附图并结合实施例来详细说明本申请。It should be noted that the embodiments in the application and the features in the embodiments can be combined with each other if there is no conflict. Hereinafter, the present application will be described in detail with reference to the drawings and in conjunction with embodiments.
图1为本发明自一实施例提供的用户数据表的示意图。如图1所示,在一优选实施例中,将表中的id作为表的唯一索引primary,id下面对应的1,2,3……等为表的唯一索引数据;唯一索引数据代表的是与用户数据表中的数据不重复的数据,与用户数据表中的行一一对应,而name,address,gender等为普通索引index,其下对应的数据为普通索引数据。Fig. 1 is a schematic diagram of a user data table provided by an embodiment of the present invention. As shown in Figure 1, in a preferred embodiment, 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.
图2为本发明一实施例提供的一种kv数据库配置方法的流程图。Figure 2 is a flowchart of a kv database configuration method provided by an embodiment of the present invention.
如图2所示,在本实施例中,本发明提供一种kv数据库配置方法,包括:As shown in Figure 2, in this embodiment, the present invention provides a kv database configuration method, including:
S11、将第一数据表的唯一索引数据作为key值、若干普通索引数据作为value值,将所述第一数据表存储到数据存储区中;S11. Use the unique index data of the first data table as a key value and several ordinary index data as value values, and store the first data table in a data storage area;
S12、将根据所述第一数据表中的第一数据生成的第一索引信息作为key值、将所述第一数据的唯一索引数据作为value值,生成若干索引数据对并存储到索引存储区中;S12. Use the first index information generated according to the first data in the first data table as the key value, and use the unique index data of the first data as the value value to generate several index data pairs and store them in the index storage area in;
其中,所述第一索引信息包括第一索引的名称、所述第一数据中所述第一索引的索引数据。Wherein, the first index information includes the name of the first index, and index data of the first index in the first data.
具体的,如图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数据库中了。Specifically, as shown in Figure 3, taking the data table shown in Figure 1 as an example, the id in the user data table is used as the unique index, and the unique index data primaryid:1 is used as the key value of the kv database, and 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.
相同原理,将id为2的数据存储到kv数据库中,将id为3的数据存储到kv数据库中……。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...
在更多实施例中,key值的定义还可以在上述基础上添加其他能标识本数据表的内容,如上述用户表可以用userprimaryid:1,username:Lucy,useraddress:Lucy表示,游戏表(b)中id为a的那一行所在的普通索引可以用gamename:游戏1,gamestatus:open表示,并不受上述实施例的限制。In more embodiments, the definition of the key value can also add other content that can identify the data table on the basis of the above. For example, 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.
上述实施例通过将数据表中的不同的数据按照其对应的配置方式生成对应的key值,value值,并将生成的key值,value值对应的存储在相应的存储区,实现了关系型数据的内容可以将所有的关系型数据自动的存储在kv数据库中,大大节省了所有将数据表中的数据关系手工存储到kv数据库的成本,提高了工作的效率,同时,以这种方法将所有的数据关系能全部没有遗漏的存储到kv数据库中,也时数据查询获取需要的数据更加可靠方便。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. At the same time, all the data in this method 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.
图4为图2所示方法的一优选实施方式的示意图。如图4所示,上述方法中所描述的第一索引信息还包括第一数据的唯一索引数据。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.
具体地,如图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生成方法与上述一样,在此不再赘述。Specifically, as shown in FIG. 4, 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.
上述实施例中,通过在第一索引信息中添加其对应的唯一索引数据,使得数据内容不冗余,即使有相同的索引数据内容,但是由于唯一索引数据不同,所以生成的第一索引信息也不会相同,具有唯一性。In the above embodiment, by adding the corresponding unique index data to the first index information, 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.
在更多实施例中,第一索引信息后面除了可以是唯一索引数据,还可以1,2,3,A,B,C,a,b,c……这样的数据信息,只要能使第一索引信息在数据表中具有唯一性即可,具体的内容不受上述实施例限制。In more embodiments, in addition to the unique index data, the first index information 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.
进一步优选地,当第一数据表中没有唯一索引数据时,为第 一数据表自动配置唯一索引数据,即若数据在数据表中不是唯一的,那么系统将为该数据表自动分配唯一索引数据,如按照序列号1,2,3等数字分配,还可以按照A,B,C等字母分配,还可以是这些数据的任意组合,只要能在表中具有唯一性即可。Further preferably, when there is no unique index data in the first data table, 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.
进一步,唯一索引数据为固定的位数,如果不满足,则在唯一索引数据前补零以满足位数;具体的,如图1所示数据表为例,id下面的数字为1,2,3……等,在kv数据库中,我们设置唯一索引数据的位数为20位,若不够20位,则在前面补零,如1补完以后为00000000000000000001,2为00000000000000000002,……10为00000000000000000010,11为00000000000000000011。Furthermore, 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 00000000000000000002, ... 10 is 00000000000000000010 ,11 is 00000000000000000011.
图5为图2所示方法一优选实施方式的流程图。如图5所示,在一优选实施例中,上述方法还包括:S13、根据若干数据表生成若干数据表的关联表;其中,关联表包括若干数据表的索引数据组合,和索引数据组合在若干数据表中所对应的各唯一索引数据。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.
具体地,如图6所示,以图1所示的用户表(a)和游戏表(b)为例,将用户表中的性别gender和游戏表中的name之间的关系存储在数据库中,关联表(a)的存储方式与图2所示方式一致,在此不再赘述。同理,还可以将图1所示的用户表(a)和游戏表(b)中的其他关系联系起来生成若干其他关联表。Specifically, as shown in Figure 6, taking the user table (a) and game table (b) shown in Figure 1 as an example, the relationship between gender in the user table and name in the game table is stored in the database , The storage mode of the association table (a) is the same as that shown in Fig. 2, and will not be repeated here. In the same way, the user table (a) shown in FIG. 1 and other relations in the game table (b) can also be linked to generate several other association tables.
图7为本发明提供的一种kv数据库查询方法的流程图。如图7所示,一种kv数据库查询方法,该数据库是通过图4所示的方法生成的,该方法适用于单表查询,其特征在于,该方法包括:Fig. 7 is a flowchart of a kv database query method provided by the present invention. As shown in Fig. 7, 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、根据第一信息查询内容信息生成第一查询索引数据,判断第一查询索引数据是否与唯一索引数据相同: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:
是,则根据唯一索引数据存储区查询以生成查询结果;If yes, query based on the unique index data storage area to generate query results;
否,则根据第一查询索引数据在索引存储区查询以生成查询结果。If not, query the index storage area according to the first query index data to generate the query result.
具体地,如需要查询Lucy的所有数据,则构造第一查询索引数据:name:Lucy,判断该数据是否为唯一索引数据,不是,则 通过该第一查询索引数据name:Lucy到索引存储区查找,查询路径为name:Lucy:primaryid:1→primaryid:1,获取到primaryid:1后,到数据存储区中获取关于Lucy的所有数据(Lucy,abc,女)。如需要查询id为1的所有数据,则根据查询数据构造第一查询索引数据后,判断出该数据为唯一索引数据,则直接通过该数据到数据存储区中查询,查询路径为primaryid:1→Lucy,abc,女。Specifically, if you need to query all data of Lucy, construct the first query index data: name: Lucy, and determine whether the data is unique index data, if not, use the first query index data name: Lucy to search the index storage area , 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.
图8为本发明提供的另一种kv数据库查询方法的流程图。如图8所示,一种kv数据库查询方法,数据库是通过图5所示的方法生成的,该方法适用于关联表查询,其特征在于,该方法包括:Figure 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:
S31、根据第二信息查询内容生成第二查询索引数据,根据第二查询索引数据在关联表中获取若干索引数据;S31. Generate second query index data according to the content of the second information query, and obtain a number of index data in the association table according to the second query index data;
S32、根据各索引数据在对应的各数据表中获取所需要的数据信息。S32: Obtain the required data information in each corresponding data table according to each index data.
具体地,如查询女性中玩游戏1的相关数据信息,如图6所示,根据“女#游戏1”生成第二查询索引数据,并根据对应的key值到索引存储区中获取到对应的value值,并获取primaryuserid:1,然后根据primaryuserid:1查询到game:a,然后根据game:a到游戏表(图1b)的kv数据库中查询所需要的数据。Specifically, such as querying the relevant data information of playing game 1 among women, as shown in Figure 6, 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.
图9为本发明一实施例提供的一种设备的结构示意图。FIG. 9 is a schematic structural diagram of a device provided by an embodiment of the present invention.
如图7所示,作为另一方面,本申请还提供了一种设备700,包括一个或多个中央处理单元(CPU)701,其可以根据存储在只读存储器(ROM)702中的程序或者从存储部分708加载到随机访问存储器(RAM)703中的程序而执行各种适当的动作和处理。在RAM703中,还存储有设备700操作所需的各种程序和数据。CPU701、ROM702以及RAM703通过总线704彼此相连。输入/输出(I/O)接口705也连接至总线704。As shown in Figure 7, as another aspect, 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.
以下部件连接至I/O接口705:包括键盘、鼠标等的输入部分 706;包括诸如阴极射线管(CRT)、液晶显示器(LCD)等以及扬声器等的输出部分707;包括硬盘等的存储部分708;以及包括诸如LAN卡、调制解调器等的网络接口卡的通信部分709。通信部分709经由诸如因特网的网络执行通信处理。驱动器710也根据需要连接至I/O接口705。可拆卸介质711,诸如磁盘、光盘、磁光盘、半导体存储器等等,根据需要安装在驱动器710上,以便于从其上读出的计算机程序根据需要被安装入存储部分708。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.
特别地,根据本公开的实施例,上述任一实施例描述的kv数据库配置方法和查询方法可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括有形地包含在机器可读介质上的计算机程序,所述计算机程序包含用于执行kv数据库配置方法和查询方法的程序代码。在这样的实施例中,该计算机程序可以通过通信部分709从网络上被下载和安装,和/或从可拆卸介质711被安装。In particular, according to the embodiments of the present disclosure, the kv database configuration method and query method described in any of the above embodiments can be implemented as a computer software program. For example, 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. In such an embodiment, the computer program may be downloaded and installed from the network through the communication part 709, and/or installed from the removable medium 711.
作为又一方面,本申请还提供了一种计算机可读存储介质,该计算机可读存储介质可以是上述实施例的装置中所包含的计算机可读存储介质;也可以是单独存在,未装配入设备中的计算机可读存储介质。计算机可读存储介质存储有一个或者一个以上程序,该程序被一个或者一个以上的处理器用来执行描述于本申请的kv数据库配置方法和查询方法。As yet another aspect, 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.
附图中的流程图和框图,图示了按照本发明各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这根据所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以通过执行规定 的功能或操作的专用的基于硬件的系统来实现,或者可以通过专用硬件与计算机指令的组合来实现。The flowcharts and block diagrams in the accompanying drawings illustrate the possible implementation architecture, functions, and operations of the system, method, and computer program product according to various embodiments of the present invention. In this regard, 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. It should also be noted that, in some alternative implementations, 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. It should also be noted that 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. For example, 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. Among them, the names of these units or modules do not constitute a limitation on the units or modules themselves under certain circumstances.
以上描述仅为本申请的较佳实施例以及对所运用技术原理的说明。本领域技术人员应当理解,本申请中所涉及的发明范围,并不限于上述技术特征的特定组合而成的技术方案,同时也应涵盖在不脱离本申请构思的情况下,由上述技术特征或其等同特征进行任意组合而形成的其它技术方案。例如上述特征与本申请中公开的(但不限于)具有类似功能的技术特征进行互相替换而形成的技术方案。The above description is only a preferred embodiment of the application and an explanation of the applied technical principles. Those skilled in the art should understand that the scope of the invention involved in this application is not limited to the technical solutions formed by the specific combination of the above technical features, and should also cover the above technical features or technical solutions without departing from the concept of the application. Other technical solutions formed by any combination of its equivalent features. For example, the above-mentioned features and the technical features disclosed in this application (but not limited to) with similar functions are mutually replaced to form a technical solution.

Claims (9)

  1. 一种KV数据库配置方法,其特征在于,包括:A KV database configuration method is characterized in that it includes:
    将第一数据表的唯一索引数据作为key值、若干普通索引数据作为value值,将所述第一数据表存储到数据存储区中;Using the unique index data of the first data table as the key value and several ordinary index data as the value value, and storing the first data table in the data storage area;
    将根据所述第一数据表中的第一数据生成的第一索引信息作为key值、将所述第一数据的唯一索引数据作为value值,生成若干索引数据对并存储到索引存储区中;Using the first index information generated according to the first data in the first data table as a key value, and using the unique index data of the first data as a value value, generating several index data pairs and storing them in the index storage area;
    其中,所述第一索引信息包括第一索引的名称、所述第一数据中所述第一索引的索引数据。Wherein, the first index information includes the name of the first index, and index data of the first index in the first data.
  2. 根据权利要求1所述的方法,其特征在于,所述第一索引信息还包括所述第一数据的唯一索引数据。The method according to claim 1, wherein the first index information further includes unique index data of the first data.
  3. 根据权利要求1或2所述的方法,其特征在于,所述第一数据表中没有所述唯一索引数据时,为所述第一数据表自动配置所述唯一索引数据。The method according to claim 1 or 2, wherein when the unique index data is not in the first data table, the unique index data is automatically configured for the first data table.
  4. 根据权利要求3所述的方法,其特征在于,根据权利要求1或2所述的方法,其特征在于,所述唯一索引数据为固定的位数,如果不满足,则在所述唯一索引数据前补零以满足位数。The method according to claim 3, characterized in that, the method according to claim 1 or 2, characterized in that the unique index data is a fixed number of bits, if not satisfied, the unique index data Padded zeros to meet the number of digits.
  5. 根据权利要求4所述的方法,其特征在于,还包括:The method according to claim 4, further comprising:
    根据若干数据表生成所述若干数据表的关联表;其中,所述关联表包括所述若干数据表的索引数据组合,和所述索引数据组合在所述若干数据表中所对应的各唯一索引数据。The association table of the several data tables is generated according to the several data tables; wherein the association table includes the index data combination of the several data tables, and each unique index corresponding to the index data combination in the several data tables data.
  6. 一种kv数据库查询方法,所述方法基于按照权利要求2所述方法配置的kv数据库,所述方法适用于单表查询,其特征在于,所述方法包括:A kv database query method, the method is based on the kv database configured according to the method of claim 2, the method is suitable for single-table query, and is characterized in that the method includes:
    根据第一信息查询内容信息生成第一查询索引数据,判断所述第一查询索引数据是否与唯一索引数据相同: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:
    是,则根据所述唯一索引数据存储区查询以生成查询结果;If yes, query according to the unique index data storage area to generate query results;
    否,则根据所述第一查询索引数据在索引存储区查询以生成查询结果。If not, query the index storage area according to the first query index data to generate a query result.
  7. 一种kv数据库查询方法,所述方法基于按照权利要求5所述方法生成的kv数据库,所述方法适用于关联表查询,其特征在于,所述方法包括:A method for querying a kv database, the method is based on a kv database generated according to the method of claim 5, and the method is suitable for querying an association table, wherein the method includes:
    根据第二信息查询内容生成第二查询索引数据,根据所述第二查询索引数据在所述关联表中获取若干索引数据;Generate second query index data according to the content of the second information query, and obtain a number of index data in the association table according to the second query index data;
    根据各所述索引数据在对应的各数据表中获取所需要的数据信息。According to the index data, the required data information is obtained from the corresponding data tables.
  8. 一种设备,其特征在于,所述设备包括:A device, characterized in that the device includes:
    一个或多个处理器;One or more processors;
    存储器,用于存储一个或多个程序,Memory, used to store one or more programs,
    当所述一个或多个程序被所述一个或多个处理器执行时,使得所述一个或多个处理器执行如权利要求1-7中任一项所述的方法。When the one or more programs are executed by the one or more processors, the one or more processors are caused to execute the method according to any one of claims 1-7.
  9. 一种存储有计算机程序的存储介质,其特征在于,该程序被处理器执行时实现如权利要求1-7中任一项所述的方法。A storage medium storing a computer program, wherein the program is executed by a processor to implement the method according to any one of claims 1-7.
PCT/CN2020/087827 2019-05-31 2020-04-29 Kv database configuration method, query method, device and storage medium WO2020238546A1 (en)

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 (en) 2019-05-31 2019-05-31 A kind of KV configuration method for database, querying method, equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2020238546A1 true WO2020238546A1 (en) 2020-12-03

Family

ID=67696189

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2020/087827 WO2020238546A1 (en) 2019-05-31 2020-04-29 Kv database configuration method, query method, device and storage medium

Country Status (3)

Country Link
US (1) US20220374406A1 (en)
CN (1) CN110175176A (en)
WO (1) WO2020238546A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114327268A (en) * 2021-12-27 2022-04-12 北京云思智学科技有限公司 Self-adaptive protection method and device applied to KV storage and storage medium

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110175176A (en) * 2019-05-31 2019-08-27 杭州复杂美科技有限公司 A kind of KV configuration method for database, querying method, equipment and storage medium
CN111552710B (en) * 2020-04-28 2023-07-04 电子科技大学 Query optimization method for distributed database

Citations (5)

* Cited by examiner, † Cited by third party
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 (en) * 2016-09-20 2017-03-15 福建天晴数码有限公司 It is suitable for KV data bases and its creation method of SQL query method
CN108062384A (en) * 2017-12-13 2018-05-22 阿里巴巴集团控股有限公司 The method and apparatus of data retrieval
CN108446363A (en) * 2018-03-13 2018-08-24 北京奇安信科技有限公司 A kind of data processing method and device of KV engines
CN110175176A (en) * 2019-05-31 2019-08-27 杭州复杂美科技有限公司 A kind of KV configuration method for database, querying method, equipment and storage medium

Family Cites Families (14)

* Cited by examiner, † Cited by third party
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 (en) * 2012-11-15 2017-04-12 阿里巴巴集团控股有限公司 information persistence and query method and device
CN103902698B (en) * 2014-03-31 2018-04-13 北京皮尔布莱尼软件有限公司 A kind of data-storage system and storage method
CN105005572A (en) * 2014-04-24 2015-10-28 中国移动通信集团云南有限公司 Database mapping method and device
CN105488043B (en) * 2014-09-15 2019-03-26 南京理工大学 Data query method and system based on Key-Value data block
CN104750809B (en) * 2015-03-26 2018-05-18 中国科学院软件研究所 A kind of blended data storage method for supporting relational model and key-value structure
CN107515882B (en) * 2016-06-17 2020-12-25 阿里巴巴集团控股有限公司 Data query method and device
CN107870935A (en) * 2016-09-27 2018-04-03 新华三技术有限公司 A kind of searching method and device
CN106776955A (en) * 2016-12-02 2017-05-31 北京中交兴路车联网科技有限公司 A kind of method and device of data storage and search
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

Patent Citations (5)

* Cited by examiner, † Cited by third party
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 (en) * 2016-09-20 2017-03-15 福建天晴数码有限公司 It is suitable for KV data bases and its creation method of SQL query method
CN108062384A (en) * 2017-12-13 2018-05-22 阿里巴巴集团控股有限公司 The method and apparatus of data retrieval
CN108446363A (en) * 2018-03-13 2018-08-24 北京奇安信科技有限公司 A kind of data processing method and device of KV engines
CN110175176A (en) * 2019-05-31 2019-08-27 杭州复杂美科技有限公司 A kind of KV configuration method for database, querying method, equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114327268A (en) * 2021-12-27 2022-04-12 北京云思智学科技有限公司 Self-adaptive protection method and device applied to KV storage and storage medium

Also Published As

Publication number Publication date
CN110175176A (en) 2019-08-27
US20220374406A1 (en) 2022-11-24

Similar Documents

Publication Publication Date Title
WO2020238546A1 (en) Kv database configuration method, query method, device and storage medium
WO2019128318A1 (en) Data processing method, apparatus and system
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
Kanade et al. A study of normalization and embedding in MongoDB
TWI745702B (en) Data query method, device, electronic equipment and computer readable storage medium
Wu et al. Comparisons between mongodb and ms-sql databases on the twc website
WO2019205790A1 (en) Data operating method and device
US11720543B2 (en) Enforcing path consistency in graph database path query evaluation
US20230161765A1 (en) System and method for disjunctive joins using a lookup table
US8589451B1 (en) Systems and methods for generating a common data model for relational and object oriented databases
WO2020215830A1 (en) Method for outer join of table of database, and system
WO2016112502A1 (en) Method, apparatus and computing device for storing query result
CN109614411B (en) Data storage method, device and storage medium
CN108874873B (en) Data query method, device, storage medium and processor
GB2516501A (en) Method and system for processing data in a parallel database environment
Cai et al. Effective temporal dependence discovery in time series data
US11615086B2 (en) System and method for disjunctive joins
JP2011113103A (en) Multi-tenant type computer system
Gupta et al. Correlation and comparison of nosql specimen with relational data store
US20240070136A1 (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
US20240070133A1 (en) Storing and querying knowledge graphs in column stores
US11550793B1 (en) Systems and methods for spilling data for hash joins
US11928087B2 (en) Accessing schema-flexible data by applying a fixed schema

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