WO2019075849A1 - 数据的分区存储方法、装置、计算机设备及存储介质 - Google Patents

数据的分区存储方法、装置、计算机设备及存储介质 Download PDF

Info

Publication number
WO2019075849A1
WO2019075849A1 PCT/CN2017/112721 CN2017112721W WO2019075849A1 WO 2019075849 A1 WO2019075849 A1 WO 2019075849A1 CN 2017112721 W CN2017112721 W CN 2017112721W WO 2019075849 A1 WO2019075849 A1 WO 2019075849A1
Authority
WO
WIPO (PCT)
Prior art keywords
partition table
time interval
data
parent
table corresponding
Prior art date
Application number
PCT/CN2017/112721
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 WO2019075849A1 publication Critical patent/WO2019075849A1/zh

Links

Images

Classifications

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

Definitions

  • the present application relates to the field of computer technology, and in particular, to a partition storage method, device, computer device, and storage medium for data.
  • the storage of data in the database is generally stored according to the time of receiving the data.
  • operations such as data query or deletion
  • Operation in actual application, found that the current storage method of such a database is not suitable for data storage in a large platform such as the enterprise service governance monitoring platform.
  • the data in such a large platform can receive tens of millions of data per day, the database.
  • a method, an apparatus, a computer device, and a storage medium for partitioning data are provided.
  • a method for partitioning data storage comprising:
  • the data to be stored is stored in the obtained sub-partition table.
  • a partitioned storage device for data comprising:
  • a partition table creation module configured to create a parent partition table corresponding to the service identifier in the database, and create a child partition table corresponding to the time interval under the parent partition table;
  • a service identifier extraction module configured to: when receiving data to be stored, extract a service identifier carried by the data;
  • a time acquisition module configured to acquire a time for receiving the data, and determine a time interval to which the time belongs
  • a partition table obtaining module configured to obtain a parent partition table corresponding to the extracted service identifier, and obtain a child partition table corresponding to the determined time interval under the parent partition table;
  • a storage module configured to store the data to be stored into the obtained sub-partition table.
  • a computer device comprising a memory and a processor, the memory storing computer readable instructions, the computer readable instructions being executed by the processor, causing the processor to perform the step of: creating and a parent partition table corresponding to the business identifier, and a child partition table corresponding to the time interval is created under the parent partition table;
  • the data to be stored is stored in the obtained sub-partition table.
  • a computer readable storage medium having a computer readable storage medium Reading instructions that, when executed by the processor, cause the processor to perform the steps of: creating a parent partition table corresponding to the business identifier in the database, and creating a time interval under the parent partition table Corresponding sub-partition table;
  • the data to be stored is stored in the obtained sub-partition table.
  • FIG. 1 is a flow chart of a method of partition storage of data according to an embodiment of the present application
  • FIG. 2 is a flowchart of a method for partition storage of data according to another embodiment of the present application.
  • FIG. 3 is a flowchart of a method for partition storage of data according to still another embodiment of the present application.
  • FIG. 4 is a flowchart of a method for partition storage of data according to still another embodiment of the present application.
  • FIG. 5 is a block diagram showing an exemplary structure of a partition storage device for data according to an embodiment of the present application.
  • FIG. 6 is a schematic diagram showing the internal structure of a computer device according to an embodiment of the present application.
  • the computer device may be a server or a terminal device. As shown in FIG. 1, the method includes the following steps S101 to S105.
  • the data to be stored is not limited to the source and the type of the data, and may be stored using the storage method provided by the present application as long as it is data that needs to be stored with the service identifier.
  • the service identifier may be encapsulated in the data to be stored, or may be used as a separate data source, which is not limited herein.
  • two parent partition tables are created in the database according to instructions input by the programmer, respectively for storing data of the subsidiary A and the data of the subsidiary B, and in the two parent partitions.
  • five sub-partition tables are created with the number of days in Sunday, which are Monday's child partition table, Tuesday's child partition table, ..., Sunday's child partition table, when the subsidiary is received at 10 am on Monday.
  • the data to be stored is sent by A, it is judged that the received time belongs to the time interval of Monday, and the received data is stored in the sub-partition table of Monday under the parent partition table of company A.
  • the step of creating a parent partition table corresponding to the service identifier in the database and creating a child partition table corresponding to the time interval under the parent partition table includes the following steps (1) to ( 3):
  • the time interval may be one day or one month.
  • the number of the sub-partition table is different according to the division criterion of the time interval.
  • the number of the sub-partition table may be seven, when one is
  • the month of the year is the basis of division, the number of the sub-partition table may be 12, and when the day of the month is used as the division criterion, the number of the sub-partition table may be 28, 29, 30 or 31.
  • the foregoing determining the correspondence between the unit time period and the sub-partition table according to the time sequence of the time interval may be determining the correspondence between the unit time period and the sub-partition table according to the positive sequence of time, or may be according to time
  • the reverse order determines the correspondence between the unit time period and the child partition table.
  • the time intervals are Monday, Tuesday, ..., Sunday, respectively, Monday may be matched with the first child partition table, and the Tuesday and the second child partition table may be Correspondence, ..., and Sunday corresponds to the 7th sub-partition table.
  • the above step S101 further creates a parent partition table corresponding to the service identifier in the database according to the received instruction, and creates a child partition table corresponding to the time interval under the parent partition table. .
  • the received instruction may be a programming instruction input by a programmer, and the programmer may input a programming instruction on the application end through an input device such as a keyboard or a disk, and create a service identifier in the database by using the instruction.
  • an input device such as a keyboard or a disk
  • Corresponding parent partition table and then create a child partition table corresponding to the time interval under each parent partition table.
  • the foregoing service identifier may be determined according to an actual usage scenario. For example, when storing a large number of data of different subsidiaries in a database, different codes may be set for each subsidiary, and each code corresponds to one of the subsidiaries.
  • the above service identifiers may be codes corresponding to respective subsidiaries.
  • Another example is when storing a large amount of data generated by different applications in a database. Different unique encodings can be set for different applications, in which case the above-mentioned service identifiers may be encodings corresponding to the respective applications. What kind of information is specifically used as the service identifier in this step can be set by the programmer according to actual needs.
  • the length of the time interval and the division basis may also be set by actual usage requirements.
  • the time interval can be set to be slightly shorter, for example, one day or one hour, when the amount of stored data needs to be stored for a long time or the capacity of the database is much larger than In the daily data throughput, the time interval can be set to be slightly longer, for example, one week or one month.
  • the division may be based on division within one day, and when in days, division may be performed within one week or within one month. .
  • a parent partition table corresponding to the service identifier is created in the database according to the received instruction, and a child partition table corresponding to the time interval is created under the parent partition table, and when the data to be stored is received, According to the service identifier included in the data and the time of receiving the data, the data is stored in the corresponding sub-partition table under the corresponding parent partition table, so that when the user performs data query or data deletion, only the sub-partition table needs to be queried. Yes, there is no need to separately query a certain data from the database for deletion, which improves the efficiency of data query and shortens the response time of data query and data deletion.
  • FIG. 2 is a flowchart of a method for partitioning data according to another embodiment of the present application.
  • a partition storage method for data according to an embodiment of the present application is described in detail below with reference to FIG. 2, as shown in FIG.
  • the following steps S201 to S204 are further included.
  • the service identifier may be a code identifying a certain subsidiary, and the query period is, for example, Monday to Wednesday.
  • the service identifier and the query time period can be connected by preset characters, for example, the underscore "_”, and the start time and the end time of the query time period can be connected by the connector "-", when the service corresponding to the subsidiary A is used.
  • the code of the logo is pa011
  • the code of the service identifier corresponding to the subsidiary B is pa012, such as 01 to 07 respectively correspond to Monday to Sunday, when needed
  • S202 queries a parent partition table corresponding to the received service identifier.
  • S203 queries, in the parent partition table, a time interval that belongs to the query time period, and obtains a sub-partition table corresponding to the time interval of the query.
  • S204 takes the data stored in the sub-partition table of the query as a result of the query.
  • the query instruction may be, for example, clicking a query button on the screen, and may be a query command by voice input or the like.
  • the method further includes:
  • the data stored in the queried sub-partition table is deleted by the input truncate command.
  • the truncate command when the deletion is performed, the truncate command is used to delete the data stored in the sub-partition table, and the data stored in the parent partition table is not affected, and the truncate delete command is on a variety of tables, whether it is a large amount of data. Still a small amount of data is very fast, the delete command will not be revoked, so the efficiency of data deletion can be further improved.
  • This embodiment provides a scheme for the user to perform manual query and manual deletion.
  • the user can query the corresponding sub-partition table in the database by inputting the service identifier and the query time period that need to be queried, and use the content stored in the sub-partition table as the query.
  • it is avoided to find the required data in each of the stored data to shorten the query time.
  • all the data stored in the sub-partition table is directly deleted, and it is not necessary to separately delete each data, and the time for data deletion can also be shortened.
  • FIG. 3 is a flowchart of a method for partition storage of data according to still another embodiment of the present application.
  • a partition storage method for data according to an embodiment of the present application is described in detail below with reference to FIG. 3, as shown in FIG. Including the above steps S102 to S105, the following steps S301 to S303 are further included.
  • S301 Receive a time interval of input and at least one service identifier.
  • the foregoing service identifier and the time interval are in a one-to-many relationship, and the time interval corresponding to each service identifier may be multiple, and the time intervals under different service identifiers may be the same.
  • the time interval corresponding to the code of the subsidiary A may be Monday, Tuesday, ..., Sunday, and similarly, corresponding to the code of the subsidiary B.
  • the time interval can also be Monday, Tuesday, ..., Sunday.
  • the parent partition table may have a one-to-one correspondence with the service identifier, and the number of the parent partition table may also correspond to the number of the service identifier.
  • data can be stored by creating a parent partition table corresponding to the subsidiary code, and then creating corresponding sub-partition tables in the parent partition table.
  • the step may create a sub-partition table corresponding to the received time interval under each of the parent partition tables by using a partition key, and the partition key is a set of data columns that determine which partition the data row belongs to.
  • the Oracle database can automatically select partitions based on the partitioning key when performing insert, update, and delete operations. Each row of data in a partitioned table can and can only be assigned to one partition.
  • the method for creating a parent partition table and a sub-partition table on demand can avoid creating a useless partition table in the database, thereby saving storage space.
  • step S101 is a flowchart of a method for partitioning data according to still another embodiment of the present application.
  • a partition storage method for data according to an embodiment of the present application is described in detail below with reference to FIG. 4, as shown in FIG. 4.
  • the time interval is divided according to the number of days in the week, and the above step S101 further includes:
  • a parent partition table corresponding to the service identifier is created in the database, and a child partition table corresponding to the time interval is created under the parent partition table, and the time interval is divided according to the number of days in the week.
  • the method of partition storage of the data further includes the following steps S401 to S403:
  • the selection instruction of the parent partition table may be determined by inputting a service identifier corresponding to the parent partition table, wherein the input manner may be input by means of a mouse and keyboard.
  • S402. Determine the next Sunday number of the number of Sundays to which the current time belongs.
  • the operation of automatically deleting in the above step S403 deletes the data stored in the corresponding sub-partition table by using the input truncate command, thereby further improving the efficiency of data deletion.
  • the number of Sundays is used as a basis for dividing the time interval, and the date can be converted differently. For example, it is not necessary to convert different times between the size month and the second month, and it is not necessary to consider the leap year, which can simplify the difficulty of implementation of the present application.
  • the time interval is divided into months.
  • the partition storage method of the data further includes the following steps 1 to 1 based on the steps S101 to S105. Step 3:
  • the February is determined as the next month.
  • the operation of automatically deleting in the above step may also delete the data stored in the corresponding sub-partition table by using the input truncate command, thereby further improving the efficiency of data deletion.
  • the storage period of the data is set by dividing the month as a time interval. For one year, the data can be stored for a longer period of time, which can be applied to the storage and management of small data volumes.
  • the embodiment provides a method for automatically deleting data according to the partition storage method of the foregoing data.
  • a storage period of the data for example, one week or one month
  • the next time of the time interval in which the current time is located is set.
  • the data in the partition table corresponding to the interval is deleted, so that when the next time interval arrives, the data received in the time interval can be stored in the corresponding sub-partition table, and the efficiency of automatic deletion is higher than the efficiency of manual deletion. Can further improve the efficiency of data deletion.
  • the partition storage method of the data provided in this embodiment can be applied to the list partition of the first layer in the database, and the second layer can be implemented by the HASH partition (also called hash partition), and the hash partition is specified by the partition number.
  • HASH partition also called hash partition
  • a partition type that evenly distributes data. Because the partitions are uniformly sized by hash partitioning on I/O (input/output) devices, the data of each partition in the HASH partition can be made more balanced.
  • the labels of the foregoing steps S101 to S404 are not used to limit the sequence of the steps in the embodiment, and the numbers of the steps are only for making it convenient to refer to the labels of the steps when describing the steps.
  • the above step S102 may be performed before the step of S103 or after the step of step S103, as long as the order of execution of the respective steps does not affect the logical relationship of the embodiment, which is within the scope of the claimed application.
  • FIG. 5 is a block diagram showing an exemplary structure of a partition storage device for data according to an embodiment of the present application.
  • a partition storage device for data according to an embodiment of the present application is described in detail below with reference to FIG. 5, as shown in FIG.
  • the partitioned storage device 10 of data includes:
  • a partition table creating module 11 is configured to create a parent partition table corresponding to the service identifier in the database, and create a child partition table corresponding to the time interval under the parent partition table;
  • the service identifier extraction module 12 is configured to: when receiving the data to be stored, extract the service identifier carried by the data;
  • the time obtaining module 13 is configured to acquire a time for receiving the data, and determine a time interval to which the time belongs;
  • the partition table obtaining module 14 is configured to obtain a parent partition table corresponding to the extracted service identifier, And obtaining a sub-partition table corresponding to the determined time interval under the parent partition table;
  • the storage module 15 is configured to store the data to be stored into the obtained sub-partition table.
  • the received instruction may be a programming instruction input by a programmer, and the programmer may input a programming instruction on the application end through an input device such as a keyboard or a disk, and create a parent partition table corresponding to the service identifier in the database by the instruction. Then create a child partition table corresponding to the time interval under each parent partition table.
  • the partitioned storage device of the foregoing data further includes:
  • the query time period receiving module is configured to receive the input service identifier and the query time period when receiving the query instruction;
  • a parent partition table query module configured to query a parent partition table corresponding to the received service identifier
  • a sub-partition table query module configured to query a time interval belonging to the query time period in the parent partition table, and obtain a sub-partition table corresponding to the time interval of the query;
  • the result query module is configured to use the data stored in the sub-partition table of the query as a result of the query.
  • the partitioned storage device of the data further includes:
  • the deleting module is configured to delete the data stored in the sub-partition table of the query when receiving the delete instruction.
  • the deleting module deletes the data stored in the queried sub-partition table by using the input truncate command.
  • the truncate command when the deletion is performed, the truncate command is used to delete the data stored in the sub-partition table, and the data stored in the parent partition table is not affected, and the truncate delete command is on a variety of tables, whether it is a large amount of data. Still a small amount of data is very fast, the delete command will not be revoked, so the efficiency of data deletion can be further improved.
  • the partition table creation module described above further includes:
  • a receiving unit configured to receive an input time interval and at least one service identifier
  • a parent partition table creating unit configured to create a parent partition table corresponding to each received service identifier
  • the sub-partition table creation unit is configured to create a sub-partition table corresponding to the received time interval under each of the parent partition tables, and the partition key has a one-to-one correspondence with the sub-partition table under the parent partition table.
  • the sub-partition table creation unit may create a sub-partition table corresponding to the received time interval under each of the parent partition tables by using a partition key.
  • the partition table creation module described above further includes:
  • a time interval receiving unit configured to receive the input month or the number of days determined by the week to obtain the time interval
  • a number determining unit configured to determine the number of sub-partition tables in the parent partition table according to the number of the time intervals
  • the correspondence determining unit is configured to determine a correspondence between the unit time period and the sub-partition table according to a time sequence of each time interval.
  • the time interval is divided into months
  • the partition storage device 10 of the data further includes:
  • the month determination module is used to determine the next month of the month to which the current time belongs;
  • An automatic deletion module for automatically deleting data stored in a child partition table corresponding to the next month in the selected parent partition table.
  • the time interval is divided according to the number of days in the week, and the partition storage device 10 of the data further includes:
  • a Sunday number determination module for determining the next Sunday number of days of the week to which the current time belongs
  • the above automatic deletion module is further configured to automatically delete data stored in the child partition table corresponding to the next Sunday number in the selected parent partition table.
  • the automatic deletion module deletes the data stored in the corresponding sub-partition table by using the input truncate command.
  • each module included in the partition storage device of the data may be implemented in whole or in part by software, hardware or a combination thereof. Further, each module in the partition storage device of the data may be a program segment for implementing a corresponding function.
  • the various modules in the partitioned storage device of the above data may be implemented in whole or in part by software, hardware, and combinations thereof.
  • the network interface may be an Ethernet card or a wireless network card.
  • the above modules may be embedded in the hardware in the processor or in the memory in the server, or may be stored in the memory in the server, so that the processor calls the corresponding operations of the above modules.
  • the processor can be a central processing unit (CPU), a microprocessor, a microcontroller, or the like.
  • the partitioned storage device of the above data may be embodied in the form of a computer readable instruction that can be executed on a computer device as shown in FIG.
  • a computer apparatus includes a memory, a processor, and computer readable instructions stored on the memory and executable on the processor, the processor performing partition storage of the data when executing the program method.
  • the embodiment of the present application provides a computer device.
  • the internal structure of the computer device may correspond to the structure shown in FIG. 6.
  • the computer device may be a terminal or a server, and includes a series of computers stored in the memory.
  • the readable instructions when the computer readable instructions are executed by the processor, may implement a partitioned storage method of data proposed by embodiments of the present application.
  • the computer device includes a processor coupled through a system bus, a computer readable storage medium, an internal memory, an input device, a display screen, and a network interface.
  • the computer readable storage medium of the computer device can store an operating system and computer readable instructions that, when executed, cause the processor to perform a partitioned storage method of data of embodiments of the present application, For the specific implementation process of the method, reference may be made to the specific content of each embodiment in FIG. 1 to FIG. 4, and details are not described herein again.
  • the processor of the computer device is used to provide computing and control capabilities to support the operation of the entire computer device.
  • the computer readable storage medium can store computer readable instructions that, when executed by the processor, cause the processor to perform a partitioned storage method of data.
  • the internal memory provides a cached runtime environment for computer readable instructions in a computer readable storage medium.
  • the input device of the computer device is used for input of various parameters
  • the display screen of the computer device is used for display
  • the network interface of the computer device is used for network communication. It will be understood by those skilled in the art that the structure shown in FIG. 6 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation of the computer device to which the solution of the present application is applied.
  • the specific computer device may Including the map Show more or fewer parts, or combine some parts, or have different part arrangements.
  • Non-volatile memories can include read only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory.
  • ROM read only memory
  • PROM programmable ROM
  • EPROM electrically programmable ROM
  • EEPROM electrically erasable programmable ROM
  • the embodiment further provides a computer readable storage medium having stored thereon computer readable instructions, the program being executed by the processor to implement various steps in the partition storage method of the data.
  • all or part of the processes in the foregoing embodiment may be completed by instructing related hardware by computer readable instructions, and the program may be stored in a computer readable storage medium, for example, Non-volatile storage medium, as in the embodiment of the present application, the program may be stored in a storage medium of the computer system and executed by at least one processor in the computer system to implement an embodiment comprising the methods as described above Process.
  • the storage medium includes, but is not limited to, a magnetic disk, a USB flash drive, an optical disk, a read-only memory (ROM), and the like.
  • a parent partition table corresponding to the service identifier is created in the database according to the received instruction, and a child partition table corresponding to the time interval is created under the parent partition table, and when the data to be stored is received, According to the service identifier included in the data and the time of receiving the data, the data is stored in the corresponding sub-partition table under the corresponding parent partition table, so that when the user performs data query or data deletion, only the sub-partition table needs to be queried. Yes, there is no need to separately query a certain data from the database for deletion, which improves the efficiency of data query and shortens the response time of data query and data deletion.

