WO2016169322A1 - 数据库的查询方法和装置、计算机存储介质 - Google Patents

数据库的查询方法和装置、计算机存储介质 Download PDF

Info

Publication number
WO2016169322A1
WO2016169322A1 PCT/CN2016/073754 CN2016073754W WO2016169322A1 WO 2016169322 A1 WO2016169322 A1 WO 2016169322A1 CN 2016073754 W CN2016073754 W CN 2016073754W WO 2016169322 A1 WO2016169322 A1 WO 2016169322A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
sub
processed
queried
database
Prior art date
Application number
PCT/CN2016/073754
Other languages
English (en)
French (fr)
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 中兴通讯股份有限公司
Publication of WO2016169322A1 publication Critical patent/WO2016169322A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • 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/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • G06F16/24535Query rewriting; Transformation of sub-queries or views

Definitions

  • the invention relates to a query technology of a database, in particular to a query method and device for a database, and a computer storage medium.
  • the database has been used in many fields, and the performance of database queries is directly related to the response speed and user experience.
  • the content is organized and stored in a field according to the business, thereby causing a large amount of data in the field, thereby causing inefficiency in querying the field.
  • the cost is large.
  • full-text indexing is often used to improve the query performance of the database.
  • full-text indexing takes up a lot of space, and support for full-text indexing is not ideal for different database engines, and index and data cannot be synchronized in real time.
  • a table there is a big data field that stores an article, or stores some data assembled by business. If the full-text index is established on this field, although the query efficiency can be improved, if the field is added, deleted, and modified, it will be more frequent.
  • function indexing in view of stability, not all databases support function indexes.
  • the embodiments of the present invention are expected to provide a database query method and device, and a computer storage medium, which not only improve query performance, but also have high stability, and can ensure real-time synchronization of indexes and data.
  • an embodiment of the present invention provides a method for querying a database, where the method includes:
  • the data to be processed is split according to the structural rule that the data to be processed is obtained, and the position of the sub-data and the sub-data in the to-be-processed data is obtained, including:
  • the method further includes:
  • the method further includes:
  • the obtaining the location of the to-be-queried data in the to-be-processed data from the location of the sub-data and the sub-data in the to-be-processed data includes:
  • an embodiment of the present invention provides a query device for a database, where the device includes: a splitting unit, a receiving unit, and an acquiring unit, where
  • the splitting unit is configured to treat the standby according to a structural rule that is to be processed by the data to be processed
  • the data is split to obtain sub-data and the position of the sub-data in the to-be-processed data;
  • the receiving unit is configured to receive data to be queried
  • the acquiring unit is configured to acquire, from the sub-data and the location of the sub-data in the to-be-processed data, a location of the to-be-queried data in the to-be-processed data.
  • the splitting unit is further configured to:
  • the to-be-processed data is split into at least two sub-data according to the delimiter, and positions of the sub-data in the to-be-processed data are respectively acquired.
  • the device further includes a setting unit configured to: when the data to be processed does not have a delimiter, set a delimiter in the to-be-processed data according to a preset setting policy, to obtain an updated waiting Data processing.
  • the apparatus further includes a saving unit configured to save the sub data and the location of the sub data in the to-be-processed data in a new data table;
  • the obtaining unit is further configured to:
  • an embodiment of the present invention provides a computer storage medium, where the computer storage medium stores executable instructions, and the executable instructions are configured to execute the query method of the database.
  • the embodiment of the invention provides a method and device for querying a database, and a computer storage medium, which is split according to the structural rules satisfied by the data to be processed, and saves the split subdata and the corresponding primary key, and the primary key is configured.
  • a computer storage medium which is split according to the structural rules satisfied by the data to be processed, and saves the split subdata and the corresponding primary key, and the primary key is configured.
  • Pending data The location in . Not only improve query performance, high stability, but also ensure real-time synchronization of indexes and data.
  • FIG. 1 is a schematic flowchart of a method for querying a database according to an embodiment of the present invention
  • FIG. 2 is a schematic structural diagram of a database query apparatus according to an embodiment of the present invention.
  • FIG. 3 is a schematic structural diagram of another database query apparatus according to an embodiment of the present invention.
  • the splitting is performed according to the structural rule that the data to be processed satisfies, and the split sub-data and the corresponding primary key are saved, and the primary key is used to indicate the position of the sub-data in the data to be processed;
  • the split sub-data can be queried, and the position of the to-be-queried data in the to-be-processed data is obtained according to the primary key corresponding to the sub-data obtained by the query. Not only improve query performance, high stability, but also ensure real-time synchronization of indexes and data.
  • FIG. 1 a flow of a query method of a database provided by an embodiment of the present invention is shown.
  • the method may be applied to a database, and the method may include:
  • the database splits the data to be processed according to the structural rule that the data to be processed satisfies, and obtains the location of the subdata and the subdata in the to-be-processed data.
  • the database described in the embodiment of the present invention is implemented in a physical layer by a cluster of servers or servers.
  • some servers in the cluster of the server are implemented as storage servers, and some servers are implemented as access servers, and the memory is processed (such as reading).
  • this step may specifically include:
  • the database acquires a separator in the to-be-processed data
  • the database splits the to-be-processed data into at least two sub-data according to the delimiter, and separately acquires a position of the sub-data in the to-be-processed data.
  • the method further includes:
  • the database sets a separator in the to-be-processed data according to a preset setting policy, and obtains updated data to be processed.
  • the data to be processed may be a field in which a big data is stored in the data table, or a record of a big data in the field; the structural rule may be an obvious separation feature in the data to be processed,
  • the embodiment of the invention is not specifically limited thereto.
  • the field A (A 1 , A 2 , A 3 , . . . , A n ) is taken as an example, where n is the number of the data block in the field, and a comma is used between each data block in the field. "Delimited, so the comma ",” is the separator in the field. Then the structure rule that the field A satisfies is that there is a separator between each data block in the field and the separator is a comma ",".
  • the structural rules in this embodiment may also be other distinct separation features, such as line breaks, indent symbols, and the like.
  • the database can obtain the comma "," in field A, and then can split field A into A according to the comma "," in field A. 1 , A 2 , A 3 , . . . , A n sub-data, and respectively can obtain the position of the sub-data in the field A; it can be understood that the position of the sub-data in the field A can be corresponding to the sub-data Primary key.
  • the database can set a separator in the field A according to a preset setting policy, so that the database can set the new pending data after the separator is set according to the set.
  • the separator is split to obtain the sub-data and the position of the sub-data in the field A.
  • the database may further set a new data table to store the sub-data and the position of the sub-data in the field A. Then, after the database obtains the sub-data and the position of the sub-data in the to-be-processed data, the Subdata and the subdata in the to-be-processed data The location is saved in the new data table.
  • the database pre-sets the new data table, splits the field A, and saves the split sub-data and the position of the sub-data in the data to be processed to a specific implementation form in the new data table.
  • SQL Structured Query Language
  • function split_str (p_string in varchar2,p_delimiter in Varchar2) represents a function in which the database pre-sets a new data table, splits the field A, and saves the split sub-data and the position of the sub-data in the pending data to the new data table;
  • p_string and p_delimiter are Two input parameters, the former is the data to be processed, the latter is the separation feature in the data to be processed;
  • the plit_table is the return value, which is used to return the new data table after the sub data and the position of the sub data in the data to be processed are saved.
  • the data type of the return value can be set by the SQL statement "create or replace type split_table as table of varchar2(4000);", wherein split_table is a newly created data type, and this embodiment is preferably defined as the data table type length is 4000, the type of the content in the table is varchar2 variable length type; Pipelined is a pipeline function, the result returned is a collection; pipe row () statement returns each row of data in the data to be processed.
  • step S101 Through the above-described program segment, the specific process in step S101 can be realized.
  • S102 The database receives the data to be queried.
  • S103 The database acquires the location of the to-be-queried data in the to-be-processed data from the sub-data and the location of the sub-data in the to-be-processed data.
  • step S103 may specifically include:
  • the database queries the new data table according to the to-be-queried data
  • step S103 the specific implementation process of the step S103 is a common technical means for those skilled in the art, and the embodiment is not described herein.
  • the embodiment of the present invention provides a query method for a database, which is split according to a structural rule that is to be processed, and saves the split sub-data and the corresponding primary key, and the primary key is used to indicate that the sub-data is waiting for Processing the position in the data; thus, when the database query is performed on the query data, the sub-data after the splitting can be queried, and the sub-data obtained according to the query can be obtained.
  • the primary key corresponding to the data obtains the location of the data to be queried in the data to be processed. Not only improve query performance, high stability, but also ensure real-time synchronization of indexes and data.
  • a query device 20 for a database provided by an embodiment of the present invention is shown.
  • the device 20 can be applied to a database, and the database can be implemented by a cluster of servers or servers.
  • the querying device 20 may be implemented by a device independent of a database, such as a server or a server cluster.
  • the query device 20 establishes a data connection with the database through a cable, an optical cable, or the like.
  • each functional unit in the query device 20 may be A processor (e.g., a central processing unit) in a database independent device executes instruction implementations stored in a computer storage medium.
  • the querying device 20 may be implemented by a device independent of a database, such as a server or a server cluster.
  • the query device 20 establishes a data connection with the database through a cable, an optical cable, or the like.
  • each functional unit in the query device 20 may be A server (or central processor) in a server or server cluster hosting a database executes instruction implementations stored in a computer storage medium.
  • the querying device 20 may include: a splitting unit 201, a receiving unit 202, and an obtaining unit 203, where
  • the splitting unit 201 is configured to split the data to be processed according to the structural rule that the data to be processed satisfies, and obtain the position of the child data and the child data in the data to be processed;
  • the receiving unit 202 is configured to receive data to be queried
  • the obtaining unit 203 is configured to obtain, from the sub data and the position of the sub data in the data to be processed, the location of the data to be queried in the data to be processed.
  • the splitting unit 201 is further configured to: obtain a separator in the data to be processed;
  • the data to be processed is split into at least two sub-data according to the delimiter, and the position of the sub-data in the data to be processed is respectively obtained.
  • the apparatus 20 further includes a setting unit 204 configured to be processed When there is no delimiter in the data, the delimiter is set in the data to be processed according to the preset setting policy, and the updated data to be processed is obtained.
  • the apparatus 20 further includes a saving unit 205 configured to save the sub data and the location of the sub data in the to-be-processed data in the new data table;
  • the obtaining unit 203 is further configured to:
  • the location of the sub-data matching the data to be queried in the data to be processed is obtained.
  • the embodiment of the present invention provides a query device for a database, which is split according to the structural rule that the data to be processed is satisfied, and saves the split sub-data and the corresponding primary key, and the primary key is used to indicate that the sub-data is waiting Processing the position in the data; so that when the database query is performed on the query data, the sub-data after the splitting may be queried, and the position of the data to be queried in the data to be queried is obtained according to the primary key corresponding to the sub-data obtained by the query. . Not only improve query performance, high stability, but also ensure real-time synchronization of indexes and data.
  • the embodiment of the invention further provides a computer storage medium, which may be a ROM (for example, a read only memory, a FLASH memory, a transfer device, etc.), a magnetic storage medium (for example, a magnetic tape, a disk drive, etc.), an optical storage medium (for example, a CD).
  • ROM read only memory
  • FLASH memory FLASH memory
  • magnetic storage medium for example, a magnetic tape, a disk drive, etc.
  • an optical storage medium for example, a CD.
  • computer-readable medium storing computer-executable instructions that, when executed, cause at least one processor to perform the operations shown in FIG.
  • the query method of the database may be a ROM (for example, a read only memory, a FLASH memory, a transfer device, etc.), a magnetic storage medium (for example, a magnetic tape, a disk drive, etc.), an optical storage medium (for example, a CD).
  • embodiments of the present invention can be provided as a method, system, or computer program product. Accordingly, the present invention can take the form of a hardware embodiment, a software embodiment, or a combination of software and hardware. Moreover, the invention can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) including computer usable program code.
  • the computer program instructions can also be stored in a computer readable memory that can direct a computer or other programmable data processing device to operate in a particular manner, such that the instructions stored in the computer readable memory produce an article of manufacture comprising the instruction device.
  • the apparatus implements the functions specified in one or more blocks of a flow or a flow and/or block diagram of the flowchart.
  • These computer program instructions can also be loaded onto a computer or other programmable data processing device such that a series of operational steps are performed on a computer or other programmable device to produce computer-implemented processing for execution on a computer or other programmable device.
  • the instructions provide steps for implementing the functions specified in one or more of the flow or in a block or blocks of a flow diagram.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种数据库的查询方法和装置、计算机存储介质,方法包括:数据库根据待处理数据所满足的结构规则对所述待处理数据进行拆分,得到子数据以及子数据在所述待处理数据中的位置(S101);所述数据库接收待查询数据(S102);所述数据库从所述子数据以及所述子数据在所述待处理数据中的位置获取所述待查询数据在所述待处理数据中的位置(S103)。

