WO2018149271A1 - 数据查询方法、装置及计算设备 - Google Patents

数据查询方法、装置及计算设备 Download PDF

Info

Publication number
WO2018149271A1
WO2018149271A1 PCT/CN2018/073680 CN2018073680W WO2018149271A1 WO 2018149271 A1 WO2018149271 A1 WO 2018149271A1 CN 2018073680 W CN2018073680 W CN 2018073680W WO 2018149271 A1 WO2018149271 A1 WO 2018149271A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
database
query
field
target
Prior art date
Application number
PCT/CN2018/073680
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 WO2018149271A1 publication Critical patent/WO2018149271A1/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/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/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2471Distributed queries
    • 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/27Replication, distribution or synchronisation of data between databases or within a distributed database system; Distributed database system architectures therefor

Definitions

  • the present disclosure relates to the field of information technology, and in particular, to a data query method, apparatus, and computing device.
  • the distributed database system can classify and store the data in the data table according to the application state of each data in the data table when storing the data in the data table.
  • the storage type of the data table includes a production table and a history table. If the data in the data table is the data to be applied in the current business scenario, the data is stored in the database corresponding to the production table; if the data in the data table is the data that has expired or been eliminated in the current business scenario, This data is stored in the database corresponding to the history table.
  • the prior art may adopt the following method: the application calculates the difference between the field value of the time field to be queried and the current system time, according to the difference and the advance Corresponding relationship between the storage type of the stored data table and the field value range of the time field, determining the storage type of the data table to be queried, and sending a data query request to the distributed data service (DDS), the data query
  • the request includes a storage type of the data table to be queried and a field value of the query time field; when receiving the data query request, the DDS sends the data query request to the database corresponding to the storage type of the data table, and the query result is returned by the database; When querying the results, DDS sends the results of the query to the application.
  • DDS distributed data service
  • the existing query method needs to apply the correspondence between the storage type of the storage data table and the field value range of the time field, which increases the maintenance cost for the application, and each time the data query is performed, the data table needs to be determined first.
  • a data query method comprising:
  • Receiving a first data query request sent by the application parsing the first data query request to obtain a query condition, where the query condition includes a field value of the lifecycle table identifier and the query time field; calculating a field value of the query time field and a current system time The difference between the difference and the life cycle table corresponding to the pre-stored lifecycle table identifier, determining the target storage type of the data table to be queried, and storing the field value range and storage of the lifecycle field in the life cycle table Corresponding relationship between the types; replacing the lifecycle table identifier in the first data query request with the identifier of the target storage type to obtain a second data query request; sending the second data query request to the first target database, the first The target database is a database corresponding to the target storage type, and the query result is returned by the first target database; when the query result is received, the query result is sent to the application.
  • the solution shown in the embodiment of the present disclosure determines, according to the pre-stored lifecycle table and the current system time, the storage type of the data table to be queried according to the pre-stored lifecycle table and the current data query request, and the first data query request is received.
  • the correspondence between the storage type of the storage data table and the field value range of the time field is not required, which not only saves the storage space, reduces the maintenance cost of the application, but also does not need to determine the storage of the data table to be queried. Types that enhance business extensibility.
  • the storage type of the data table includes a production table and a history table
  • Determining a target storage type of the data table to be queried according to the difference and the life cycle table corresponding to the pre-stored lifecycle table identifier including:
  • the target storage type of the data table to be queried is a history table.
  • the solution shown in the embodiment of the present disclosure determines the target storage type of the data table to be queried by comparing the difference between the field value of the query time field and the current system time with the field value range of the lifecycle field of different storage types.
  • the application is not required to be carried in the first data query request, thereby enhancing the scalability of the service.
  • the query condition further includes a first partition key value
  • Sending the second data query request to the first target database including:
  • the partition key value is a basis for partitioning and storing the data table, and the partition key value may be a field value, a field range, a hashed value of the field value, and the like.
  • the method further includes:
  • the history table includes n-level historical sub-tables, and the n-level historical sub-tables and the production tables all correspond to different data migration times, and n is a positive integer;
  • the method also includes:
  • the third data query request is sent to the third target database, where the third target database is a database corresponding to the storage type, and the third data is The query request is used by the third target database to return at least one data record, where the difference between the storage time and the current system time is not within the field value range of the lifecycle field corresponding to the storage type; when receiving at least When a data record is obtained, the data table field value of each data record is obtained from the life cycle table; the data table field value of each data record is hashed to obtain a second partition key value corresponding to each data record; For any data record, if the data record is located in the production table, the data record is migrated to the fourth target database according to the second partition key value corresponding to the data record, and the data record is deleted from the original database, the fourth The target database is the partition key value in the database corresponding to the first-level historical sub-table, and the second partition key value is a database; if the
  • the data migration time can be set by the distributed database system, and the data migration time corresponding to each storage type data table can be the same or different.
  • the solution shown in the embodiment of the present disclosure facilitates the management of different types of data tables by migrating the data in the database so that the data tables of each storage type are always stored in the corresponding database.
  • the method further includes:
  • a prompt message is sent to the original database and the migrated database, and the prompt message is used to prompt the data record to be successfully migrated.
  • a data query apparatus comprising means for implementing the data query method of the first aspect, for example, a receiving unit, a parsing unit, a calculating unit, a determining unit, a replacing unit, and a sending unit .
  • a computing device including: a processor, a memory, a communication interface, and a bus, wherein the memory, the processor, and the communication interface are connected by a bus; the memory is configured to store computer instructions; and the processor calls the memory through the bus
  • the computer instructions are stored in the data query method described in the first aspect above, and the operations performed by the processor are specifically referred to the fourth possible implementation manner of the first aspect to the first aspect.
  • a computer readable storage medium for storing program code, the program code comprising instructions for performing the method of the first aspect.
  • the second data query request that identifies the replacement lifecycle table identifier is sent to the first target database corresponding to the target storage type, and then the query result returned by the first target database is sent to the application.
  • the correspondence between the storage type of the storage data table and the field value range of the time field is not required, which not only saves the storage space, reduces the maintenance cost of the application, but also does not need to determine the storage of the data table to be queried. Types that enhance business extensibility.
  • FIG. 1 is an architectural diagram of a distributed database system provided by an embodiment of the present disclosure
  • FIG. 2 is an illustrative computer architecture of a computing device provided by an embodiment of the present disclosure
  • FIG. 3 is a flowchart of a data query method according to another embodiment of the present disclosure.
  • FIG. 4 is a schematic diagram of a table data processing procedure with a life cycle according to another embodiment of the present disclosure.
  • FIG. 5 is an example of transparent access to table data with a life cycle according to another embodiment of the present disclosure.
  • FIG. 6 is a schematic structural diagram of a data query apparatus according to another embodiment of the present disclosure.
  • nodes can be divided into query nodes and data nodes according to functions.
  • the query nodes serve as communication bridges between terminals and data nodes, and can temporarily store data of terminals and data nodes, and perform data on data nodes.
  • Query and management; data nodes are used to store data.
  • FIG. 1 shows an architectural diagram of a distributed database system. Referring to FIG. 1, the distributed database system includes a terminal 101, a query node 102, and a data node 103.
  • the terminal 101 may be a smart phone, a tablet computer, a desktop computer, or the like.
  • the embodiment of the present disclosure does not specifically limit the product type of the terminal 101.
  • various applications such as a shopping application, a navigation application, an instant messaging application, and the like are installed in the terminal 101.
  • the query node 102 is configured with a DDS for providing a distributed data access service.
  • the query node 102 can be a single computing device or a computer cluster composed of multiple computing devices.
  • the data node 103 maintains a database for storing data generated by the application during operation.
  • data node 103 typically stores the data of the application in the form of a data table.
  • the data in its corresponding data table can be stored in the data node in the behavior unit, and can also be stored in the data node as a unit.
  • the data in the data table Take the behavioral unit stored on the data node as an example.
  • the data node 103 can be a single computing device or a computer cluster composed of multiple computing devices.
  • the terminal 101 and the query node 102 can communicate with each other through a wired network or a wireless network, and the query node 102 and the data node 103 can communicate through a wired network or a wireless network.
  • Computing device 200 is a conventional desktop or laptop notebook and one or more computing devices 200 may constitute a physical platform.
  • Computing device 200 includes a processor 201, a memory 202, a communication interface 203, and a bus 204.
  • the processor 201, the memory 202, and the communication interface 203 are directly connected via a bus 204.
  • the computing device 200 can be used to execute a data query method. specifically,
  • a memory 202 configured to store computer instructions
  • the processor 201 calls the computer instructions stored in the memory 202 via the bus 204 for performing the following operations:
  • the query result is sent to the application.
  • the storage type of the data table includes a production table and a history table
  • the processor 201 calls the computer instructions stored in the memory 202 via the bus 204 for performing the following operations:
  • the target storage type of the data table to be queried is a history table.
  • the query condition further includes a first partition key value
  • the processor 201 calls the computer instructions stored in the memory 202 via the bus 204 for performing the following operations:
  • the history table includes an n-level history sub-table, and the n-level history sub-table and the production table all correspond to different data migration times, and n is a positive integer;
  • the processor 201 calls the computer instructions stored in the memory 202 via the bus 204 for performing the following operations:
  • the third data query request is sent to the third target database, where the third target database is a database corresponding to the storage type, and the third data query is Requesting for the third target database to return at least one data record, the data record being data within a range of field values of the lifecycle field corresponding to the storage type whose difference between the storage time and the current system time is not;
  • the data table field value of each data record is obtained from the life cycle table
  • the data record is migrated to the fourth target database according to the second partition key value corresponding to the data record, and the data record is deleted from the original database, the fourth target
  • the database is a database in which the partition key value in the database corresponding to the first-level historical sub-table is the second partition key value;
  • the data record is located in the i-th history sub-table, the data record is migrated to the fifth target database according to the second partition key value, and the data record is deleted from the original database, and the fifth target database is the i+1th
  • the database in the database corresponding to the level history sub-table is the database of the second partition key value, and i is a positive integer.
  • the processor 201 calls the computer instructions stored in the memory 202 via the bus 204, and is also used to perform the following operations:
  • a prompt message is sent to the original database and the migrated database by calling the communication interface 203, and the prompt message is used to prompt the data record to be successfully migrated.
  • the memory 202 includes a computer storage medium.
  • Computer storage media includes volatile and nonvolatile, removable and non-removable media implemented in any method or technology for storage of information such as computer readable instructions, data structures, program modules or other data.
  • Computer storage media include RAM, ROM, EPROM, EEPROM, flash memory or other solid state storage technologies, CD-ROM, DVD or other optical storage, tape cartridges, magnetic tape, magnetic disk storage or other magnetic storage devices.
  • the computing device 200 may also be connected to a remote computer on a network via a network such as the Internet. That is, computing device 200 can be connected to the network via network interface unit 205 coupled to said bus 204, or network interface unit 205 can be used to connect to other types of networks or remote computer systems (not shown).
  • the computing device determines the target of the data table to be queried by calculating the difference between the field value of the query time field and the current system time, and identifying the corresponding life cycle table according to the difference and the life cycle table.
  • the storage type is sent to the first target database corresponding to the target storage type by the identifier of the target storage type, and the query result returned by the first target database is sent to the application.
  • the correspondence between the storage type of the storage data table and the field value range of the time field is not required, which not only saves the storage space, reduces the maintenance cost of the application, but also does not need to determine the storage of the data table to be queried. Types that enhance business extensibility.
  • the embodiment of the present disclosure provides a data query method.
  • the method flow provided by the embodiment of the present disclosure is provided. include:
  • the terminal sends a first data query request to the query node.
  • the application may trigger the terminal to generate a data query request, and send the generated data query request.
  • the data query request is generally represented by a Structured Query Language (SQL).
  • SQL is a database query and programming language used to query, update, and manage databases.
  • data sent by the terminal to the query node in the data query scenario may be The query request is called a first data query request, and the data query request obtained by processing the first data query request is referred to as a second data query request; in the data migration scenario, the data query request sent by the query node to the data node is called Three data query requests.
  • the query node parses the first data query request to obtain a query condition, where the query condition includes a field value of the lifecycle table identifier and the query time field.
  • the query node sets different storage types (or types of data tables) for the data table according to the usage of the data in the actual data in the data table, and is different storage.
  • the type (or type of data table) sets the range of field values for the corresponding lifecycle field.
  • the storage type (or the type of the data table) represents a storage category of data in the data table in the distributed database system, and the storage type includes a production table, a history table, and the like.
  • the production table can be represented by t_order_product
  • the history table can be represented by t_order_history
  • the lifecycle field can be represented by months_between(f_date, now).
  • the query node further divides the history table into n-level history sub-tables, and the n-level history table can be represented by t_order_historyi, and the larger the value of i indicates that the data storage time is earlier, that is, the i+1th-level history sub-category
  • the storage time of the data in the table is earlier than the storage time of the data in the i-th history sub-table, where n is greater than a positive integer, i is also a positive integer, and i is less than or equal to n.
  • the field value range of the life cycle field of each level history sub-table is different, and the sum of the field value ranges of the life-cycle field of the n-level history sub-table is the field value range of the life-cycle field of the history table.
  • the query conditions include the lifecycle table identifier, the field value of the query time field, and the like.
  • the lifecycle table identifier is used to uniquely identify a lifecycle table, which can be represented by t_order.
  • the query node stores a plurality of lifecycle tables, each lifecycle table corresponding to an application on the terminal, and each lifecycle table stores a correspondence between a field value range of the lifecycle field and a storage type of the data table. relationship.
  • the query condition further includes a first partition key value, where the first partition key value includes a partition key value of the production table and a partition key value of the history table, and the partition key value of the production table.
  • the be_id can be used to indicate that the partition key value of the history table is obtained by hashing the data table field value order_id, and can be represented by hash (order_id).
  • the manner in which the query node parses the first data query request includes, but is not limited to, reading the query condition from the SQL statement according to the SQL statement form of the first data query request.
  • the query node calculates a difference between a field value of the query time field and a current system time.
  • the query node maintains a system clock, and based on the system clock, the current system time can be acquired in real time.
  • the query node can calculate the difference between the query time field and the current system time according to the field value of the query time field and the current system time.
  • the querying node determines a target storage type of the data table to be queried according to the difference and the lifecycle table corresponding to the pre-stored lifecycle table identifier.
  • the storage type of the data table includes a production table and a history table. Because the lifecycle table stores the correspondence between the field value range of the lifecycle field and the storage type, the query node can determine the data table to be queried by comparing the difference with the lifecycle table corresponding to the lifecycle identifier. The target storage type, and then query data from the distributed database system according to the target storage type of the data table to be queried.
  • the query node determines the target storage type of the data table to be queried according to the difference and the pre-stored lifecycle table identifier corresponding to the lifecycle table, the following manner may be adopted:
  • the query node determines that the target storage type of the data table to be queried is a production table
  • the query node determines that the target storage type of the data table to be queried is a history table.
  • the target storage type of the data table is the production table; if the difference between the field value of the query time field and the current system time is 7.5 months, since the difference is within the field value range of the lifecycle field corresponding to the history table, The query node may determine that the target storage type of the data table to be queried is a history table.
  • the query node replaces the lifecycle table identifier in the first data query request with the identifier of the target storage type, to obtain a second data query request.
  • the lifecycle table is not stored on each data node in the distributed database system, if the first data query request is directly sent to the specific database, the query result may not be obtained from the specific database. Therefore, in order to implement the data query process, the query is performed.
  • the node Before sending the first data query request to the specific database, the node may replace the lifecycle table identifier in the first data query request with the identifier of the target storage type to obtain a second data query request.
  • the query node sends the second data query request to the first target database.
  • the first target database is a database corresponding to the target storage type, and the number of the first target database is at least one. If the target storage type is a production table, the first target database is a database corresponding to the production table, and if the target storage type is a history table, the first target database is a database corresponding to the history table.
  • the query node includes the following two methods when sending the second data query request to the first target database for whether the first partition key value is included in the query condition:
  • the query node may send the second data query request directly to the first target database.
  • the target storage type is a production table
  • the first target database is a database corresponding to the production table
  • the query node may send the second data query request to the database corresponding to the production table
  • the target storage type is a history table
  • the first The target database is a database corresponding to the history table
  • the query node may send the second data query request to the database corresponding to the history table.
  • the query node may determine the partition key value and the query condition from the first target database according to the first partition key value in the query condition.
  • the second target database with the same first partition key value, and then the second data query request is sent to the second target database.
  • the target storage type is a production table
  • the first target database is a database corresponding to the production table
  • the query node may determine the partition key value and the first partition key value from the database corresponding to the production table according to the first partition key value.
  • the second target database with the same partition key value is sent to the second target database; when the target storage type is the history table, the first target database is the database corresponding to the history table, and the query node can be based on a first partition key value, from the database corresponding to the history table, determining a second target database whose partition key value is the same as the partition key value of the history table in the first partition key value, and sending the second data query request to the second target database.
  • the first target data node performs a query according to the first data query request, and obtains a query result.
  • the first target data node is a data node where the first target database or the second target database is located, and the number of the first target data nodes is the same as the number of the first target database or the second target database. If the first partition key value is not included in the query condition, the first target data node is the data node where the first target database is located, and the number of the first target data node is the same as the number of the first target database; if the query condition includes The first partition data key, the first target data node is the data node where the second target database is located, and the number of the first target data nodes is the same as the number of the second target database.
  • the first target data node sends the query result to the query node.
  • the first target database may send the query result to the query node through a wired network or a wireless network.
  • the query node When receiving the query result, the query node sends the query result to the terminal.
  • the query node When receiving the query result sent by the first target database, the query node sends the query result to the terminal, and the terminal sends the query result to the application, so that the application can provide the service to the user according to the query result.
  • FIG. 4 will be taken as an example for description.
  • the field value of the lifecycle field corresponding to the production table is set to be less than or equal to 6 months, and the field value of the lifecycle field corresponding to the history table is greater than or equal to 6 months. If the current system time is 2016-09-25, the query is performed. The node calculates the difference between the field value of the query time field and the current system time according to the field value 2016-06-22 of the query time field and the current system time 2016-09-25, which is 3.1 months.
  • the database DB1 performs a query according to the second data query request, obtains the query result, and sends the query result to the terminal,
  • the query node calculates the difference between the field value of the query time field and the current system time according to the field value 2016-06-22 of the query time field and the current system time 2017-02-25.
  • the value is 8.1 months.
  • the second data query request is sent to the database DB4.
  • the database DB41 performs a query according to the second data
  • the query node For any data type of the storage type, when the data migration time corresponding to the data table is reached, the query node sends a third data query request to the third target database.
  • the method provided by the embodiment of the present disclosure also supports migration of data in a distributed database system.
  • the query node Before the data in the distributed database system, the query node can set the data migration time for the data table of each storage type, so as to reach the data migration time corresponding to the data table of each storage type, the data of the storage type The data in the database corresponding to the table is migrated.
  • the query node may send a third data query request to the third target database.
  • the third target database is a database corresponding to the storage type.
  • the third data query request includes a field value of the migration time field, and the field value of the migration time field is actually a field value range of the life cycle field corresponding to the storage type, and the third data query request is used from the third database.
  • the data migration time corresponding to the production table is 1 day
  • the query node sends a third data query request to the database corresponding to the production table every other day.
  • the query node can migrate the data of each database in units of a database, that is, one. After the data in the database is successfully migrated, migrate the data from the other database.
  • the database corresponding to the third target database history table includes the databases DB1 and DB2.
  • the query node may first send the third data query request to the database DB1, and the data migration in the database DB1. After success, the third data query request is sent to the database DB2.
  • the second target data node performs a query according to the third data query request, and obtains at least one data record.
  • the second target data node is a data node where the third target database is located.
  • the second target data node searches for the difference between the storage time and the current system time from the third target database according to the field value of the migration time field in the third data query request. Migrate the data of the field value of the time field to get at least one data record.
  • the second target data node sends the at least one data record to the query node.
  • the second target data node may send at least one data record to the query node through a wired network or a wireless network.
  • the query node When receiving at least one data record, the query node obtains a data table field value of each data record from the life cycle table.
  • the data table field value is order_id. Since the data table field value of each piece of data in the data table is also stored in the life cycle table, when at least one data record is received, the query node obtains the data table field value of each data record from the life cycle table.
  • the query node performs hash calculation on the data table field value of each data record, and obtains a second partition key value corresponding to each data table record.
  • the second partition key value is the partition key value of the history table in the first partition key value.
  • the query node obtains the second partition key value of each data table record by hashing the data table field values of each data record.
  • the query node migrates the data record to a database corresponding to the second partition key value, and deletes the data record from the original database.
  • the storage time of the data in the history table is earlier than the storage time of the data in the production table, and the data in the i+1th history sub-table is stored earlier than the data in the i-th history sub-table.
  • Migration time, and over time, the storage time of data becomes earlier and earlier than the current system time. Therefore, the data migration process actually migrates data from a database with a late storage time to a database with a long storage time.
  • the data migration process is to migrate the data in the production table to the first-level historical sub-table, and the data in the first-level historical sub-table is migrated to the second historical sub-list, and the i-th historical sub-table is The data is migrated to the i+1th-level history sub-table, and so on.
  • the query node includes, but is not limited to, the following two situations when the data is migrated to the database corresponding to the second partition key of the data record:
  • the query node can migrate the data record to the fourth target database and delete the data record from the original database.
  • the fourth target database is a database in which the partition key value in the database corresponding to the first-level historical sub-table is the second partition key value.
  • the SQL statement may be sent to the fourth target database, such as insret into t_order_history values
  • the query node can migrate the data record to the fifth target database and delete the data record from the original database.
  • the fifth target database is a database in which the partition key value in the database corresponding to the i+1th-level historical sub-table is the second partition key value.
  • FIG. 5 For the above data query and data migration process, the following description will be made by taking FIG. 5 as an example.
  • the application may send a SQL statement to the query node, and when the query node receives the SQL statement, parses the SQL statement to obtain a query condition, and the query condition is obtained.
  • Field values including the lifecycle table ID and query time fields.
  • the query node determines the field value of the lifecycle field of the data table to be queried according to the field value of the query time field and the current system time, and determines the data to be queried according to the field value of the life cycle field and the life cycle table corresponding to the life cycle identifier.
  • the target storage type of the table If the target storage type is a production table, it can be queried from the database corresponding to the production table.
  • the query is performed from the database corresponding to the history table.
  • the query condition further includes the first partition key value
  • the query is specifically performed from the database corresponding to the first partition key value
  • the target storage type is obtained.
  • the query node also supports the migration of data in the distributed database. In the actual migration, the data in the production table can be migrated to the first-level historical sub-list, The data in the i-th history sub-table is migrated to the i+1th-level history sub-table.
  • a prompt message is also sent to the original database and the migrated database where the data is located, and the prompt message is used to prompt the data record to be successfully migrated.
  • the query node may also migrate the data records in the third database, or after migrating the specified amount of data in the third database, to the original database of each data record and after migration.
  • the database sends a prompt message.
  • the specified number is determined by the data processing capability of the query node, and the specified number may be 100, 200, etc., and the specific embodiment does not specifically limit the specified number.
  • the method provided by the embodiment of the present disclosure determines the target storage of the data table to be queried by calculating the difference between the field value of the query time field and the current system time, and identifying the corresponding life cycle table according to the difference and the life cycle table.
  • the type, and the second data query request obtained by replacing the identifier of the target storage type with the lifecycle table identifier is sent to the first target database corresponding to the target storage type, and then the query result returned by the first target database is sent to the application.
  • the correspondence between the storage type of the storage data table and the field value range of the time field is not required, which not only saves the storage space, reduces the maintenance cost of the application, but also does not need to determine the storage of the data table to be queried. Types that enhance business extensibility.
  • a data query apparatus provided by an embodiment of the present disclosure includes: a receiving unit 601, a parsing unit 602, a calculating unit 603, a determining unit 604, a replacing unit 605, and a sending unit 606.
  • the receiving unit 601 is configured to perform step 302 in FIG. 3.
  • the parsing unit 602 is configured to perform step 302 in FIG.
  • the calculating unit 603 is configured to perform step 303 in FIG.
  • the determining unit 604 is configured to perform step 304 in FIG.
  • the replacing unit 605 is configured to perform step 305 in FIG.
  • the sending unit 605 is configured to perform steps 306 to 309 in FIG. 3.
  • the device provided by the embodiment of the present disclosure determines the target storage of the data table to be queried by calculating the difference between the field value of the query time field and the current system time, and identifying the corresponding life cycle table according to the difference and the life cycle table.
  • the type, and the second data query request obtained by replacing the identifier of the target storage type with the lifecycle table identifier is sent to the first target database corresponding to the target storage type, and then the query result returned by the first target database is sent to the application.
  • the correspondence between the storage type of the storage data table and the field value range of the time field is not required, which not only saves the storage space, reduces the maintenance cost of the application, but also does not need to determine the storage of the data table to be queried. Types that enhance business extensibility.
  • the data query device and the computing device provided by the foregoing embodiment query data
  • only the division of each functional module is used for example.
  • the foregoing function may be allocated by different functional modules according to requirements.
  • the internal structure of the data query device and the computing device is divided into different functional modules to perform all or part of the functions described above.
  • the data query device, the computing device, and the data query method embodiment provided by the foregoing embodiments are in the same concept, and the specific implementation process is described in detail in the method embodiment, and details are not described herein again.
  • a person skilled in the art may understand that all or part of the steps of implementing the above embodiments may be completed by hardware, or may be instructed by a program to execute related hardware, and the program may be stored in a computer readable storage medium.
  • the storage medium mentioned may be a read only memory, a magnetic disk or an optical disk or the like.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Software Systems (AREA)
  • Computing Systems (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Computational Linguistics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种数据查询方法、装置及计算设备,属于信息技术领域。通过计算查询时间字段的字段值和当前系统时间之间的差值,并根据该差值和生命周期表标识对应的生命周期表,确定待查询数据表的目标存储类型,并将目标存储类型的标识替换生命周期表标识得到的第二数据查询请求发送至目标存储类型对应的第一目标数据库,进而将第一目标数据库返回的查询结果发送至应用。在进行数据查询时,无需应用存储数据表的存储类型和时间字段的字段值范围之间的对应关系,不仅节省了存储空间、降低了应用的维护成本,且无需应用确定待查询数据表的存储类型,增强了业务扩展性。

Description

数据查询方法、装置及计算设备
本申请要求于2017年2月14日提交中国专利局、申请号为201710079342.0,发明名称为“数据查询方法、装置及计算设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本公开涉及信息技术领域,特别涉及一种数据查询方法、装置及计算设备。
背景技术
在实际的业务场景下,数据表中的数据大都具有生命周期。为了便于对数据表中具有生命周期的数据进行管理,分布式数据库系统在存储数据表中的数据时,可根据数据表中每条数据的应用状态,对数据表中的数据进行分类存储。其中,数据表的存储类型包括生产表和历史表。如果数据表中的数据为当前业务场景下需要应用的数据,则将该数据存储到生产表对应的数据库中;如果数据表中的数据为当前业务场景下已失效或已淘汰的数据,则将该数据存储到历史表对应的数据库中。
在应用运行过程中,因业务需求需要查询满足要求的数据时,现有技术可采用如下方法:应用计算待查询时间字段的字段值和当前系统时间之间的差值,根据该差值和预先存储的数据表的存储类型与时间字段的字段值范围之间的对应关系,确定待查询数据表的存储类型,并向分布式数据服务(Distributed Data Service,DDS)发送数据查询请求,该数据查询请求包括待查询数据表的存储类型和查询时间字段的字段值;当接收数据查询请求时,DDS将数据查询请求发送至数据表的存储类型对应的数据库,由该数据库返回查询结果;当接收到查询结果时,DDS将查询结果发送至应用。
然而,现有的查询方法需要应用存储数据表的存储类型与时间字段的字段值范围之间的对应关系,增加了对应用的维护成本,且每次进行数据查询时,需要先确定待数据表的存储类型,因而业务扩展性较差。
发明内容
为了解决现有技术的问题,本公开实施例提供了一种数据查询方法、装置及计算设备。所述技术方案如下:
第一方面,提供了一种数据查询方法,该方法包括:
接收应用发送的第一数据查询请求;对第一数据查询请求进行解析,得到查询条件,该查询条件包括生命周期表标识和查询时间字段的字段值;计算查询时间字段的字段值和当前系统时间之间的差值;根据该差值和预先存储的生命周期表标识对应的生命周期表,确定待查询数据表的目标存储类型,该生命周期表中存储有生命周期字段的字段值范围与存储类型之间的对应关系;将第一数据查询请求中的生命周期表标识替换为目标存储类型的标识,得到第二数据查询请求;将第二数据查询请求发送至第一目标数据库,该第一目标数据库为目标存储类型对应的数据库,由第一目标数据库返回查询结果;当接收到查询结果时,将查询结果发送至应用。
本公开实施例示出的方案,在接收到应用发送的第一数据查询请求时,根据预先存储的生命周期表和当前系统时间,确定出待查询数据表的存储类型,并将第一数据查询请求发送 至该待查询数据表的存储类型对应的第一目标数据库,进而将第一目标数据库返回的查询结果发送至应用。在进行数据查询时,无需应用存储数据表的存储类型和时间字段的字段值范围之间的对应关系,不仅节省了存储空间、降低了应用的维护成本,且无需应用确定待查询数据表的存储类型,增强了业务扩展性。
在第一方面的第一种可能的实现方式中,数据表的存储类型包括生产表和历史表;
根据该差值和预先存储的生命周期表标识对应的生命周期表,确定待查询数据表的目标存储类型,包括:
如果该差值位于生产表对应的生命周期字段的字段值范围内,则确定待查询数据表的目标存储类型为生产表;
如果该差值位于历史表对应的生命周期字段的字段值范围内,则确定待查询数据表的目标存储类型为历史表。
本公开实施例示出的方案,通过将查询时间字段的字段值和当前系统时间之间的差值与不同存储类型的生命周期字段的字段值范围进行比较,确定待查询数据表的目标存储类型,而无需应用在第一数据查询请求中携带,从而增强了业务的扩展性。
在第一方面的第二种可能的实现方式中,查询条件还包括第一分区键值;
将第二数据查询请求发送至第一目标数据库,包括:
根据第一分区键值,从第一目标数据库中,确定第二目标数据库,该第二目标数据库为第一目标数据库中分区键值为第一分区键值的数据库;
将第二数据查询请求发送至第二目标数据库。
其中,分区键值为对数据表进行分区存储的依据,分区键值可以为字段值、字段范围以及字段值经过哈希计算的值等等。
本公开实施例示出的方案,当待查询数据表根据第一分区键值进行分区存储时,通过第一分区键值对第二数据查询请求进行转发,提高了数据查询效率。
在第一方面的第三种可能的实现方式中,该方法还包括:
历史表包括n级历史子表,n级历史子表和生产表均对应不同的数据迁移时间,n为正整数;
该方法还包括:
对于任一种存储类型的数据表,当到达该数据表对应的数据迁移时间时,向第三目标数据库发送第三数据查询请求,该第三目标数据库为存储类型对应的数据库,该第三数据查询请求用于第三目标数据库返回至少一条数据记录,该数据记录为存储时间与当前系统时间之间的差值未位于存储类型对应的生命周期字段的字段值范围内的数据;当接收到至少一条数据记录时,从生命周期表中,获取每条数据记录的数据表字段值;对每条数据记录的数据表字段值进行哈希计算,得到每条数据记录对应的第二分区键值;对于任一条数据记录,如果数据记录位于生产表中,则根据数据记录对应的第二分区键值,将数据记录迁移到第四目标数据库中,并将数据记录从原数据库中删除,该第四目标数据库为第一级历史子表对应的数据库中分区键值为该第二分区键值的数据库;如果数据记录位于第i级历史子表中,则根据第二分区键值,将数据记录迁移到第五目标数据库中,并将数据记录从原数据库中删除,该第五目标数据库为第i+1级历史子表对应的数据库中分区键值为第二分区键值的数据库,i为正整数。
其中,数据迁移时间可由分布式数据库系统设置,每种存储类型的数据表对应的数据迁 移时间可以相同,也可以不同。
本公开实施例示出的方案,通过对数据库中的数据进行迁移,使得每种存储类型的数据表始终存储在相应的数据库中,从而便于对不同类型的数据表进行管理。
在第一方面的第四种可能的实现方式,将数据记录从原数据库中删除之后,该方法还包括:
向原数据库和迁移后的数据库发送提示消息,该提示消息用于提示数据记录迁移成功。
第二方面,提供了一种数据查询装置,该装置包括用于实现上述第一方面所述的数据查询方法的单元,例如,接收单元、解析单元、计算单元、确定单元、替换单元及发送单元。
第三方面,提供了一种计算设备,包括:处理器、存储器、通信接口及总线,其中,存储器、处理器及通信接口通过总线连接;存储器,用于存放计算机指令;处理器通过总线调用存储器中存储的计算机指令,用于执行上述第一方面所述的数据查询方法,该处理器所执行的操作具体参见上述第一方面至第一方面的第四种可能的实现方式。
第四方面,提供了一种计算机可读存储介质,用于存储程序代码,该程序代码包括执行第一方面的方法的指令。
本公开实施例提供的技术方案带来的有益效果是:
通过计算查询时间字段的字段值和当前系统时间之间的差值,并根据该差值和生命周期表标识对应的生命周期表,确定待查询数据表的目标存储类型,并将目标存储类型的标识替换生命周期表标识得到的第二数据查询请求发送至目标存储类型对应的第一目标数据库,进而将第一目标数据库返回的查询结果发送至应用。在进行数据查询时,无需应用存储数据表的存储类型和时间字段的字段值范围之间的对应关系,不仅节省了存储空间、降低了应用的维护成本,且无需应用确定待查询数据表的存储类型,增强了业务扩展性。
附图说明
图1是本公开实施例提供的分布式数据库系统的架构图;
图2是本公开一个实施例提供的一种计算设备的说明性计算机体系结构;
图3是本公开另一个实施例提供的一种数据查询方法的流程图;
图4是本公开另一个实施例提供的一种对具有生命周期的表数据处理过程的示意图;
图5是本公开另一个实施例提供的一种对具有生命周期的表数据透明访问的示例;
图6是本公开另一个实施例提供的一种数据查询装置的结构示意图。
具体实施方式
为使本公开的目的、技术方案和优点更加清楚,下面将结合附图对本公开实施方式作进一步地详细描述。
在分布式数据库系统中,节点按照功能可分为查询节点和数据节点,查询节点作为终端与数据节点之间的通信桥梁,可临时存储终端和数据节点的数据,并对数据节点中的数据进行查询和管理;数据节点用于存储数据。基于分布式数据库系统中节点的不同功能,图1示出了分布式数据库系统的架构图,参见图1,该分布式数据库系统包括:终端101、查询节 点102及数据节点103。
其中,终端101可以为智能手机、平板电脑、台式电脑等,本公开实施例不对终端101的产品类型作具体的限定。为了满足用户的使用需求,终端101中安装了各种应用,例如购物类应用、导航类应用、即时通讯类应用等等。
查询节点102内配置有DDS,该DDS用于提供分布式数据访问服务。在实际应用中,查询节点102可以为单独的一台计算设备,还可以为由多台计算设备组成的计算机集群。
数据节点103维护一个数据库,该数据库用于存储应用在运行过程中所产生的数据。为了便于对这些数据进行管理,数据节点103通常采用数据表的形式存储应用的数据。对于每个应用而言,其对应的数据表中的数据可以行为单元存储在数据节点中,还可以列为单位存储在数据节点中,在本公开的所有实施例中,以数据表中的数据以行为单元存储在数据节点上为例。在实际应用中,数据节点103可以为单独的一台计算设备,还可以为由多台计算设备组成的计算机集群。
上述终端101与查询节点102之间可通过有线网络或无线网络进行通信,查询节点102与数据节点103之间可通过有线网络或无线网络进行通信。
参见图2,其示出了本公开的一个实施例中使用的计算设备200的说明算机体系结构。计算设备200为常规的台式计算机或者膝上型笔记本,一个或多个计算设备200可构成物理平台。计算设备200包括处理器201、存储器202、通信接口203和总线204。该处理器201、存储器202、通信接口203通过总线204直连。该计算设备200可用于执行数据查询方法。具体地,
存储器202,用于存放计算机指令;
处理器201通过总线204调用存储器202中存储的计算机指令,用于执行以下操作:
通过调用通信接口接203收应用发送的第一数据查询请求;
对第一数据查询请求进行解析,得到查询条件,该查询条件包括生命周期表标识和查询时间字段的字段值;
计算查询时间字段的字段值和当前系统时间之间的差值;
根据该差值和预先存储的生命周期表标识对应的生命周期表,确定待查询数据表的目标存储类型,该生命周期表中存储有生命周期字段的字段值范围与存储类型之间的对应关系;
将第一数据查询请求中的生命周期表标识替换为目标存储类型的标识,得到第二数据查询请求;
通过调用通信接口203将第二数据查询请求发送至第一目标数据库,该第一目标数据库为目标存储类型对应的数据库,由第一目标数据库返回查询结果;
通过调用通信接口203当接收到查询结果时,将查询结果发送至应用。
在本公开的另一个实施例中,数据表的存储类型包括生产表和历史表;
处理器201通过总线204调用存储器202中存储的计算机指令,用于执行以下操作:
如果该差值位于生产表对应的生命周期字段的字段值范围内,则确定待查询数据表的目标存储类型为生产表;
如果该差值位于历史表对应的生命周期字段的字段值范围内,则确定待查询数据表的目标存储类型为历史表。
在本公开的另一个实施例中,查询条件还包括第一分区键值;
处理器201通过总线204调用存储器202中存储的计算机指令,用于执行以下操作:
根据第一分区键值,从第一目标数据库中,确定第二目标数据库,该第二目标数据库为第一目标数据库中分区键值为第一分区键值的数据库;
将第二数据查询请求发送至第二目标数据库。
在本公开的另一个实施例中,历史表包括n级历史子表,n级历史子表和生产表均对应不同的数据迁移时间,n为正整数;
处理器201通过总线204调用存储器202中存储的计算机指令,用于执行以下操作:
对于任一种存储类型的数据表,当到达数据表对应的数据迁移时间时,向第三目标数据库发送第三数据查询请求,该第三目标数据库为存储类型对应的数据库,该第三数据查询请求用于第三目标数据库返回至少一条数据记录,该数据记录为存储时间与当前系统时间之间的差值未位于存储类型对应的生命周期字段的字段值范围内的数据;
当接收到至少一条数据记录时,从生命周期表中,获取每条数据记录的数据表字段值;
对每条数据记录的数据表字段值进行哈希计算,得到每条数据记录对应的第二分区键值;
对于任一条数据记录,如果数据记录位于生产表中,则根据数据记录对应的第二分区键值,将数据记录迁移到第四目标数据库中,并将数据记录从原数据库中删除,第四目标数据库为第一级历史子表对应的数据库中分区键值为第二分区键值的数据库;
如果数据记录位于第i级历史子表中,则根据第二分区键值,将数据记录迁移到第五目标数据库中,并将数据记录从原数据库中删除,第五目标数据库为第i+1级历史子表对应的数据库中分区键值为第二分区键值的数据库,i为正整数。
在本公开的另一个实施例中,处理器201通过总线204调用存储器202中存储的计算机指令,还用于执行以下操作:
通过调用通信接口203向原数据库和迁移后的数据库发送提示消息,该提示消息用于提示数据记录迁移成功。
不失一般性,该存储器202包括计算机存储介质。计算机存储介质包括以用于存储诸如计算机可读指令、数据结构、程序模块或其他数据等信息的任何方法或技术实现的易失性和非易失性、可移动和不可移动介质。计算机存储介质包括RAM、ROM、EPROM、EEPROM、闪存或其他固态存储其技术,CD-ROM、DVD或其他光学存储、磁带盒、磁带、磁盘存储或其他磁性存储设备。当然,本领域技术人员可知计算机存储介质不局限于上述几种。
根据本公开的各种实施例,所述计算设备200还可以通过诸如因特网等网络连接到网络上的远程计算机运行。也即计算设备200可以通过连接在所述总线204上的网络接口单元205连接到网络,或者说,也可以使用网络接口单元205来连接到其他类型的网络或远程计算机系统(未示出)。
本公开实施例提供的计算设备,通过计算查询时间字段的字段值和当前系统时间之间的差值,并根据该差值和生命周期表标识对应的生命周期表,确定待查询数据表的目标存储类型,并将目标存储类型的标识替换生命周期表标识得到的第二数据查询请求发送至目标存储类型对应的第一目标数据库,进而将第一目标数据库返回的查询结果发送至应用。在进行数据查询时,无需应用存储数据表的存储类型和时间字段的字段值范围之间的对应关系,不仅节省了存储空间、降低了应用的维护成本,且无需应用确定待查询数据表的存储类型,增强了业务扩展性。
为了提高表数据的查询效率,提升业务性能,基于图1所示的分布式数据库系统的架构图,本公开实施例提供了一种数据查询方法,参见图3,本公开实施例提供的方法流程包括:
301、终端向查询节点发送第一数据查询请求。
对于终端中的任一种应用,在该应用的运行过程中,因业务需求需要从数据库中查询满足要求的数据时,该应用可触发终端生成数据查询请求,并将所生成的数据查询请求发送至查询节点。其中,数据查询请求一般采用结构化查询语言(Structured Query Language,SQL)进行表示。SQL为一种数据库查询和程序设计语言,主要用于对数据库进行查询、更新和管理。
需要说明的是,由于本公开实施例中涉及了不同业务场景下的多种数据查询请求,为了便于将多种数据查询请求区分开来,可将数据查询场景下,终端向查询节点发送的数据查询请求称为第一数据查询请求,将对第一数据查询请求处理后得到数据查询请求称为第二数据查询请求;将数据迁移场景下,查询节点向数据节点发送的数据查询请求称为第三数据查询请求。
302、当接收到第一数据查询请求时,查询节点对第一数据查询请求进行解析,得到查询条件,该查询条件包括生命周期表标识和查询时间字段的字段值。
为了便于对应用运行过程中产生的数据进行分类管理,查询节点根据数据表中数据在实际业务中的使用情况,为数据表设置不同的存储类型(或数据表的类型),并为不同的存储类型(或数据表的类型)设置对应的生命周期字段的字段值范围。该存储类型(或数据表的类型)表示数据表中数据在分布式数据库系统中的存储类别,该存储类型包括生产表和历史表等。其中,生产表可用t_order_product表示,历史表可用t_order_history表示,生命周期字段可用months_between(f_date,now)表示。为了提高查询效率,查询节点还将历史表划分为n级历史子表,该n级历史表可用t_order_historyi表示,且i值越大表示数据的存储时间早,也即是第i+1级历史子表中数据的存储时间早于第i级历史子表中数据的存储时间,其中,n为大于正整数,i也为正整数,i小于等于n。对于n级历史子表,每级历史子表的生命周期字段的字段值范围不同,且n级历史子表的生命周期字段的字段值范围之和为历史表的生命周期字段的字段值范围。
其中,查询条件包括生命周期表标识、查询时间字段的字段值等。生命周期表标识用于唯一标识一个生命周期表,可用t_order表示。查询节点上存储有多张生命周期表,每张生命周期表与终端上的一个应用对应,且每张生命周期表中存储有生命周期字段的字段值范围与数据表的存储类型之间的对应关系。当然,如果待查询数据表分区进行存储,查询条件还包括第一分区键值,该第一分区键值包括生产表的分区键值和历史表的分区键值等,该生产表的分区键值可用be_id表示,历史表的分区键值由数据表字段值order_id经过哈希计算得到,可用hash(order_id)表示。
查询节点对第一数据查询请求进行解析的方式,包括但不限于:根据第一数据查询请求的SQL语句形式,从SQL语句中读取查询条件。
例如,查询节点接收到的第一数据查询请求为:select*from t_order where f_date=to_date(‘2016-06-22’,‘yyyy-mm-dd’and be_id=18 and order_id=10),查询节点对第一数据查询请求进行解析,得到查询条件信息为:生命周期表标识为t_order、查询时间字段的字段值为f_date=to_date(‘2016-06-22’,‘yyyy-mm-dd’)、生产表的分区键值为be_id=18、历史表的分区键值为对order_id=10进行哈希计算的哈希值,即hash (order_id=10)。
303、查询节点计算查询时间字段的字段值和当前系统时间之间的差值。
在本公开实施例中,查询节点维护一个系统时钟,基于该系统时钟,能够实时获取当前系统时间。查询节点根据查询时间字段的字段值和当前系统时间,可计算查询时间字段与当前系统时间之间的差值。
例如,查询节点对第一数据查询请求进行解析得到的查询时间字段的字段值为f_date=to_date(‘2016-06-22’,‘yyyy-mm-dd’),当前系统时间为2016-09-25,则查询时间字段的字段值与当前系统时间之间的差值为3.1个月。
304、查询节点根据该差值和预先存储的生命周期表标识对应的生命周期表,确定待查询数据表的目标存储类型。
其中,数据表的存储类型包括生产表和历史表。由于生命周期表中存储有生命周期字段的字段值范围与存储类型之间的对应关系,因此,查询节点可通过将该差值与生命周期标识对应的生命周期表进行比较,确定待查询数据表的目标存储类型,进而根据待查询数据表的目标存储类型,从分布式数据库系统中查询数据。
查询节点在根据该差值和预先存储的生命周期表标识对应的生命周期表,确定待查询数据表的目标存储类型时,可采用如下方式:
如果该差值位于生产表对应的生命周期字段的字段值范围内,则查询节点确定待查询数据表的目标存储类型为生产表;
如果该差值位于历史表对应的生命周期字段的字段值范围内,则查询节点确定待查询数据表的目标存储类型为历史表。
例如,生命周期字段的字段值范围与数据表的类型之间的对应关系为:当生命周期字段的字段值范围months_between(f_date,now)<=6个月时,数据表的存储类型为生产表,当生命周期字段的字段值范围months_between(f_date,now)>=6个月时,数据表的存储类型为历史表。如果查询时间字段的字段值与当前系统时间之间的差值为3.1个月,由于该差值3.1个月位于生产表对应的生命周期字段的字段值范围内,因此,查询节点可确定待查询数据表的目标存储类型为生产表;如果查询时间字段的字段值与当前系统时间之间的差值为7.5个月,由于该差值位于历史表对应的生命周期字段的字段值范围内,因此,查询节点可确定待查询数据表的目标存储类型为历史表。
305、查询节点将第一数据查询请求中的生命周期表标识替换为目标存储类型的标识,得到第二数据查询请求。
由于分布式数据库系统中每个数据节点上并未存储生命周期表,如果直接将第一数据查询请求发送至具体数据库可能无法从具体数据库中获取到查询结果,因此,为了实现数据查询过程,查询节点在将第一数据查询请求发送至具体数据库进行之前,可将第一数据查询请求中的生命周期表标识替换为目标存储类型的标识,得到第二数据查询请求。
306、查询节点将第二数据查询请求发送至第一目标数据库。
其中,第一目标数据库为目标存储类型对应的数据库,且该第一目标数据库的数量至少为一个。如果目标存储类型为生产表,则第一目标数据库为生产表对应的数据库,如果目标存储类型为历史表,则第一目标数据库为历史表对应的数据库。
针对于查询条件中是否包括第一分区键值,查询节点在将第二数据查询请求发送至第一目标数据库时,包括如下两种方式:
在本公开的一个实施例中,如果查询条件中不包括第一分区键值,查询节点可将第二数据查询请求直接发送至第一目标数据库。例如,当目标存储类型为生产表时,第一目标数据库为生产表对应的数据库,查询节点可将第二数据查询请求发送至生产表对应的数据库;当目标存储类型为历史表时,第一目标数据库为历史表对应的数据库,查询节点可将第二数据查询请求发送至历史表对应的数据库。
在本公开的另一个实施例中,如果查询条件中包括第一分区键值,查询节点可根据查询条件中的第一分区键值,从第一目标数据库中,确定分区键值与查询条件中第一分区键值相同的第二目标数据库,进而将第二数据查询请求发送至第二目标数据库。当目标存储类型为生产表时,第一目标数据库为生产表对应的数据库,查询节点可根据第一分区键值,从生产表对应的数据库中,确定分区键值与第一分区键值中生产表的分区键值相同的第二目标数据库,并将第二数据查询请求发送至第二目标数据库;当目标存储类型为历史表时,第一目标数据库为历史表对应的数据库,查询节点可根据第一分区键值,从历史表对应的数据库中,确定分区键值与第一分区键值中历史表的分区键值相同的第二目标数据库,并将第二数据查询请求发送至第二目标数据库。
307、第一目标数据节点根据第一数据查询请求进行查询,得到查询结果。
其中,第一目标数据节点为第一目标数据库或第二目标数据库所在的数据节点,且第一目标数据节点的数量与第一目标数据库或第二目标数据库的数量相同。如果查询条件中不包括第一分区键值,则第一目标数据节点为第一目标数据库所在的数据节点,且第一目标数据节点的数量与第一目标数据库的数量相同;如果查询条件中包括第一分区键值,则第一目标数据节点为第二目标数据库所在的数据节点,且第一目标数据节点的数量与第二目标数据库的数量相同。
308、第一目标数据节点将查询结果发送至查询节点。
当得到查询结果后,第一目标数据库可通过有线网络或无线网络将查询结果发送至查询节点。
309、当接收到查询结果时,查询节点将查询结果发送至终端。
当接收到第一目标数据库发送的查询结果时,查询节点将查询结果发送至终端,由终端将查询结果发送至应用,使得应用能够根据查询结果为用户提供服务。
对于本公开实施例提供的数据查询方法,下面将以图4为例进行说明。
参见图4,在应用运行过程中,因业务需求需要获取满足一定条件的数据时,应用可触发终端向查询节点发送第一数据查询请求,该第一数据查询请求为:select*from t_order where f_date=to_date(‘2016-06-22’,‘yyyy-mm-dd’and be_id=18 and order_id=10),查询节点对第一数据查询请求进行解析,得到查询条件为:生命周期表标识为t_order、查询时间字段的字段值为f_date=to_date(‘2016-06-22’,‘yyyy-mm-dd’,生产表的分区键值为be_id=18,历史表的分区键值为hash(order_id=10)。
设定生产表对应的生命周期字段的字段值范围为小于等于6个月,历史表对应的生命周期字段的字段值范围为大于等于6个月,如果当前系统时间为2016-09-25,查询节点根据查询时间字段的字段值2016-06-22和当前系统时间2016-09-25,计算查询时间字段的字段值与当前系统时间之间的差值为3.1个月。由于生命周期字段的字段值3.1位于生产表对应的生命周期字段的字段值范围内,则查询节点可确定待查询数据表的目标存储类型为生产表,进而根据生产表的分区键值be_id=18,从生产表对应的数据库DB1和DB2中,确定生产表 的分区键值be_id=18对应的数据库DB1,并将第一数据查询请求中的生命周期表标识t_order替换为生产表的标识t_order_product,得到第二数据查询请求select*from t_order_product where f_date=to_date(‘2016-06-22’,‘yyyy-mm-dd’and be_id=18 and order_id=10),进而将第二数据查询请求发送至数据库DB1,数据库DB1根据第二数据查询请求进行查询,得到查询结果,并将查询结果发送至终端,由终端将查询结果发送至应用。
如果当前系统时间为2017-02-25,查询节点根据查询时间字段的字段值2016-06-22和当前系统时间2017-02-25,计算查询时间字段的字段值与当前系统时间之间的差值为8.1个月。由于生命周期字段的字段值8.1位于历史表对应的生命周期字段的字段值范围内,则查询节点可确定待查询数据表的目标存储类型为历史表,进而根据历史表的分区键值hash(order_id=10),从历史表对应的数据库DB3、DB4、DB5中,确定历史表的分区键值hash(order_id=10)=1对应的数据库为DB4,并将第一数据查询请求中的生命周期表标识t_order替换为历史表的标识t_order_history,得到第二数据查询请求select*from t_order_history where f_date=to_date(‘2016-06-22’,‘yyyy-mm-dd’and be_id=18 and order_id=10),进而将第二数据查询请求发送至数据库DB4,数据库DB41根据第二数据查询请求进行查询,得到查询结果,并将查询结果发送至终端,由终端将查询结果发送至应用。
310、对于任一种存储类型的数据表,当到达数据表对应的数据迁移时间时,查询节点向第三目标数据库发送第三数据查询请求。
由于数据表中数据所属的存储类型是由存储时间与当前系统时间的差值决定的,而随着时间的推移,当前系统时间不断变化,导致数据表中数据所属的存储类型将发生变化,为此,本公开实施例提供的方法还支持对分布式数据库系统中的数据进行迁移。在对分布式数据库系统中的数据之前,查询节点可为每种存储类型的数据表设置数据迁移时间,从而在达到每种存储类型的数据表对应的数据迁移时间,对该种存储类型的数据表对应的数据库中的数据进行迁移。
对于任一种存储类型的数据表,当到达该数据表对应的数据迁移时间时,查询节点可向第三目标数据库发送第三数据查询请求。其中,第三目标数据库为该存储类型对应的数据库。第三数据查询请求包括迁移时间字段的字段值等,该迁移时间字段的字段值实际上为该存储类型对应的生命周期字段的字段值范围,该第三数据查询请求用于从第三数据库中查询存储时间与当前系统时间之间的差值大于迁移时间字段的字段值的数据记录。例如,生产表对应的数据迁移时间为1天,迁移时间字段的字段值为months_between(f_date,now)>=6,每隔一天查询节点将向生产表对应的数据库发送第三数据查询请求,该第三数据查询请求为:select*from t_order_product where months_between(f_date,now)>=6,该第三数据查询请求用于从生产表对应的数据库中存储时间与当前系统时间之间的差值大于6个月的数据记录。
需要说明的是,如果分布式数据库系统对每种存储类型的数据表中的数据进行分区存储,为了减轻数据处理压力,查询节点可以数据库为单位对每个数据库的数据进行迁移,也即是一个数据库中的数据迁移成功之后,再迁移另一个数据库中的数据。例如,第三目标数据库历史表对应的数据库,该第三数据库包括数据库DB1和DB2,在进行数据迁移时,查询节点可先将第三数据查询请求发送至数据库DB1,当数据库DB1中的数据迁移成功之后,再将第三数据查询请求发送至数据库DB2。
311、第二目标数据节点根据第三数据查询请求进行查询,得到至少一条数据记录。
其中,第二目标数据节点为第三目标数据库所在的数据节点。当接收到第三数据查询请求时,第二目标数据节点根据第三数据查询请求中的迁移时间字段的字段值,从第三目标数据库中查找存储时间与当前系统时间之间的差值大于该迁移时间字段的字段值的数据,得到至少一条数据记录。
312、第二目标数据节点将至少一条数据记录发送至查询节点。
当获取到至少一条数据记录时,第二目标数据节点可通过有线网络或无线网络将至少一条数据记录发送至查询节点。
313、当接收到至少一条数据记录时,查询节点从生命周期表中,获取每条数据记录的数据表字段值。
其中,数据表字段值即为order_id。由于生命周期表中还存储有数据表中每条数据的数据表字段值,因此,当接收到至少一条数据记录时,查询节点从生命周期表中获取每条数据记录的数据表字段值。
314、查询节点对每条数据记录的数据表字段值进行哈希计算,得到每条数据表记录对应的第二分区键值。
其中,第二分区键值即为第一分区键值中的历史表的分区键值。查询节点通过对每条数据记录的数据表字段值进行哈希计算,可得到每条数据表记录的第二分区键值。
315、对于任一条数据记录,查询节点将该数据记录迁移到第二分区键值对应的数据库,并将数据记录从原数据库中删除。
在本公开实施例中,历史表中数据的存储时间要早于生产表中数据的存储时间,第i+1级历史子表中数据的存储时间要早于第i级历史子表中的数据迁移时间,而随着时间的推移,数据的存储时间相对当前系统时间变得越来越早,因此,数据迁移过程实际上是将数据从存储时间晚的数据库迁移到存储时间早的数据库,也即是,数据迁移过程为将生产表中的数据迁移到第一级历史子表中,将第一级历史子表中的数据迁移到第二历史子表中,将第i级历史子表中的数据迁移到第i+1级历史子表中,依次类推。基于上述内容,对于任一条数据记录,查询节点在将该条数据迁移到该数据记录的第二分区键值对应的数据库时,包括但不限于如下两种情况:
在本公开的一个实施例中,如果数据记录位于生产表中,则查询节点可将数据记录迁移到第四目标数据库中,并将数据记录从原数据库中删除。其中,第四目标数据库为第一级历史子表对应的数据库中分区键值为第二分区键值的数据库。具体地,查询节点在将数据记录迁移到第四目标数据库时,可向第四目标数据库发送SQL语句,如insret into t_order_history values(…)。查询节点在将数据记录从原数据库中删除时,可向第四目标数据库发送SQL语句,如delete from t_order_product where be_id?And order_id=?and f_date?and(…)。
在本公开的另一个实施例中,如果数据记录位于第i级历史子表中,则查询节点可将数据记录迁移到第五目标数据库中,并将数据记录从原数据库中删除。其中,第五目标数据库为第i+1级历史子表对应的数据库中分区键值为第二分区键值的数据库。
对于上述数据查询及数据迁移过程,下面将以图5为例进行说明。
参见图5,当因业务需求,应用需要获取满足一定条件的数据时,应用可向查询节点发送SQL语句,查询节点接收到SQL语句时,对该SQL语句进行解析,得到查询条件,该查询条件包括生命周期表标识和查询时间字段的字段值。查询节点根据查询时间字段的字段值与 当前系统时间,确定待查询数据表的生命周期字段的字段值,并根据该生命周期字段的字段值和生命周期标识对应的生命周期表,确定待查询数据表的目标存储类型,如果目标存储类型为生产表,可从生产表对应的数据库中进行查询,如果目标存储类型为历史表,则从历史表对应的数据库中进行查询。在查询过程中,如果查询条件还包括第一分区键值,则从第一分区键值对应的数据库中有针对性地进行查询,如果查询条件不包括第一分区键值,则从目标存储类型对应全部数据库中进行查询。为了确保每种存储类型对应的数据库中数据准确,查询节点还支持对分布式数据库中的数据进行迁移,在实际迁移时,可将生产表中的数据迁移到第一级历史子表中,将第i级历史子表中的数据迁移到第i+1级历史子表中。
在本公开的另一个实施例中,查询节点将数据记录从原数据库中删除之后,还将向该数据所在的原数据库和迁移后的数据库发送提示消息,该提示消息用于提示数据记录迁移成功。当然,为了节省资源,查询节点还可在对第三数据库中的数据记录全部迁移后,或者当对第三数据库中的指定数量的数据进行迁移后,向每条数据记录的原数据库和迁移后的数据库发送提示消息。其中,指定数量由查询节点的数据处理能力确定,该指定数量可以为100、200等,本公开实施例不对指定数量作具体的限定。
本公开实施例提供的方法,通过计算查询时间字段的字段值和当前系统时间之间的差值,并根据该差值和生命周期表标识对应的生命周期表,确定待查询数据表的目标存储类型,并将目标存储类型的标识替换生命周期表标识得到的第二数据查询请求发送至目标存储类型对应的第一目标数据库,进而将第一目标数据库返回的查询结果发送至应用。在进行数据查询时,无需应用存储数据表的存储类型和时间字段的字段值范围之间的对应关系,不仅节省了存储空间、降低了应用的维护成本,且无需应用确定待查询数据表的存储类型,增强了业务扩展性。
参见图6,本公开实施例提供的一种数据查询装置,该装置包括:接收单元601、解析单元602、计算单元603、确定单元604、替换单元605、发送单元606。
其中,接收单元601,用于执行图3中的步骤302。
解析单元602,用于执行图3中的步骤302。
计算单元603,用于执行图3中的步骤303。
确定单元604,用于执行图3中的步骤304。
替换单元605,用于执行图3中的步骤305。
发送单元605,用于执行图3中的步骤306至309。
本公开实施例提供的装置,通过计算查询时间字段的字段值和当前系统时间之间的差值,并根据该差值和生命周期表标识对应的生命周期表,确定待查询数据表的目标存储类型,并将目标存储类型的标识替换生命周期表标识得到的第二数据查询请求发送至目标存储类型对应的第一目标数据库,进而将第一目标数据库返回的查询结果发送至应用。在进行数据查询时,无需应用存储数据表的存储类型和时间字段的字段值范围之间的对应关系,不仅节省了存储空间、降低了应用的维护成本,且无需应用确定待查询数据表的存储类型,增强了业务扩展性。
需要说明的是:上述实施例提供的数据查询装置与计算设备在查询数据时,仅以上述各功能模块的划分进行举例说明,实际应用中,可以根据需要而将上述功能分配由不同的功能 模块完成,即将数据查询装置与计算设备的内部结构划分成不同的功能模块,以完成以上描述的全部或者部分功能。另外,上述实施例提供的数据查询装置、计算设备与数据查询方法实施例属于同一构思,其具体实现过程详见方法实施例,这里不再赘述。
本领域普通技术人员可以理解实现上述实施例的全部或部分步骤可以通过硬件来完成,也可以通过程序来指令相关的硬件完成,所述的程序可以存储于一种计算机可读存储介质中,上述提到的存储介质可以是只读存储器,磁盘或光盘等。
以上所述仅为本公开的较佳实施例,并不用以限制本公开,凡在本公开的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本公开的保护范围之内。

Claims (11)

  1. 一种数据查询方法,其特征在于,所述方法包括:
    接收应用发送的第一数据查询请求;
    对所述第一数据查询请求进行解析,得到查询条件,所述查询条件包括生命周期表标识和查询时间字段的字段值;
    计算所述查询时间字段的字段值和当前系统时间之间的差值;
    根据所述差值和预先存储的所述生命周期表标识对应的生命周期表,确定待查询数据表的目标存储类型,所述生命周期表中存储有生命周期字段的字段值范围与存储类型之间的对应关系;
    将所述第一数据查询请求中的所述生命周期表标识替换为目标存储类型的标识,得到第二数据查询请求;
    将所述第二数据查询请求发送至第一目标数据库,所述第一目标数据库为所述目标存储类型对应的数据库,由所述第一目标数据库返回查询结果;
    当接收到所述查询结果时,将所述查询结果发送至所述应用。
  2. 根据权利要求1所述的方法,其特征在于,数据表的存储类型包括生产表和历史表;
    所述根据所述差值和预先存储的所述生命周期表标识对应的生命周期表,确定待查询数据表的目标存储类型,包括:
    如果所述差值位于生产表对应的生命周期字段的字段值范围内,则确定所述待查询数据表的目标存储类型为生产表;
    如果所述差值位于历史表对应的生命周期字段的字段值范围内,则确定所述待查询数据表的目标存储类型为历史表。
  3. 根据权利要求1或2所述的方法,其特征在于,所述查询条件还包括第一分区键值;
    所述将所述第二数据查询请求发送至第一目标数据库,包括:
    根据所述第一分区键值,从所述第一目标数据库中,确定第二目标数据库,所述第二目标数据库为第一目标数据库中分区键值为第一分区键值的数据库;
    将所述第二数据查询请求发送至所述第二目标数据库。
  4. 根据权利要求1至3中任一项所述的方法,其特征在于,所述历史表包括n级历史子表,所述n级历史子表和所述生产表均对应不同的数据迁移时间,n为正整数;
    所述方法还包括:
    对于任一种存储类型的数据表,当到达所述数据表对应的数据迁移时间时,向第三目标数据库发送第三数据查询请求,所述第三目标数据库为所述存储类型对应的数据库,所述第三数据查询请求用于所述第三目标数据库返回至少一条数据记录,所述数据记录为存储时间与当前系统时间之间的差值未位于所述存储类型对应的生命周期字段的字段值范围内的数据;
    当接收到所述至少一条数据记录时,从所述生命周期表中,获取每条数据记录的数据表字段值;
    对每条数据记录的数据表字段值进行哈希计算,得到每条数据记录对应的第二分区键 值;
    对于任一条数据记录,如果所述数据记录位于所述生产表中,则根据所述数据记录对应的第二分区键值,将所述数据记录迁移到第四目标数据库中,并将所述数据记录从原数据库中删除,所述第四目标数据库为第一级历史子表对应的数据库中分区键值为所述第二分区键值的数据库;
    如果所述数据记录位于第i级历史子表中,则根据所述第二分区键值,将所述数据记录迁移到第五目标数据库中,并将所述数据记录从原数据库中删除,所述第五目标数据库为第i+1级历史子表对应的数据库中分区键值为所述第二分区键值的数据库,i为正整数。
  5. 根据权利要求4所述的方法,其特征在于,所述将所述数据记录从原数据库中删除之后,所述方法还包括:
    向所述原数据库和迁移后的数据库发送提示消息,所述提示消息用于提示所述数据记录迁移成功。
  6. 一种数据查询装置,其特征在于,所述装置包括:
    接收单元,用于接收应用发送的第一数据查询请求;
    解析单元,用于对所述第一数据查询请求进行解析,得到查询条件,所述查询条件包括生命周期表标识和查询时间字段的字段值;
    计算单元,用于根据所述查询时间字段的字段值和当前系统时间之间的差值;
    确定单元,还用于根据所述差值和预先存储的所述生命周期表标识对应的生命周期表,确定待查询数据表的目标存储类型,所述生命周期表中存储有生命周期字段的字段值范围与存储类型之间的对应关系;
    替换单元,用于将所述第一数据查询请求中的所述生命周期表标识替换为目标存储类型的标识,得到第二数据查询请求;
    发送单元,用于将所述第二数据查询请求发送至第一目标数据库,所述第一目标数据库为所述目标存储类型对应的数据库,由所述第一目标数据库返回查询结果;
    所述发送单元,还用于当接收到所述查询结果时,将所述查询结果发送至所述应用。
  7. 根据权利要求6所述的装置,其特征在于,数据表的存储类型包括生产表和历史表;
    所述确定单元,用于当所述差值位于生产表对应的所述生命周期字段的字段值范围内,确定所述待查询数据表的目标存储类型为生产表;当所述差值位于历史表对应的生命周期字段的字段值范围内,确定所述待查询数据表的目标存储类型为历史表。
  8. 根据权利要求6或7所述的装置,其特征在于,所述查询条件还包括第一分区键值;
    所述发送单元,用于根据所述第一分区键值,从所述第一目标数据库中,确定第二目标数据库,所述第二目标数据库为第一目标数据库中分区键值为第一分区键值的数据库;
    将所述第二数据查询请求发送至所述第二目标数据库。
  9. 根据权利要求6至8中任一项所述的装置,其特征在于,所述历史表包括n级历史子表,所述n级历史子表和所述生产表均对应不同的数据迁移时间,n为正整数;
    所述装置还包括:
    所述发送单元,用于对于任一种存储类型的数据表,当到达所述数据表对应的数据迁移时间时,向第三目标数据库发送第三数据查询请求,所述第三目标数据库为所述存储类型对应的数据库,所述第三数据查询请求用于所述第三目标数据库返回至少一条数据记录,所述数据记录为存储时间与当前系统时间之间的差值未位于所述存储类型对应的生命周期字段的字段值范围内的数据;
    获取单元,用于当接收到所述至少一条数据记录时,从所述生命周期表中,获取每条数据记录的数据表字段值;
    计算单元,用于对每条数据记录的数据表字段值进行哈希计算,得到每条数据记录对应的第二分区键值;
    迁移单元,用于对于任一条数据记录,当所述数据记录位于所述生产表中,根据所述数据记录对应的第二分区键值,将所述数据记录迁移到第四目标数据库中,并将所述数据记录从原数据库中删除,所述第四目标数据库为第一级历史子表对应的数据库中分区键值为所述第二分区键值的数据库;
    所述迁移单元,还用于当所述数据记录位于第i级历史子表中,根据所述第二分区键值,将所述数据记录迁移到第五目标数据库中,并将所述数据记录从原数据库中删除,所述第五目标数据库为第i+1级历史子表对应的数据库中分区键值为所述第二分区键值的数据库,i为正整数。
  10. 根据权利要求9所述的装置,其特征在于,所述发送单元,还用于向所述原数据库和迁移后的数据库发送提示消息,所述提示消息用于提示所述数据记录迁移成功。
  11. 一种计算设备,其特征在于,包括:处理器、存储器、通信接口及总线,其中,所述存储器、处理器及所述通信接口通过所述总线连接;
    所述存储器,用于存放计算机指令;
    所述处理器通过所述总线调用所述存储器中存储的计算机指令,用于执行以下操作:
    通过调用所述通信接口接收应用发送的第一数据查询请求;
    对所述第一数据查询请求进行解析,得到查询条件,所述查询条件包括生命周期表标识和查询时间字段的字段值;
    计算所述查询时间字段的字段值和当前系统时间之间的差值;
    根据所述差值和预先存储的所述生命周期表标识对应的生命周期表,确定待查询数据表的目标存储类型,所述生命周期表中存储有生命周期字段的字段值范围与存储类型之间的对应关系;
    将所述第一数据查询请求中的所述生命周期表标识替换为目标存储类型的标识,得到第二数据查询请求;
    通过调用所述通信接口将所述第二数据查询请求发送至第一目标数据库,所述第一目标数据库为所述目标存储类型对应的数据库,由所述第一目标数据库返回查询结果;
    通过调用所述通信接口当接收到所述查询结果时,将所述查询结果发送至所述应用。
PCT/CN2018/073680 2017-02-14 2018-01-23 数据查询方法、装置及计算设备 WO2018149271A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710079342.0A CN108427684B (zh) 2017-02-14 2017-02-14 数据查询方法、装置及计算设备
CN201710079342.0 2017-02-14

Publications (1)

Publication Number Publication Date
WO2018149271A1 true WO2018149271A1 (zh) 2018-08-23

Family

ID=63155174

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/073680 WO2018149271A1 (zh) 2017-02-14 2018-01-23 数据查询方法、装置及计算设备

Country Status (2)

Country Link
CN (1) CN108427684B (zh)
WO (1) WO2018149271A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111339560A (zh) * 2020-02-26 2020-06-26 中国邮政储蓄银行股份有限公司 一种数据隔离方法、装置及系统
WO2022006794A1 (en) * 2020-07-08 2022-01-13 Alibaba Group Holding Limited Routing directives for partitioned databases

Families Citing this family (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109471873B (zh) * 2018-09-05 2021-02-19 珠海格力电器股份有限公司 数据记录筛选方法和装置
CN109726315A (zh) * 2018-10-24 2019-05-07 阿里巴巴集团控股有限公司 数据查询方法、装置、计算设备及存储介质
CN109376174B (zh) * 2018-12-30 2021-04-27 北京奇艺世纪科技有限公司 一种选择数据库的方法和装置
CN110727702B (zh) * 2019-09-16 2024-01-26 平安科技(深圳)有限公司 数据查询方法、装置、终端和计算机可读存储介质
CN110659295B (zh) * 2019-09-25 2023-03-24 北京浪潮数据技术有限公司 一种基于hawq记录有效数据的方法、装置和介质
CN112905587B (zh) * 2019-12-04 2024-05-14 北京金山云网络技术有限公司 数据库的数据管理方法、装置及电子设备
CN111427911A (zh) * 2020-03-25 2020-07-17 平安医疗健康管理股份有限公司 数据查询方法、装置、计算机设备和存储介质
CN111460037A (zh) * 2020-04-03 2020-07-28 中国建设银行股份有限公司 金融数据查询方法及装置
CN111563125B (zh) * 2020-05-08 2024-04-16 中国工商银行股份有限公司 数据存储系统、数据查询方法及装置
CN112817969B (zh) * 2021-01-14 2023-04-14 内蒙古蒙商消费金融股份有限公司 数据查询方法、系统、电子设备和存储介质
CN112732678B (zh) * 2021-01-18 2024-01-26 中国民航信息网络股份有限公司 数据比对的方法、系统、电子设备及计算机存储介质
CN113626524A (zh) * 2021-08-12 2021-11-09 浙江网商银行股份有限公司 数据处理方法及装置、数据核对系统
CN115495457B (zh) * 2022-11-16 2023-04-07 青岛以萨数据技术有限公司 基于单机向量数据库的数据处理系统、设备及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102486775A (zh) * 2010-12-01 2012-06-06 金蝶软件(中国)有限公司 业务数据的查询方法及装置
US20140330785A1 (en) * 2012-03-29 2014-11-06 Hitachi Data Systems Corporation Highly available search index with storage node addition and removal
CN105589864A (zh) * 2014-10-22 2016-05-18 中兴通讯股份有限公司 数据查询方法及装置
CN105786990A (zh) * 2016-02-17 2016-07-20 蓝网科技股份有限公司 数据库数据存储和快速查询的方法及装置

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20080034347A1 (en) * 2006-07-31 2008-02-07 Subramanyam V System and method for software lifecycle management
CN103226550B (zh) * 2012-01-31 2018-05-29 深圳市世纪光速信息技术有限公司 一种基于查询输入的热点事件确定方法和系统
CN102711076B (zh) * 2012-05-24 2015-02-11 武汉诚迈科技有限公司 一种实时预测手机通话余额的方法
CN103778148B (zh) * 2012-10-23 2017-04-12 阿里巴巴集团控股有限公司 Hadoop分布式文件系统数据文件的生命周期管理方法和设备
US9201969B2 (en) * 2013-01-31 2015-12-01 Lexisnexis, A Division Of Reed Elsevier Inc. Systems and methods for identifying documents based on citation history
CN104750740B (zh) * 2013-12-30 2018-05-08 北京新媒传信科技有限公司 数据更新的方法及装置
US10789300B2 (en) * 2014-04-28 2020-09-29 Red Hat, Inc. Method and system for providing security in a data federation system
CN103995879B (zh) * 2014-05-27 2017-12-15 华为技术有限公司 基于olap系统的数据查询方法、装置及系统
CN104008212B (zh) * 2014-06-23 2017-05-03 中国科学院重庆绿色智能技术研究院 一种地理位置信息相关联的物联网时间序列数据存取方法
CN105653560B (zh) * 2014-11-28 2019-05-14 华为软件技术有限公司 数据归档方法和装置
CN104572867A (zh) * 2014-12-18 2015-04-29 上海新炬网络信息技术有限公司 一种基于Oracle的数据处理方法
CN105512200A (zh) * 2015-11-26 2016-04-20 华为技术有限公司 一种分布式数据库处理的方法和设备
CN105550204A (zh) * 2015-12-01 2016-05-04 小米科技有限责任公司 控制位置定位模块的方法及装置
CN106023588B (zh) * 2016-06-15 2018-07-06 招商局重庆交通科研设计院有限公司 一种基于交通大数据的行程时间提取、预测及查询方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102486775A (zh) * 2010-12-01 2012-06-06 金蝶软件(中国)有限公司 业务数据的查询方法及装置
US20140330785A1 (en) * 2012-03-29 2014-11-06 Hitachi Data Systems Corporation Highly available search index with storage node addition and removal
CN105589864A (zh) * 2014-10-22 2016-05-18 中兴通讯股份有限公司 数据查询方法及装置
CN105786990A (zh) * 2016-02-17 2016-07-20 蓝网科技股份有限公司 数据库数据存储和快速查询的方法及装置

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111339560A (zh) * 2020-02-26 2020-06-26 中国邮政储蓄银行股份有限公司 一种数据隔离方法、装置及系统
WO2022006794A1 (en) * 2020-07-08 2022-01-13 Alibaba Group Holding Limited Routing directives for partitioned databases

Also Published As

Publication number Publication date
CN108427684A (zh) 2018-08-21
CN108427684B (zh) 2020-12-25

Similar Documents

Publication Publication Date Title
WO2018149271A1 (zh) 数据查询方法、装置及计算设备
US10872101B2 (en) Distributed database processing method and device
US11550769B2 (en) Data processing method, apparatus, and system
US20220405284A1 (en) Geo-scale analytics with bandwidth and regulatory constraints
CN107784044B (zh) 表数据查询方法及装置
CN109906448B (zh) 用于促进可插拔数据库上的操作的方法、设备和介质
CN107391758B (zh) 数据库切换方法、装置及设备
WO2017092470A1 (zh) 数据存储方法和装置
CN110147407B (zh) 一种数据处理方法、装置及数据库管理服务器
US20140222873A1 (en) Information system, management apparatus, method for processing data, data structure, program, and recording medium
TW201800967A (zh) 分布式流式資料處理的方法和裝置
US20180293257A1 (en) Method for accessing distributed database and distributed data service apparatus
US8015195B2 (en) Modifying entry names in directory server
CN107870949B (zh) 数据分析作业依赖关系生成方法和系统
US10762068B2 (en) Virtual columns to expose row specific details for query execution in column store databases
CN113111038B (zh) 文件存储方法、装置、服务器及存储介质
US20230024345A1 (en) Data processing method and apparatus, device, and readable storage medium
US11496562B1 (en) Method and system for accessing digital object in human-cyber-physical environment
CN109918369B (zh) 数据存储方法及装置
JP2022543306A (ja) ブロックチェーンデータ処理の方法、装置、機器及び可読記憶媒体
WO2017157111A1 (zh) 防止内存数据丢失的的方法、装置和系统
CN113051271B (zh) 一种冷热数据分离方法、装置及其设备
US8548980B2 (en) Accelerating queries based on exact knowledge of specific rows satisfying local conditions
CN109063061B (zh) 跨分布式系统数据处理方法、装置、设备及存储介质
CN112579633A (zh) 一种数据检索方法、装置、设备及存储介质

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

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

Country of ref document: EP

Kind code of ref document: A1