Landscapes

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

Abstract

一种数据的分区存储方法,包括:在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表(S101);当接收到待存储的数据时,提取该数据携带的业务标识(S102);获取接收该数据的时间,并确定所述时间所属的时间区间(S103);获取与提取的所述业务标识相对应的父分区表,并获取所述父分区表下与确定的所述时间区间相对应的子分区表(S104);将该待存储的数据存储至获取的所述子分区表中(S105)。

Description

数据的分区存储方法、装置、计算机设备及存储介质
本申请要求于2017年10月17日提交中国专利局、申请号为2017109622009、发明名称为“数据的分区存储方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。
技术领域
本申请涉及计算机技术领域,特别是涉及数据的分区存储方法、装置、计算机设备及存储介质。
背景技术
目前数据库中对于数据的存储一般是按照接收数据的时间进行存储,在进行数据查询或删除等操作时,需要在数据库的所有数据中查找出符合要求的数据,再根据删除等操作命令执行对应的操作,在实际运用中发现,目前的这种数据库的存储方式并不适用于企业服务治理监控平台这类大平台中的数据存储,这种大平台中的数据每天可以接收大几千万的数据,数据库存储的数据达到几十T(Tera,计算机的国际计数单位,表示“太拉”,1T=1024G),在实际应用时发现,查询30分钟之内的数据都需要至少两分钟,数据库服务器的压力很大,经常需要扩容,且用户也需要等待比较久的时间,目前这种数据库中数据的存储方式丞待改进。
发明内容
根据本申请的各种实施例,提供一种数据的分区存储方法、装置、计算机设备及存储介质。
一种数据的分区存储方法,该方法包括:
在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表;
当接收到待存储的数据时,提取该数据携带的业务标识;
获取接收该数据的时间,并确定所述时间所属的时间区间;
获取与提取的所述业务标识相对应的父分区表,并获取所述父分区表下与确定的所述时间区间相对应的子分区表;及
将该待存储的数据存储至获取的所述子分区表中。
一种数据的分区存储装置,该装置包括:
分区表创建模块,用于在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表;
业务标识提取模块,用于当接收到待存储的数据时,提取该数据携带的业务标识;
时间获取模块,用于获取接收该数据的时间,并确定所述时间所属的时间区间;
分区表获取模块,用于获取与提取的所述业务标识相对应的父分区表,并获取所述父分区表下与确定的所述时间区间相对应的子分区表;及
存储模块,用于将该待存储的数据存储至获取的所述子分区表中。
一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行以下步骤:在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表;
当接收到待存储的数据时,提取该数据携带的业务标识;
获取接收该数据的时间,并确定所述时间所属的时间区间;
获取与提取的所述业务标识相对应的父分区表,并获取所述父分区表下与确定的所述时间区间相对应的子分区表;及
将该待存储的数据存储至获取的所述子分区表中。
一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机可 读指令,所述计算机可读指令被处理器执行时,使得所述处理器执行以下步骤:在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表;
当接收到待存储的数据时,提取该数据携带的业务标识;
获取接收该数据的时间,并确定所述时间所属的时间区间;
获取与提取的所述业务标识相对应的父分区表,并获取所述父分区表下与确定的所述时间区间相对应的子分区表;及
将该待存储的数据存储至获取的所述子分区表中。
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征、目的和优点将从说明书、附图以及权利要求书变得明显。
附图说明
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。
图1为根据本申请的一个实施例的数据的分区存储方法的流程图;
图2为根据本申请的另一实施例的数据的分区存储方法的流程图;
图3为根据本申请的又一实施例的数据的分区存储方法的流程图;
图4为根据本申请的再一实施例的数据的分区存储方法的流程图;
图5为根据本申请的一个实施例的数据的分区存储装置的示范性结构框图;
图6为根据本申请的一个实施例的计算机设备的内部结构示意图。
具体实施方式
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施 例仅仅用以解释本申请,并不用于限定本申请。
图1为根据本申请的一个实施例的数据的分区存储方法的流程图,下面结合图1来详细描述根据本申请的一个实施例的数据的分区存储方法,该方法可应用于具有存储功能的计算机设备,具体可以是服务器,也可以是终端设备,如图1所示,该方法包括以下步骤S101至S105。
S101、在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表。
S102、当接收到待存储的数据时,提取该数据携带的业务标识。
根据本实施例的一个示例,上述待存储的数据不限于数据的来源和种类,只要是携带有业务标识的需要存储的数据,均可以使用本申请提供的存储方法进行存储。其中,该业务标识可以封装在该待存储的数据中,也可以作为单独的数据来源,在此不做限定。
S103、获取接收该数据的时间,并确定所述时间所属的时间区间。
S104、获取与提取的所述业务标识相对应的父分区表,并获取所述父分区表下与确定的所述时间区间相对应的子分区表。
S105、将该待存储的数据存储至获取的所述子分区表中。
根据本实施例的一个使用场景A例如,根据程序员输入的指令,在数据库中创建两个父分区表,分别用于存储子公司A的数据和子公司B的数据,并在这两个父分区表中以星期天数为时间区间创建了五个子分区表,分别为星期一的子分区表、星期二的子分区表、...、星期天的子分区表,当在周一上午十点接收到子公司A发来的待存储的数据时,判断接收的时间属于星期一这个时间区间内,则将接收到的数据存储在公司A的父分区表下的星期一的子分区表中。
在其中一个实施例中,上述在数据库中创建与业务标识相对应的父分区表,并在该父分区表下创建与时间区间相对应的子分区表的步骤包括以下步骤(1)至步骤(3):
(1)、接收输入月份或按星期确定的天数,以得到该时间区间。
其中,该时间区间可以是一天,也可以是一个月。
(2)、根据该时间区间的个数,确定该父分区表中子分区表的个数。
根据本实施例的一个示例,子分区表的个数根据时间区间的划分标准而不同,当以一周中的五天为划分依据时,该子分区表的个数可以为7个,当以一年中的月份为划分依据时,该子分区表的个数可以为12个,当以一个月中的一天为划分标准时,该子分区表的个数可以为28个、29个、30个或者31个。
(3)、按照各个时间区间的时间顺序,确定该单位时间段与该子分区表的对应关系。
其中,上述的按照时间区间的时间顺序确定该单位时间段与该子分区表的对应关系,可以是按照时间的正顺序确定该单位时间段与该子分区表的对应关系,还可以是按照时间的逆顺序确定该单位时间段与该子分区表的对应关系。
根据本实施例的一个使用场景例如,所述时间区间分别为星期一、星期二、...、星期天,则可以将星期一与第1个子分区表相对应,将星期二与第2个子分区表相对应、...、将星期天与第7个子分区表相对应。
在其中的一个实施例中,上述步骤S101进一步为根据接收的指令,在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表。
根据本实施例的一个示例,上述接收的指令可以是接收程序员输入的编程指令,程序员可以通过键盘、输盘等输入装置在应用端输入编程指令,通过该指令在数据库中创建与业务标识相对应的父分区表,再在每个父分区表下创建与时间区间相对应的子分区表。
其中,上述的业务标识可以根据实际的使用场景进行确定,例如在数据库中存储大量不同子公司的数据时,可以对各个子公司设置不同的编码,每个编码对应其中一个子公司,这种情况下上述的业务标识可以是与各个子公司对应的编码。再例如当在数据库中存储大量不同的应用程序产生的数据时, 可以对不同的应用程序设置与其唯一对应的编码,这种情况下上述的业务标识可以是与各个应用程序相对应的编码。具体将何种信息作为该步骤中的业务标识可以由程序员根据实际的需要来设定。
根据本实施例的另一示例,上述的时间区间的长短以及划分依据也可以由实际的使用需求来设定。例如当需要存储的数据量非常大,甚至是海量时,可以将该时间区间设置的稍短,例如为一天或者是一个小时,当存储的数据量需要存储很长时间或者是数据库的容量远大于日常的数据吞吐量时,可以将该时间区间设置的稍长,例如可以是一周或者是一个月。其中,当上述的时间区间以小时为单位时,划分的依据可以是在一天之内进行划分,当以天为单位时,则既可以在一周之内进行划分也可以在一个月之内进行划分。
本实施例通过根据接收的指令,在数据库中创建与业务标识相对应的父分区表,并在该父分区表下创建与时间区间相对应的子分区表,当接收到待存储的数据时,根据该数据中包含的业务标识及接收该数据的时间,将该数据存储至对应的父分区表下对应的子分区表中,使得用户进行数据查询或数据删除时,只需要查询子分区表即可,不需要从数据库中单独地查询某一个数据进行删除,提高了数据查询的效率,缩短了数据查询及数据删除的响应时间。
图2为根据本申请的另一实施例的数据的分区存储方法的流程图,下面结合图2来详细描述根据本申请的一个实施例的数据的分区存储方法,如图2所示,该方法在包括上述步骤S101至S105的基础上,还包括以下步骤S201至S204。
S201、接收到查询指令时,接收输入的业务标识及查询时间段。
其中,上述的业务标识可以是标识某个子公司的编码,上述查询时间段例如星期一至星期三。其中输入的业务标识及查询时间段可以通过预设的字符来连接,例如下划线“_”,可以通过连接符“-”来连接查询时间段的起点时间和结束时间,当与子公司A对应业务标识的编码为pa011、与子公司B对应业务标识的编码为pa012时,如01至07分别对应星期一至星期天,当需要 查询子公司A星期一到星期三的数据时,可以通过输入“pa011_01-pa011_03”来查找对应的子分区表。
S202查询与接收的该业务标识对应的父分区表。
S203在该父分区表中查询属于该查询时间段的时间区间,并获取查询的该时间区间所对应的子分区表。
S204将存储在查询的该子分区表中的数据作为该查询的结果。
根据本实施例的一个使用场景,上述的查询指令例如可以是点击屏幕上的查询按钮,可以是通过语音输入查询指令等等。
根据本实施例的一个示例,该方法还包括:
接收到删除指令时,将查询的所述子分区表中存储的数据进行删除。
根据本实施例的一个示例,通过输入的truncate命令对查询到的子分区表中存储的数据进行删除。
本实施例在进行删除时选择用truncate命令进行删除可以在清空存储在子分区表的数据时不对存储在父分区表中的数据造成影响,且truncate删除命令在各种表上无论是大量数据的还是少量数据都非常快,该删除命令不会被撤销,因此可以进一步提高数据删除的效率。
本实施例提供了用户进行手动查询和手动删除的方案,用户可以通过输入需要查询的业务标识及查询时间段,在数据库中查询对应的子分区表,将子分区表中存储的内容作为查询的结果,避免了在存储的每个数据中查找符合要求的数据,以缩短查询时间。且在进行数据删除时是直接删除子分区表中存储的全部数据,而不需要对每个数据进行单独的删除,同时也可缩短数据删除的时间。
图3为根据本申请的又一实施例的数据的分区存储方法的流程图,下面结合图3详细描述根据本申请的一个实施例的数据的分区存储方法,如图3所示,该方法在包括上述步骤S102至S105的基础上,还包括以下步骤S301至S303。
S301、接收输入的时间区间及至少一个业务标识。
根据本实施例的一个示例,上述的业务标识与时间区间是一对多的关系,标识每个业务标识相对应的时间区间可以是多个,不同的业务标识下的时间区间可以是相同的。例如当业务标识包括子公司A的编码和子公司B的编码时,与子公司A的编码对应的时间区间可以是星期一、星期二、...、星期天,同样地,与子公司B的编码对应的时间区间也可以是星期一、星期二、...、星期天。
S302、与接收的每个业务标识对应的创建一个父分区表。
其中,父分区表的可以与业务标识一一对应,父分区表的个数也可以与业务标识的个数一一对应。当需要新增存储一个子公司的数据时,可以通过再创建一个与该子公司编码相对应的父分区表,再在该父分区表中创建对应的各个子分区表来实现数据的存储。
S303、在每个该父分区表下创建与接收的时间区间相对应的子分区表,该分区键与该父分区表下的子分区表一一对应。
其中,该步骤可通过分区键在每个该父分区表下创建与接收的时间区间相对应的子分区表,该分区键(partition key)是决定数据行属于哪个分区的一组数据列。Oracle数据库在执行插入、更新、及删除操作时能根据分区键自动地选择分区。分区表内的每个数据行都能且只能分配到一个分区中(partition)。
本实施例提供的这种按需创建父分区表及子分区表的方法可以避免在数据库中创建无用的分区表,可以节省存储空间。
图4为根据本申请的再一实施例的数据的分区存储方法的流程图,下面结合图4来详细描述根据本申请的一个实施例的数据的分区存储方法,如图4所示,该方法在包括上述步骤S101至S105的基础上,上述时间区间按照星期中的天数进行划分,上述步骤S101进一步包括:
根据接收的指令,在数据库中创建与业务标识相对应的父分区表,并在该父分区表下创建与时间区间相对应的子分区表,该时间区间按照星期中的天数进行划分。
该数据的分区存储的方法还包括以下步骤S401至S403:
S401、接收父分区表的选择指令。
根据本实施例的一个示例,父分区表的选择指令可以通过输入父分区表对应的业务标识来确定,其中输入的方式可以是鼠标键盘的方式进行输入。
S402、确定当前时间所属星期天数的下一个星期天数。
根据本实施例的一个使用场景例如,当当前时间为星期一时,则将星期二确定为所述下一个星期天数。
S403、自动删除被选择的父分区表中与该下一个星期天数相对应的子分区表中存储的数据。
根据本实施例的一个示例,上述步骤S403中自动删除的操作通过输入的truncate命令对对应子分区表中存储的数据进行删除,可以进一步提高数据删除的效率。
本实施例将星期天数作为时间区间的划分依据可以不同对日期进行转换,例如不需要对大小月以及二月之间不同的时间进行转换,也不用考虑平年闰年,可以简化本申请实现的难度。
在其中一个实施例中,作为另外一个可选地方案,上述的时间区间以月份进行划分,本实施例中该数据的分区存储方法在包括上述步骤S101至S105的基础上还包括以下步骤1至步骤3:
1、接收父分区表的选择指令。
2、确定当前时间所属月份的下一个月份。
根据本实施例的一个使用场景例如,当当前时间为一月份时,则将二月份确定为所述下一个月份。
3、自动删除被选择的父分区表中与该下一个月份相对应的子分区表中存储的数据。
其中,上述步骤中自动删除的操作也可以通过输入的truncate命令对对应子分区表中存储的数据进行删除,可以进一步提高数据删除的效率。
本实施例通过将月份作为时间区间的划分依据,将数据的存储周期设定 为一年,使得数据可以存储更长的时间,可以适用于小数据量的存储和管理。
本实施例提供了一种依据上述数据的分区存储方法进行数据自动删除的方法,本实施例通过设定数据的存储周期,例如一周或是一个月,将当前时间所在的时间区间的下一个时间区间对应的分区表中的数据进行删除,使得当下一个时间区间到来时,可以将该时间区间内接收到的数据存储到对应的子分区表中,自动删除的效率要高于手动删除的效率,可以进一步提高数据删除的效率。
本实施例提供的数据的分区存储方法可适用于数据库中第一层的list分区,其第2层可以通过HASH分区(又称散列分区)的形式来实现,散列分区通过指定分区编号来均匀分布数据的一种分区类型,因为通过在I/O(输入/输出)设备上进行散列分区,使得这些分区大小一致,可以使得HASH分区中的各个分区的数据更加均衡。
根据本实施例的一个示例,上述步骤S101~S404的标号并不用于限定本实施例中各个步骤的先后顺序,各个步骤的编号只是为了使得描述各个步骤时可以通用引用该步骤的标号进行便捷的指代,例如上述步骤S102可以在S103的步骤之前,也可以在步骤S103的步骤之后,只要各个步骤执行的顺序不影响本实施例的逻辑关系即表示在本申请请求保护的范围之内。
图5为根据本申请的一个实施例的数据的分区存储装置的示范性结构框图,下面结合图5来详细描述根据本申请的一个实施例的数据的分区存储装置,如图5所示,该数据的分区存储装置10包括:
分区表创建模块11,用于在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表;
业务标识提取模块12,用于当接收到待存储的数据时,提取该数据携带的业务标识;
时间获取模块13,用于获取接收该数据的时间,并确定所述时间所属的时间区间;
分区表获取模块14,用于获取与提取的所述业务标识相对应的父分区表, 并获取所述父分区表下与确定的所述时间区间相对应的子分区表;
存储模块15,用于将该待存储的数据存储至获取的所述子分区表中。
其中,上述接收的指令可以是接收程序员输入的编程指令,程序员可以通过键盘、输盘等输入装置在应用端输入编程指令,通过该指令在数据库中创建与业务标识相对应的父分区表,再在每个父分区表下创建与时间区间相对应的子分区表。
在其中一个实施例中,上述的数据的分区存储装置还包括:
查询时间段接收模块,用于接收到查询指令时,接收输入的业务标识及查询时间段;
父分区表查询模块,用于查询与接收的该业务标识对应的父分区表;
子分区表查询模块,用于在该父分区表中查询属于该查询时间段的时间区间,并获取查询的该时间区间所对应的子分区表;
结果查询模块,用于将存储在查询的该子分区表中的数据作为该查询的结果。
在其中的一个实施例中,该数据的分区存储装置还包括:
删除模块,用于接收到删除指令时,将查询的所述子分区表中存储的数据进行删除。
根据本实施例的一个示例,上述的删除模块通过输入的truncate命令对查询到的子分区表中存储的数据进行删除。
本实施例在进行删除时选择用truncate命令进行删除可以在清空存储在子分区表的数据时不对存储在父分区表中的数据造成影响,且truncate删除命令在各种表上无论是大量数据的还是少量数据都非常快,该删除命令不会被撤销,因此可以进一步提高数据删除的效率。
在其中一个实施例中,上述的分区表创建模块还包括:
接收单元,用于接收输入的时间区间及至少一个业务标识;
父分区表创建单元,用于与接收的每个业务标识对应的创建一个父分区表;
子分区表创建单元,用于在每个该父分区表下创建与接收的时间区间相对应的子分区表,该分区键与该父分区表下的子分区表一一对应。
其中,该子分区表创建单元可通过分区键在每个该父分区表下创建与接收的时间区间相对应的子分区表。
在其中的一个实施例中,上述的分区表创建模块还包括:
时间区间接收单元,用于接收输入月份或按星期确定的天数,以得到该时间区间;
个数确定单元,用于根据该时间区间的个数,确定该父分区表中子分区表的个数;
对应关系确定单元,用于按照各个时间区间的时间顺序,确定该单位时间段与该子分区表的对应关系。
在其中的一个实施例中,上述的时间区间以月份进行划分,该数据的分区存储装置10还包括:
选择指令接收模块,用于接收父分区表的选择指令;
月份确定模块,用于确定当前时间所属月份的下一个月份;
自动删除模块,用于自动删除被选择的父分区表中与该下一个月份相对应的子分区表中存储的数据。
在其中的一个实施例中,上述时间区间按照星期中的天数进行划分,该数据的分区存储装置10还包括:
星期天数确定模块,用于确定当前时间所属星期天数的下一个星期天数;
上述自动删除模块还用于自动删除被选择的父分区表中与该下一个星期天数相对应的子分区表中存储的数据。
根据本实施例的一个示例,上述自动删除模块通过输入的truncate命令对对应子分区表中存储的数据进行删除。
其中,该数据的分区存储装置中包括的各个模块可全部或部分通过软件、硬件或其组合来实现。进一步地,该数据的分区存储装置中的各个模块可以是用于实现对应功能的程序段。
上述数据的分区存储装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。其中,网络接口可以是以太网卡或无线网卡等。上述各模块可以硬件形式内嵌于或独立于服务器中的处理器中,也可以以软件形式存储于服务器中的存储器中,以便于处理器调用执行以上各个模块对应的操作。该处理器可以为中央处理单元(CPU)、微处理器、单片机等。
上述数据的分区存储装置可以实现为一种计算机可读指令的形式,计算机可读指令可以在如图6所示的计算机设备上运行。
根据本申请的一个实施例提供的一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机可读指令,该处理器执行该程序时实现上述数据的分区存储方法。
本申请实施例提出了一种计算机设备,计算机设备的内部结构可对应于如图6所示的结构,该计算机设备既可以是终端,也可以是服务器,其包括一系列存储于存储器上的计算机可读指令,当该计算机可读指令被处理器执行时,可以实现本申请各实施例提出的数据的分区存储方法。在一个实施例中,该计算机设备包括通过系统总线连接的处理器、计算机可读存储介质、内存储器、输入装置、显示屏和网络接口。其中,该计算机设备的计算机可读存储介质可存储操作系统和计算机可读指令,该计算机可读指令被执行时,可使得处理器执行本申请各实施例的一种数据的分区存储方法,该方法的具体实现过程可参考图1至4各实施例的具体内容,在此不再赘述。该计算机设备的处理器用于提供计算和控制能力,支撑整个计算机设备的运行。该计算机可读存储介质中可储存有计算机可读指令,该计算机可读指令被处理器执行时,可使得处理器执行一种数据的分区存储方法。该内存储器为计算机可读存储介质中的计算机可读指令提供高速缓存的运行环境。计算机设备的输入装置用于各个参数的输入,计算机设备的显示屏用于进行显示,计算机设备的网络接口用于进行网络通信。本领域技术人员可以理解,图6中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所 示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
如此处所使用的对存储器、存储、数据库或其它介质的任何引用可包括非易失性。合适的非易失性存储器可包括只读存储器(ROM)、可编程ROM(PROM)、电可编程ROM(EPROM)、电可擦除可编程ROM(EEPROM)或闪存。
本实施例另提供一种计算机可读存储介质,其上存储有计算机可读指令,该程序被处理器执行时实现上述数据的分区存储方法中的各个步骤。
根据本实施例的一个示例,上述实施例方法中的全部或部分流程,可以通过计算机可读指令来指令相关的硬件来完成,所述程序可存储于一计算机可读取存储介质中,例如,非易失性存储介质,如本申请实施例中,该程序可存储于计算机系统的存储介质中,并被该计算机系统中的至少一个处理器执行,以实现包括如上述各方法的实施例的流程。该存储介质包括但不限于磁碟、优盘、光盘、只读存储记忆体(Read-Only Memory,ROM)等。
本实施例通过根据接收的指令,在数据库中创建与业务标识相对应的父分区表,并在该父分区表下创建与时间区间相对应的子分区表,当接收到待存储的数据时,根据该数据中包含的业务标识及接收该数据的时间,将该数据存储至对应的父分区表下对应的子分区表中,使得用户进行数据查询或数据删除时,只需要查询子分区表即可,不需要从数据库中单独地查询某一个数据进行删除,提高了数据查询的效率,缩短了数据查询及数据删除的响应时间。
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围 应以所附权利要求为准。