Description

数据库的查询方法和装置、计算机存储介质 技术领域
本发明涉及数据库的查询技术,尤其涉及一种数据库的查询方法和装置、计算机存储介质。
背景技术
数据库已经运用在很多领域当中,对于数据库查询的性能也直接关系着响应速度和用户的体验。当前,在对数据库进行设计的时候,通常为了保持数据的完整性,会按业务把内容组织起来存储在一个字段,从而造成字段的数据量较大,从而造成对该字段进行查询的效率低,开销大。
目前,通常采用建立全文索引来提高数据库的查询性能。但是,全文索引会占用大量空间,而且对于不同的数据库引擎对全文索引的支持不理想,并且无法保证索引和数据实时同步。例如在某个表里面有一个大数据字段存储了一篇文章,或者是存储了一些按业务组装的数据。如果在该字段上建立了全文索引,虽然能够查询效率可以提升,但是如果对该字段进行增加、删除和修改操作会比较频繁。虽然有的数据库可以通过函数索引来解决,但是考虑到稳定性并不是所有的数据库都支持函数索引。
发明内容
本发明实施例期望提供一种数据库的查询方法和装置、计算机存储介质,不仅提升了查询性能,稳定性高,能够保证索引和数据的实时同步。
本发明实施例的技术方案是这样实现的:
第一方面,本发明实施例提供一种数据库的查询方法,所述方法包括:
根据待处理数据所满足的结构规则对所述待处理数据进行拆分,得到 子数据以及子数据在所述待处理数据中的位置;
接收待查询数据;
从所述子数据以及所述子数据在所述待处理数据中的位置获取所述待查询数据在所述待处理数据中的位置。
在上述方案中,所述根据待处理数据所满足的结构规则对所述待处理数据进行拆分,得到子数据以及子数据在所述待处理数据中的位置,包括:
获取所述待处理数据中的分隔符;
根据所述分隔符将所述待处理数据拆分成至少两个子数据,并分别获取所述子数据在所述待处理数据中的位置。
在上述方案中,当所述待处理数据中不具有分隔符时,所述方法还包括:
根据预设的设置策略在所述待处理数据中设置分隔符,得到更新后的待处理数据。
在上述方案中,在得到所述子数据以及所述子数据在所述待处理数据中的位置之后,所述方法还包括:
将所述子数据以及所述子数据在所述待处理数据中的位置保存在新数据表中;
相应地,所述从所述子数据以及所述子数据在所述待处理数据中的位置获取所述待查询数据在所述待处理数据中的位置,具体包括:
根据所述待查询数据查询所述新数据表;
当所述新数据表中的子数据与所述待查询数据匹配时,获取与所述待查询数据匹配的子数据在所述待处理数据中的位置。
第二方面,本发明实施例提供一种数据库的查询装置,所述装置包括:拆分单元、接收单元和获取单元,其中,
所述拆分单元,配置为根据待处理数据所满足的结构规则对所述待处 理数据进行拆分,得到子数据以及子数据在所述待处理数据中的位置;
所述接收单元,配置为接收待查询数据;
所述获取单元,配置为从所述子数据以及所述子数据在所述待处理数据中的位置获取所述待查询数据在所述待处理数据中的位置。
在上述方案中,所述拆分单元,还配置为:
获取所述待处理数据中的分隔符;
以及,根据所述分隔符将所述待处理数据拆分成至少两个子数据,并分别获取所述子数据在所述待处理数据中的位置。
在上述方案中,所述装置还包括设置单元,配置为当所述待处理数据中不具有分隔符时,根据预设的设置策略在所述待处理数据中设置分隔符,得到更新后的待处理数据。
在上述方案中,所述装置还包括保存单元,配置为将所述子数据以及所述子数据在所述待处理数据中的位置保存在新数据表中;
相应地,所述获取单元,还配置为:
根据所述待查询数据查询所述新数据表;以及,
当所述新数据表中的子数据与所述待查询数据匹配时,获取与所述待查询数据匹配的子数据在所述待处理数据中的位置。
第三方面,本发明实施例提供一种计算机存储介质,所述计算机存储介质中存储有可执行指令,所述可执行指令配置为执行上述的数据库的查询方法。
本发明实施例提供了一种数据库的查询方法和装置、计算机存储介质,根据待处理数据所满足的结构规则进行拆分,并将拆分后的子数据及对应的主键进行保存,该主键配置为表示子数据在待处理数据中的位置;从而使得对待查询数据进行数据库查询时,可以通过对拆分后的子数据进行查询,并根据查询得到的子数据所对应的主键获取待查询数据在待处理数据 中的位置。不仅提升了查询性能,稳定性高,能够保证索引和数据的实时同步。
附图说明
图1为本发明实施例提供的一种数据库的查询方法流程示意图;
图2为本发明实施例提供的一种数据库的查询装置结构示意图;
图3为本发明实施例提供的另一种数据库的查询装置结构示意图。
具体实施方式
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述。
本发明实施例中,根据待处理数据所满足的结构规则进行拆分,并将拆分后的子数据及对应的主键进行保存,该主键用于表示子数据在待处理数据中的位置;从而使得对待查询数据进行数据库查询时,可以通过对拆分后的子数据进行查询,并根据查询得到的子数据所对应的主键获取待查询数据在待处理数据中的位置。不仅提升了查询性能,稳定性高,能够保证索引和数据的实时同步。
基于上述的基本思想,参见图1,其示出了本发明实施例提供的一种数据库的查询方法流程,该方法可以应用于数据库中,该方法可以包括:
S101:数据库根据待处理数据所满足的结构规则对待处理数据进行拆分,得到子数据以及子数据在待处理数据中的位置。
本发明实施例记载的数据库在物理层由服务器或服务器的集群实现,可选地,在服务器的集群中部分服务器实施为存储服务器,部分服务器实施为访问服务器,提供对存储器进行处理(如读取数据、修改数据或写入数据)的功能。
示例性地,本步骤具体可以包括:
所述数据库获取所述待处理数据中的分隔符;
所述数据库根据所述分隔符将所述待处理数据拆分成至少两个子数据,并分别获取所述子数据在所述待处理数据中的位置。
可选地,当所述待处理数据中不具有分隔符时,所述方法还包括:
所述数据库根据预设的设置策略在所述待处理数据中设置分隔符,得到更新后的待处理数据。
具体来说,待处理数据可以是数据表中的一个存储了大数据的字段,也可以是字段中的一条大数据的记录;结构规则可以是待处理数据中所具有的明显的分隔特征,本发明实施例对此不作具体地限定。
本实施例中,以字段A(A1,A2,A3,…,An)为例进行说明,其中,n为字段中数据块的编号,字段中各数据块之间用逗号“,”进行分隔,因此,逗号“,”为字段中的分隔符。那么字段A所满足的结构规则为:字段中的各数据块之间具有分隔符且分隔符为逗号“,”。另外,本实施例中的结构规则还可以是其他明显的分隔特征,例如:换行符、缩进符号等。当字段A中各数据块之间用逗号“,”进行分隔时,那么数据库就可以获取字段A中的逗号“,”,接着可以根据字段A中的逗号“,”将字段A拆分为A1,A2,A3,…,An这n个子数据,并且分别可以获取这些子数据在字段A中的位置;可以理解的,子数据在字段A中的位置可以是子数据所对应的主键。
但是,当字段A中的数据不具有分隔符的时候,数据库可以按照预设的设置策略在字段A设置分隔符,从而使得数据库能够将设置完分隔符后的新的待处理数据根据所设置的分隔符进行拆分处理,得到子数据以及子数据在字段A中的位置。
示例性地,数据库还可以预先设置新数据表来存储子数据以及子数据在字段A中的位置,那么,当数据库得到子数据以及子数据在待处理数据中的位置之后,就可以将所述子数据以及所述子数据在所述待处理数据中 的位置保存在新数据表中。
优选地,对于字段A来说,数据库预先设置新数据表、将字段A进行拆分以及将拆分得到的子数据以及子数据在待处理数据中的位置保存至新数据表中的具体实现形式,可以按照以下结构化查询语言(SQL,Structured Query Language)的程序段进行实现:
Figure PCTCN2016073754-appb-000001
在上面的程序段中,function split_str(p_string in varchar2,p_delimiter in  varchar2)表示数据库预先设置新数据表、将字段A进行拆分以及将拆分得到的子数据以及子数据在待处理数据中的位置保存至新数据表中这一过程的函数;p_string和p_delimiter为两个输入参数,前者是待处理数据,后者是待处理数据里面的分隔特征;plit_table是返回值,用来返回将子数据以及子数据在待处理数据中的位置保存之后的新数据表,该返回值的数据类型可以通过SQL语句“create or replace type split_table as table of varchar2(4000);”进行设置,其中,split_table为新创建的数据类型,本实施例优选地定义为数据表类型长度为4000,表中内容的类型是varchar2可变长度类型;Pipelined是管道函数,返回的结果是一个集合;pipe row()语句返回待处理数据中的每一行数据。
通过上述的程序段,就能够实现步骤S101中的具体过程。
S102:数据库接收待查询数据。
S103:数据库从子数据以及子数据在待处理数据中的位置获取待查询数据在待处理数据中的位置。
需要说明的是,当拆分得到的子数据以及子数据在待处理数据中的位置保存至新数据表中的时候,步骤S103具体可以包括:
所述数据库根据所述待查询数据查询所述新数据表;
当所述新数据表中的子数据与所述待查询数据匹配时,获取与所述待查询数据匹配的子数据在所述待处理数据中的位置。
详细地,步骤S103的具体实现过程对于本领域技术人员来说属于常用的技术手段,本实施例在此不作赘述。
本发明实施例提供了一种数据库的查询方法,根据待处理数据所满足的结构规则进行拆分,并将拆分后的子数据及对应的主键进行保存,该主键用于表示子数据在待处理数据中的位置;从而使得对待查询数据进行数据库查询时,可以通过对拆分后的子数据进行查询,并根据查询得到的子 数据所对应的主键获取待查询数据在待处理数据中的位置。不仅提升了查询性能,稳定性高,能够保证索引和数据的实时同步。
基于前述实施例相同的技术构思,参见图2,其示出了本发明实施例提供的一种数据库的查询装置20,该装置20可以应用于数据库中,数据库可以采用服务器或服务器的集群实现。
可选地,查询装置20可以采用独立于数据库设置的设备,如服务器或服务器集群实现,查询装置20通过电缆、光缆等方式与数据库建立数据连接,相应地,查询装置20中的各功能单元可由独立于数据库的设备中的处理器(如中央处理器)执行存储于计算机存储介质中的指令实现。
可选地,查询装置20可以采用独立于数据库设置的设备,如服务器或服务器集群实现,查询装置20通过电缆、光缆等方式与数据库建立数据连接,相应地,查询装置20中的各功能单元可由承载数据库的服务器或服务器集群中的处理器(如中央处理器)执行存储于计算机存储介质中的指令实现。
查询装置20可以包括:拆分单元201、接收单元202和获取单元203,其中,
拆分单元201,配置为根据待处理数据所满足的结构规则对待处理数据进行拆分,得到子数据以及子数据在待处理数据中的位置;
接收单元202,配置为接收待查询数据;
获取单元203,配置为从子数据以及子数据在待处理数据中的位置获取待查询数据在待处理数据中的位置。
示例性地,拆分单元201,还配置为:获取待处理数据中的分隔符;
以及,根据分隔符将待处理数据拆分成至少两个子数据,并分别获取子数据在待处理数据中的位置。
可选地,参见图3,该装置20还包括设置单元204,配置为当待处理 数据中不具有分隔符时,根据预设的设置策略在待处理数据中设置分隔符,得到更新后的待处理数据。
示例性地,参见图3,该装置20还包括保存单元205,配置为将子数据以及子数据在待处理数据中的位置保存在新数据表中;
相应地,获取单元203,还配置为:
根据待查询数据查询新数据表;以及,
当新数据表中的子数据与待查询数据匹配时,获取与待查询数据匹配的子数据在待处理数据中的位置。
本发明实施例提供了一种数据库的查询装置,根据待处理数据所满足的结构规则进行拆分,并将拆分后的子数据及对应的主键进行保存,该主键用于表示子数据在待处理数据中的位置;从而使得对待查询数据进行数据库查询时,可以通过对拆分后的子数据进行查询,并根据查询得到的子数据所对应的主键获取待查询数据在待处理数据中的位置。不仅提升了查询性能,稳定性高,能够保证索引和数据的实时同步。
本发明实施例还提供一种计算机存储介质,可以为ROM(例如,只读存储器、FLASH存储器、转移装置等)、磁存储介质(例如,磁带、磁盘驱动器等)、光学存储介质(例如,CD-ROM、DVD-ROM、纸卡、纸带等)以及其他熟知类型的程序存储器;计算机可读介质中存储有计算机可执行指令,当执行指令时,引起至少一个处理器执行图1示出的数据库的查询方法。
本领域内的技术人员应明白,本发明的实施例可提供为方法、系统、或计算机程序产品。因此,本发明可采用硬件实施例、软件实施例、或结合软件和硬件方面的实施例的形式。而且,本发明可采用在一个或多个其中包含有计算机可用程序代码的计算机可用存储介质(包括但不限于磁盘存储器和光学存储器等)上实施的计算机程序产品的形式。
本发明是参照根据本发明实施例的方法、设备(系统)、和计算机程序产品的流程图和/或方框图来描述的。应理解可由计算机程序指令实现流程图和/或方框图中的每一流程和/或方框、以及流程图和/或方框图中的流程和/或方框的结合。可提供这些计算机程序指令到通用计算机、专用计算机、嵌入式处理机或其他可编程数据处理设备的处理器以产生一个机器,使得通过计算机或其他可编程数据处理设备的处理器执行的指令产生用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的装置。
这些计算机程序指令也可存储在能引导计算机或其他可编程数据处理设备以特定方式工作的计算机可读存储器中,使得存储在该计算机可读存储器中的指令产生包括指令装置的制造品,该指令装置实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能。
这些计算机程序指令也可装载到计算机或其他可编程数据处理设备上,使得在计算机或其他可编程设备上执行一系列操作步骤以产生计算机实现的处理,从而在计算机或其他可编程设备上执行的指令提供用于实现在流程图一个流程或多个流程和/或方框图一个方框或多个方框中指定的功能的步骤。
以上,仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。

Claims (9)

  1. 一种数据库的查询方法,所述方法包括:
    根据待处理数据所满足的结构规则对所述待处理数据进行拆分,得到子数据以及子数据在所述待处理数据中的位置;
    接收待查询数据;
    从所述子数据以及所述子数据在所述待处理数据中的位置获取所述待查询数据在所述待处理数据中的位置。
  2. 根据权利要求1所述的方法,其中,所述根据待处理数据所满足的结构规则对所述待处理数据进行拆分,得到子数据以及子数据在所述待处理数据中的位置,包括:
    获取所述待处理数据中的分隔符;
    根据所述分隔符将所述待处理数据拆分成至少两个子数据,并分别获取所述子数据在所述待处理数据中的位置。
  3. 根据权利要求2所述的方法,其中,所述方法还包括:
    当所述待处理数据中不具有分隔符时,根据预设的设置策略在所述待处理数据中设置分隔符,得到更新后的待处理数据。
  4. 根据权利要求1所述的方法,其中,所述方法还包括:
    在得到所述子数据以及所述子数据在所述待处理数据中的位置之后,将所述子数据以及所述子数据在所述待处理数据中的位置保存在新数据表中;
    相应地,所述从所述子数据以及所述子数据在所述待处理数据中的位置获取所述待查询数据在所述待处理数据中的位置,包括:
    根据所述待查询数据查询所述新数据表;
    当所述新数据表中的子数据与所述待查询数据匹配时,获取与所述待查询数据匹配的子数据在所述待处理数据中的位置。
  5. 一种数据库的查询装置,所述装置包括:拆分单元、接收单元和获取单元,其中,
    所述拆分单元,配置为根据待处理数据所满足的结构规则对所述待处理数据进行拆分,得到子数据以及子数据在所述待处理数据中的位置;
    所述接收单元,配置为接收待查询数据;
    所述获取单元,配置为从所述子数据以及所述子数据在所述待处理数据中的位置获取所述待查询数据在所述待处理数据中的位置。
  6. 根据权利要求5所述的装置,其中,所述拆分单元,还配置为:
    获取所述待处理数据中的分隔符;
    以及,根据所述分隔符将所述待处理数据拆分成至少两个子数据,并分别获取所述子数据在所述待处理数据中的位置。
  7. 根据权利要求6所述的装置,其中,所述装置还包括设置单元,配置为当所述待处理数据中不具有分隔符时,根据预设的设置策略在所述待处理数据中设置分隔符,得到更新后的待处理数据。
  8. 根据权利要求5所述的装置,其中,所述装置还包括保存单元,配置为将所述子数据以及所述子数据在所述待处理数据中的位置保存在新数据表中;
    相应地,所述获取单元,还配置为:
    根据所述待查询数据查询所述新数据表;以及,
    当所述新数据表中的子数据与所述待查询数据匹配时,获取与所述待查询数据匹配的子数据在所述待处理数据中的位置。
  9. 一种计算机存储介质,所述计算机存储介质中存储有可执行指令,所述可执行指令用于执行权利要求1至4任一项所述的数据库的查询方法。