Claims (20)

  1. 一种数据的分区存储方法,包括:
    在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表;
    当接收到待存储的数据时,提取所述数据携带的业务标识;
    获取接收所述数据的时间,并确定所述时间所属的时间区间;
    获取与提取的所述业务标识相对应的父分区表,并获取所述父分区表下与确定的所述时间区间相对应的子分区表;及
    将所述待存储的数据存储至获取的所述子分区表中。
  2. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    接收到查询指令时,接收输入的业务标识及查询时间段;
    查询与接收的所述业务标识对应的父分区表;
    在所述父分区表中查询属于所述查询时间段的时间区间,并获取查询的所述时间区间所对应的子分区表;
    将存储在查询的所述子分区表中的数据作为所述查询的结果。
  3. 根据权利要求1所述的方法,其特征在于,所述在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表的步骤包括:
    接收输入的时间区间及至少一个业务标识;
    与接收的每个业务标识对应的创建一个父分区表;
    在每个所述父分区表下创建与接收的时间区间相对应的子分区表,所述分区键与所述父分区表下的子分区表一一对应。
  4. 根据权利要求1所述的方法,其特征在于,所述在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表的步骤包括:
    接收输入月份或按星期确定的天数,以得到所述时间区间;
    根据所述时间区间的个数,确定所述父分区表中子分区表的个数;
    按照各个时间区间的时间顺序,确定所述单位时间段与所述子分区表的对应关系。
  5. 根据权利要求1所述的方法,其特征在于,所述时间区间以月份进行划分;所述方法还包括:
    接收父分区表的选择指令;
    确定当前时间所属月份的下一个月份;
    自动删除被选择的父分区表中与所述下一个月份相对应的子分区表中存储的数据。
  6. 根据权利要求1所述的方法,其特征在于,所述时间区间按照星期中的天数进行划分;所述方法还包括:
    接收父分区表的选择指令;
    确定当前时间所属星期天数的下一个星期天数;
    自动删除被选择的父分区表中与所述下一个星期天数相对应的子分区表中存储的数据。
  7. 一种数据的分区存储装置,包括:
    分区表创建模块,用于在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表;
    业务标识提取模块,用于当接收到待存储的数据时,提取所述数据携带的业务标识;
    时间获取模块,用于获取接收所述数据的时间,并确定所述时间所属的时间区间;
    分区表获取模块,用于获取与提取的所述业务标识相对应的父分区表,并获取所述父分区表下与确定的所述时间区间相对应的子分区表;及
    存储模块,用于将所述待存储的数据存储至获取的所述子分区表中。
  8. 根据权利要求7所述的装置,其特征在于,所述装置还包括:
    查询时间段接收模块,用于接收到查询指令时,接收输入的业务标识及查询时间段;
    父分区表查询模块,用于查询与接收的该业务标识对应的父分区表;
    子分区表查询模块,用于在该父分区表中查询属于该查询时间段的时间区间,并获取查询的该时间区间所对应的子分区表;
    结果查询模块,用于将存储在查询的该子分区表中的数据作为该查询的结果。
  9. 一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述计算机可读指令被所述处理器执行时,使得所述处理器执行以下步骤:
    在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表;
    当接收到待存储的数据时,提取所述数据携带的业务标识;
    获取接收所述数据的时间,并确定所述时间所属的时间区间;
    获取与提取的所述业务标识相对应的父分区表,并获取所述父分区表下与确定的所述时间区间相对应的子分区表;及
    将所述待存储的数据存储至获取的所述子分区表中。
  10. 根据权利要求9所述的计算机设备,其特征在于,所述处理器还用于执行以下步骤:
    接收到查询指令时,接收输入的业务标识及查询时间段;
    查询与接收的所述业务标识对应的父分区表;
    在所述父分区表中查询属于所述查询时间段的时间区间,并获取查询的所述时间区间所对应的子分区表;
    将存储在查询的所述子分区表中的数据作为所述查询的结果。
  11. 根据权利要求9所述的计算机设备,其特征在于,所述在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表的步骤包括:
    接收输入的时间区间及至少一个业务标识;
    与接收的每个业务标识对应的创建一个父分区表;
    在每个所述父分区表下创建与接收的时间区间相对应的子分区表,所述分区键与所述父分区表下的子分区表一一对应。
  12. 根据权利要求9所述的计算机设备,所述在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表的步骤包括:
    接收输入月份或按星期确定的天数,以得到所述时间区间;
    根据所述时间区间的个数,确定所述父分区表中子分区表的个数;
    按照各个时间区间的时间顺序,确定所述单位时间段与所述子分区表的对应关系。
  13. 根据权利要求9所述的计算机设备,其特征在于,所述时间区间以月份进行划分;所述处理器还用于执行以下步骤:
    接收父分区表的选择指令;
    确定当前时间所属月份的下一个月份;
    自动删除被选择的父分区表中与所述下一个月份相对应的子分区表中存储的数据。
  14. 根据权利要求9所述的计算机设备,其特征在于,所述时间区间按照星期中的天数进行划分;所述处理器还用于执行以下步骤:
    接收父分区表的选择指令;
    确定当前时间所属星期天数的下一个星期天数;
    自动删除被选择的父分区表中与所述下一个星期天数相对应的子分区表中存储的数据。
  15. 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时,使得所述处理器执行以下步骤:
    在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表;
    当接收到待存储的数据时,提取所述数据携带的业务标识;
    获取接收所述数据的时间,并确定所述时间所属的时间区间;
    获取与提取的所述业务标识相对应的父分区表,并获取所述父分区表下与确定的所述时间区间相对应的子分区表;及
    将所述待存储的数据存储至获取的所述子分区表中。
  16. 根据权利要求15所述的存储介质,其特征在于,所述处理器还用于执行以下步骤:
    接收到查询指令时,接收输入的业务标识及查询时间段;
    查询与接收的所述业务标识对应的父分区表;
    在所述父分区表中查询属于所述查询时间段的时间区间,并获取查询的所述时间区间所对应的子分区表;
    将存储在查询的所述子分区表中的数据作为所述查询的结果。
  17. 根据权利要求15所述的存储介质,其特征在于,所述在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表的步骤包括:
    接收输入的时间区间及至少一个业务标识;
    与接收的每个业务标识对应的创建一个父分区表;
    在每个所述父分区表下创建与接收的时间区间相对应的子分区表,所述分区键与所述父分区表下的子分区表一一对应。
  18. 根据权利要求15所述的存储介质,其特征在于,所述在数据库中创建与业务标识相对应的父分区表,并在所述父分区表下创建与时间区间相对应的子分区表的步骤包括:
    接收输入月份或按星期确定的天数,以得到所述时间区间;
    根据所述时间区间的个数,确定所述父分区表中子分区表的个数;
    按照各个时间区间的时间顺序,确定所述单位时间段与所述子分区表的对应关系。
  19. 根据权利要求15所述的存储介质,其特征在于,所述时间区间以月 份进行划分;所述处理器还用于执行以下步骤:
    接收父分区表的选择指令;
    确定当前时间所属月份的下一个月份;
    自动删除被选择的父分区表中与所述下一个月份相对应的子分区表中存储的数据。
  20. 根据权利要求15所述的存储介质,其特征在于,所述时间区间按照星期中的天数进行划分;所述处理器还用于执行以下步骤:
    接收父分区表的选择指令;
    确定当前时间所属星期天数的下一个星期天数;
    自动删除被选择的父分区表中与所述下一个星期天数相对应的子分区表中存储的数据。