PCT/CN2016/073754 2015-04-22 2016-02-14 数据库的查询方法和装置、计算机存储介质 WO2016169322A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201510194014.6A CN106156197A (zh) 2015-04-22 2015-04-22 一种数据库的查询方法和装置
CN201510194014.6 2015-04-22

Publications (1)

Publication Number Publication Date
WO2016169322A1 true WO2016169322A1 (zh) 2016-10-27

Family

ID=57143698

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/073754 WO2016169322A1 (zh) 2015-04-22 2016-02-14 数据库的查询方法和装置、计算机存储介质

Country Status (2)

Country Link
CN (1) CN106156197A (zh)
WO (1) WO2016169322A1 (zh)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109587565A (zh) * 2017-09-29 2019-04-05 北京国双科技有限公司 一种收视数据的统计方法及装置
CN108230166A (zh) * 2018-01-22 2018-06-29 中国平安人寿保险股份有限公司 一种豁免保费的计算方法、存储介质及终端设备
CN109086307B (zh) * 2018-06-22 2020-04-14 阿里巴巴集团控股有限公司 文件处理的方法及装置

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103473237A (zh) * 2012-06-08 2013-12-25 苏州雄立科技有限公司 键值分组方法
CN103631912A (zh) * 2013-11-28 2014-03-12 清华大学 一种利用非关系数据库存储海量工业设备监测数据的方法
CN104142958A (zh) * 2013-05-10 2014-11-12 华为技术有限公司 一种键值对系统中数据的存储方法和相关装置
CN104268280A (zh) * 2014-10-17 2015-01-07 中国人民解放军国防科学技术大学 一种基于键值数据库的层次化存储与查询方法
CN104331453A (zh) * 2014-10-30 2015-02-04 北京思特奇信息技术股份有限公司 一种分布式文件系统及分布式文件系统的构建方法
US20150106380A1 (en) * 2013-10-15 2015-04-16 Naver Corporation Database managing method, database managing system, and database tree structure

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103473237A (zh) * 2012-06-08 2013-12-25 苏州雄立科技有限公司 键值分组方法
CN104142958A (zh) * 2013-05-10 2014-11-12 华为技术有限公司 一种键值对系统中数据的存储方法和相关装置
US20150106380A1 (en) * 2013-10-15 2015-04-16 Naver Corporation Database managing method, database managing system, and database tree structure
CN103631912A (zh) * 2013-11-28 2014-03-12 清华大学 一种利用非关系数据库存储海量工业设备监测数据的方法
CN104268280A (zh) * 2014-10-17 2015-01-07 中国人民解放军国防科学技术大学 一种基于键值数据库的层次化存储与查询方法
CN104331453A (zh) * 2014-10-30 2015-02-04 北京思特奇信息技术股份有限公司 一种分布式文件系统及分布式文件系统的构建方法