PCT/CN2017/112721 2017-10-17 2017-11-23 数据的分区存储方法、装置、计算机设备及存储介质 WO2019075849A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710962200.9 2017-10-17
CN201710962200.9A CN107861989A (zh) 2017-10-17 2017-10-17 数据的分区存储方法、装置、计算机设备及存储介质

Publications (1)

Publication Number Publication Date
WO2019075849A1 true WO2019075849A1 (zh) 2019-04-25

Family

ID=61698756

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/112721 WO2019075849A1 (zh) 2017-10-17 2017-11-23 数据的分区存储方法、装置、计算机设备及存储介质

Country Status (2)

Country Link
CN (1) CN107861989A (zh)
WO (1) WO2019075849A1 (zh)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110399354A (zh) * 2019-07-29 2019-11-01 锐捷网络股份有限公司 数据库的分区交换方法及装置

Families Citing this family (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109376148B (zh) * 2018-08-22 2023-07-18 中国平安人寿保险股份有限公司 缓慢变化维表的数据处理方法、装置、电子设备
CN109683809B (zh) * 2018-11-19 2021-08-31 深圳市艾锐达光电有限公司 一种数据存储方法及终端
CN110012050A (zh) * 2018-12-04 2019-07-12 阿里巴巴集团控股有限公司 消息处理、存储方法、装置及系统
CN111382197B (zh) * 2018-12-28 2023-10-27 杭州海康威视数字技术股份有限公司 分区管理、数据存储和查询方法及装置、设备、介质
CN109886647A (zh) * 2019-01-29 2019-06-14 广东华伦招标有限公司 采购业务功能模块管理方法、装置、设备及存储介质
CN110083602B (zh) * 2019-04-15 2021-07-06 北京三快在线科技有限公司 一种基于hive表的数据存储及数据处理的方法及装置
CN110309108A (zh) * 2019-05-08 2019-10-08 江苏满运软件科技有限公司 数据采集及储存方法、装置、电子设备、存储介质
CN110321334B (zh) * 2019-05-24 2024-03-19 平安银行股份有限公司 数据库自动分区扩容的方法及装置
CN110347661A (zh) * 2019-07-05 2019-10-18 北京红山信息科技研究院有限公司 数据源准实时入库的方法、装置、服务器和存储介质
CN111506573B (zh) * 2020-03-16 2024-03-12 中国平安人寿保险股份有限公司 数据库表分区方法、装置、计算机设备及存储介质
CN111881091A (zh) * 2020-06-08 2020-11-03 微梦创科网络科技(中国)有限公司 数据存储方法、装置、电子设备及存储介质
CN113238993B (zh) * 2021-05-14 2023-12-05 中国人民银行数字货币研究所 一种数据处理方法和装置
CN113486083A (zh) * 2021-06-30 2021-10-08 高新兴科技集团股份有限公司 数据处理方法、系统、计算机存储介质及电子设备
CN113886276B (zh) * 2021-12-06 2022-03-25 北京达佳互联信息技术有限公司 业务创建方法、装置、服务器及存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101673192A (zh) * 2009-10-26 2010-03-17 北京世纪互联宽带数据中心有限公司 时序化的数据处理方法、装置及系统
CN104572860A (zh) * 2014-12-17 2015-04-29 北京皮尔布莱尼软件有限公司 一种数据处理方法和系统
WO2017080139A1 (zh) * 2015-11-11 2017-05-18 华为技术有限公司 分布式数据库中子表分裂的方法、子表节点和系统
CN106844721A (zh) * 2017-02-09 2017-06-13 济南浪潮高新科技投资发展有限公司 数据存储方法、装置、系统、可读介质及存储控制器

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101404013A (zh) * 2008-11-13 2009-04-08 山东浪潮齐鲁软件产业股份有限公司 数据库大数据量表存储和查询方法
CN102141963B (zh) * 2010-01-28 2016-06-08 阿里巴巴集团控股有限公司 一种数据分析方法和设备
CN102200972A (zh) * 2010-03-24 2011-09-28 腾讯科技(北京)有限公司 一种数据库维护方法和设备
CN102063490B (zh) * 2010-12-20 2012-12-19 大唐移动通信设备有限公司 一种数据库分区方法和分区装置
CN106407191B (zh) * 2015-07-27 2020-06-12 中国移动通信集团公司 一种数据处理方法及服务器
US20170155939A1 (en) * 2015-09-12 2017-06-01 The Aleph Group Pte., Limited Method and System for Processing Data Used By Creative Users to Create Media Content
CN105447112B (zh) * 2015-11-12 2019-02-01 国云科技股份有限公司 一种实现关系数据库Hash分区高效扩展的方法
CN107239485A (zh) * 2017-04-18 2017-10-10 北京小度信息科技有限公司 数据库操作方法、装置及系统

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101673192A (zh) * 2009-10-26 2010-03-17 北京世纪互联宽带数据中心有限公司 时序化的数据处理方法、装置及系统
CN104572860A (zh) * 2014-12-17 2015-04-29 北京皮尔布莱尼软件有限公司 一种数据处理方法和系统
WO2017080139A1 (zh) * 2015-11-11 2017-05-18 华为技术有限公司 分布式数据库中子表分裂的方法、子表节点和系统
CN106844721A (zh) * 2017-02-09 2017-06-13 济南浪潮高新科技投资发展有限公司 数据存储方法、装置、系统、可读介质及存储控制器

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110399354A (zh) * 2019-07-29 2019-11-01 锐捷网络股份有限公司 数据库的分区交换方法及装置
CN110399354B (zh) * 2019-07-29 2022-03-18 锐捷网络股份有限公司 数据库的分区交换方法及装置

Also Published As

Publication number Publication date
CN107861989A (zh) 2018-03-30

Similar Documents

Publication Publication Date Title
WO2019075849A1 (zh) 数据的分区存储方法、装置、计算机设备及存储介质
US11327792B2 (en) Hashing data-processing steps in workflow environments
CN110209728B (zh) 一种分布式异构数据库同步方法、电子设备及存储介质
CN104133772A (zh) 一种自动生成测试数据的方法
WO2017092470A1 (zh) 数据存储方法和装置
WO2017084410A1 (zh) 一种网管数据同步方法及装置
CN110445828B (zh) 一种基于Redis的数据分布式处理方法及其相关设备
EP2763055B1 (en) A telecommunication method and mobile telecommunication device for providing data to a mobile application
CN110555012A (zh) 数据迁移方法及装置
CN106557307B (zh) 业务数据的处理方法及处理系统
CN114780641B (zh) 多库多表同步方法、装置、计算机设备和存储介质
CN109086382B (zh) 一种数据同步方法、装置、设备及存储介质
CN105279261A (zh) 动态可扩展数据库归档方法和系统
CN109885642B (zh) 面向全文检索的分级存储方法及装置
CN112000649B (zh) 一种基于map reduce的增量数据同步的方法和装置
US20210224941A1 (en) Method and apparatus for determining trajectory, and method, apparatus and system for recommending time
CN105608126A (zh) 一种建立海量数据库二级索引的方法和装置
CN108646987B (zh) 一种文件卷的管理方法、装置、存储介质及终端
US10664309B2 (en) Use of concurrent time bucket generations for scalable scheduling of operations in a computer system
CN112000646A (zh) 一种数据库初始化方法、装置及电子设备和存储介质
CN103699627A (zh) 一种基于Hadoop集群的超大文件并行数据块定位方法
US10409651B2 (en) Incremental workflow execution
WO2022223038A1 (zh) 一种键名称生成方法、装置和计算机可读存储介质
CN109271278B (zh) 一种确定磁盘快照数据切片的引用次数的方法和装置
CN116010345A (zh) 一种实现流批一体数据湖的表服务方案的方法、装置及设备

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 07.10.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17928932

Country of ref document: EP

Kind code of ref document: A1