Also Published As

Publication number Publication date
CN106156197A (zh) 2016-11-23

Similar Documents

Publication Publication Date Title
Parker et al. Comparing nosql mongodb to an sql db
WO2015106711A1 (zh) 一种为半结构化数据构建NoSQL数据库索引的方法及装置
JP6964384B2 (ja) 異種データソース混在環境におけるフィールド間の関係性の自動的発見のための方法、プログラム、および、システム
US7991767B2 (en) Method for providing a shared search index in a peer to peer network
US11347742B2 (en) Querying across a composite join of multiple database tables using a search engine index
JP2016189214A5 (zh)
JP2017076417A5 (zh)
WO2017065885A1 (en) Distributed pipeline optimization data preparation
WO2016018201A1 (en) Searching relational and graph databases
EP3362916A1 (en) Signature-based cache optimization for data preparation
US11573961B2 (en) Delta graph traversing system
US20150039623A1 (en) System and method for integrating data
WO2016169322A1 (zh) 数据库的查询方法和装置、计算机存储介质
WO2020215689A1 (zh) 一种列存储文件的查询方法及查询装置
EP3362808A1 (en) Cache optimization for data preparation
US9390131B1 (en) Executing queries subject to different consistency requirements
CN109947759A (zh) 一种数据索引建立方法、索引检索方法及装置
JP5597623B2 (ja) データベース処理方法
Mittal et al. Efficient random data accessing in MapReduce
WO2015187187A1 (en) Journal events in a file system and a database
WO2019174558A1 (zh) 一种数据索引方法及装置
WO2016119508A1 (zh) 基于Spark系统的大规模对象识别方法
JP2015176407A (ja) 検索装置、検索方法、検索用プログラムおよび検索用データ構造
JP6371136B2 (ja) データ仮想化サーバ、データ仮想化サーバにおけるクエリ処理方法及びクエリ処理プログラム
CN106897450A (zh) 一种基于HDFS海量数据快速导入HBase的方法

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: 16782470

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: 16782470

Country of ref document: EP

Kind code of ref document: A1