CN112817972A - Data storage method, data query method, data storage device, data query device and electronic equipment - Google Patents

Data storage method, data query method, data storage device, data query device and electronic equipment Download PDF

Info

Publication number
CN112817972A
CN112817972A CN202110091227.1A CN202110091227A CN112817972A CN 112817972 A CN112817972 A CN 112817972A CN 202110091227 A CN202110091227 A CN 202110091227A CN 112817972 A CN112817972 A CN 112817972A
Authority
CN
China
Prior art keywords
data
stored
account
target
determining
Prior art date
Legal status (The legal status 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 status listed.)
Pending
Application number
CN202110091227.1A
Other languages
Chinese (zh)
Inventor
吴蓓
崔欣
杨弋
刘东升
周江博
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
CITIC Aibank Corp Ltd
Original Assignee
CITIC Aibank Corp Ltd
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 CITIC Aibank Corp Ltd filed Critical CITIC Aibank Corp Ltd
Priority to CN202110091227.1A priority Critical patent/CN112817972A/en
Publication of CN112817972A publication Critical patent/CN112817972A/en
Pending legal-status Critical Current

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/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2462Approximate or statistical queries

Abstract

The embodiment of the application provides a data storage method, a data query device and electronic equipment, belonging to the technical field of data storage, and the application comprises the following steps: the method comprises the steps that data to be stored are obtained, wherein the data to be stored comprise serial numbers; determining whether an account corresponding to the data to be stored is a hotspot account; and if the account is a hotspot account, determining a target base table for storing the data to be stored based on the hash value of the serial number of the data to be stored. Namely, when the account corresponding to the data to be stored is a hotspot account, the target base table for storing the data to be stored is determined based on the hash value of the serial number of the data to be stored, so that even if the information to be stored of the same client is stored in different base tables, the information to be stored of the same client can be relatively and uniformly stored in different base tables, and the phenomenon that the data storage is too concentrated to cause that the access pressure of one or some databases is too large is avoided, and the performance of the system can be improved.

Description

Data storage method, data query method, data storage device, data query device and electronic equipment
Technical Field
The invention relates to the technical field of data storage, in particular to a data storage method, a data query device and electronic equipment.
Background
At present, for banking core system internal accounts and customer accounts adopting a distributed database, financial transactions are carried out mainly by calculating a table of the account belonging to the customer number routing. For customer accounts, because the customer numbers issued by each person are different, the customer accounts can be uniformly hashed in each library, if the bank uses financial transactions and mainly uses transactions among internal accounts, and when all the internal account accounts are issued by the same customer number, along with the development of the industry, the business volume is increased, the internal accounts can be hashed in the same library table according to the routing of the customer numbers, so that the pressure of the database is uneven, and the system performance is influenced.
Disclosure of Invention
The present application aims to solve at least one of the above technical drawbacks. The technical scheme adopted by the application is as follows:
in a first aspect, a data storage method is provided, including:
acquiring data to be stored, wherein the data to be stored comprises a serial number;
determining whether an account corresponding to the data to be stored is a hotspot account;
and if the account is a hotspot account, determining a target base table for storing the data to be stored based on the hash value of the serial number of the data to be stored.
Optionally, the determining whether the account corresponding to the data to be stored is a hotspot account includes:
judging the number of times of transaction of the account in a preset time period;
if the number of transactions occurring exceeds a predetermined threshold, the account is determined to be a hotspot account.
Optionally, if the account is a hotspot account, determining a target base table of the data storage to be stored based on a hash value of a serial number of the data to be stored includes:
performing hash calculation on the serial number, and performing modulo calculation on the hash value obtained through the hash calculation to obtain a target sub-table for storing the data to be stored;
performing modular calculation based on the target sub-table of the data storage to be stored, and determining a target library of the data storage to be stored.
Optionally, the data to be stored includes an account number, and the method further includes:
and if the account is a non-hotspot account, determining a target base table for storing the data to be stored based on the hash value of the account number of the data to be stored.
Optionally, the data to be stored further includes a client number, and the method further includes:
determining whether the data to be stored is incremental data or stock data;
if the data to be stored is stock data, judging whether a determined target base table stored by the data to be stored is consistent with a history base table of the data to be stored, wherein the history base table is determined based on a client number;
and if the determined target base table for storing the data to be stored is inconsistent with the history base table of the data to be stored, migrating the data to be stored to a base table corresponding to the target base table.
In a second aspect, a data query method is provided, including:
acquiring query request information, wherein the query request information comprises a target account number and a target serial number;
judging whether the target account is a hotspot account or not;
and if the target account is the hotspot account, determining a database table of the data storage corresponding to the query request based on the hash value of the target serial number.
Optionally, the determining whether the target account is a hotspot account includes:
judging the times of the transactions of the target account in a preset time period;
and if the number of times of the transactions exceeds a preset threshold value, determining that the target account is a hot account.
Optionally, if the target account is a hotspot account, determining, based on the hash value of the target serial number, a database table of the data storage corresponding to the query request includes:
performing hash calculation on the target serial number, and performing modulo calculation on the hash value obtained through the hash calculation to obtain a sub-table of the data storage corresponding to the query request;
and performing modular calculation based on the sub-table of the data storage corresponding to the query request, and determining a database of the data storage corresponding to the query request.
In a third aspect, there is provided a data storage device, the device 30 comprising:
a first obtaining module 301, configured to obtain data to be stored, where the data to be stored includes a serial number;
a first determining module 302, configured to determine whether an account corresponding to data to be stored is a hotspot account;
a second determining module 303, configured to determine, if the account is a hotspot account, a target base table of the to-be-stored data storage based on a hash value of a serial number of the to-be-stored data.
Optionally, the first determining module includes:
the first judgment unit is used for judging the number of times of transaction of the account in a preset time period;
the first determination unit is used for determining that the account is a hot account if the number of times of transaction occurrence exceeds a preset threshold value.
Optionally, the second determining module includes:
the first calculation unit is used for carrying out Hash calculation on the serial number and carrying out modulo calculation on the Hash value obtained through the Hash calculation to obtain a target sub-table for storing the data to be stored;
and the second determining unit is used for performing modular calculation based on the target sub-table stored by the data to be stored and determining the target library stored by the data to be stored.
Optionally, the data to be stored includes an account number, and the apparatus further includes:
and the third determination module is used for determining a target base table for storing the data to be stored based on the hash value of the account number of the data to be stored if the account is a non-hotspot account.
Optionally, the data to be stored further includes a client number, and the apparatus further includes:
the fourth determining module is used for determining whether the data to be stored is incremental data or stock data;
the judging module is used for judging whether the determined target base table stored by the data to be stored is consistent with the history base table of the data to be stored if the data to be stored is stock data, and the history base table is determined based on the client number;
and the migration module is used for migrating the data to be stored to the base table corresponding to the target base table if the determined target base table of the data to be stored is inconsistent with the history base table of the data to be stored.
In a fourth aspect, there is provided a data query apparatus 50, including:
a second obtaining module 501, configured to obtain query request information, where the query request information includes a target account number and a target serial number;
a second determining module 502, configured to determine whether the target account is a hotspot account;
a fifth determining module 503, configured to determine, if the target account is a hotspot account, a database table of the data storage corresponding to the query request based on the hash value of the target serial number.
Optionally, the second determining module includes:
the second judgment unit is used for judging the times of the transaction of the target account in a preset time period;
and the third determining unit is used for determining that the target account is the hot account if the number of times of the transactions exceeds a preset threshold value.
Optionally, the fifth determining module includes:
the second calculation unit is used for carrying out Hash calculation on the target serial number and carrying out modular calculation on the Hash value obtained through Hash calculation to obtain a sub-table of data storage corresponding to the query request;
and the fourth determining unit is used for performing modular calculation based on the sub-table of the data storage corresponding to the query request and determining the library of the data storage corresponding to the query request.
In a fifth aspect, an embodiment of the present application provides an electronic device, including a processor and a memory;
the memory is used for storing operation instructions;
the processor is configured to execute the method in any of the embodiments by calling the operation instruction.
In a sixth aspect, the present application provides a computer-readable storage medium, where a computer program is stored on the storage medium, and when the computer program is executed by a processor, the computer program implements the method of any one of the above embodiments.
Compared with a database table for determining data storage based on a client number, the data to be stored is obtained, and the data to be stored comprises a serial number; determining whether an account corresponding to the data to be stored is a hotspot account; and if the account is a hotspot account, determining a target base table for storing the data to be stored based on the hash value of the serial number of the data to be stored. Namely, when the account corresponding to the data to be stored is a hotspot account, the target base table for storing the data to be stored is determined based on the hash value of the serial number of the data to be stored, so that even if the information to be stored of the same client is stored in different base tables, the information to be stored of the same client can be relatively and uniformly stored in different base tables, and the phenomenon that the data storage is too concentrated to cause that the access pressure of one or some databases is too large is avoided, and the performance of the system can be improved.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings used in the description of the embodiments of the present application will be briefly described below.
Fig. 1 is a schematic flowchart of a data storage method according to an embodiment of the present application;
FIG. 2 is a schematic diagram of a data query method provided in an embodiment of the present application;
FIG. 3 is a schematic diagram of a data storage device according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present disclosure;
fig. 5 is a schematic diagram of a data query device according to an embodiment of the present application.
Detailed Description
Reference will now be made in detail to embodiments of the present application, examples of which are illustrated in the accompanying drawings, wherein like or similar reference numerals refer to the same or similar elements or elements having the same or similar function throughout. The embodiments described below with reference to the drawings are exemplary only for the purpose of explaining the present application and are not to be construed as limiting the present invention.
It will be understood by those skilled in the art that, unless otherwise specified, the singular forms "a", "an", "the" and "the" may include the plural forms, and the plural forms "a", "an", "a", and "the" are merely intended to illustrate the object definition for clarity and do not limit the object itself, and certainly, the object definition for "a" and "an" may be the same terminal, device, user, etc., and may also be the same terminal, device, user, etc. It will be further understood that the terms "comprises" and/or "comprising," when used in this specification, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof. As used herein, the term "and/or" includes all or any element and all combinations of one or more of the associated listed items.
To make the objects, technical solutions and advantages of the present application more clear, embodiments of the present application will be described in further detail below with reference to the accompanying drawings.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 1 shows a schematic flow diagram of a data storage method provided in an embodiment of the present application, and as shown in fig. 1, the method mainly includes:
s101, obtaining data to be stored, wherein the data to be stored comprises a serial number;
in particular, the data to be stored may be transaction data of the user, wherein the transaction data comprises a transaction serial number.
S102, determining whether an account corresponding to the data to be stored is a hotspot account; specifically, the determining whether an account corresponding to the data to be stored is a hotspot account includes:
judging the number of times of transaction of the account in a preset time period;
if the number of transactions occurring exceeds a predetermined threshold, the account is determined to be a hotspot account.
Illustratively, an account is identified as a hotspot account if 10 transactions occur within a week for that account.
S103, if the account is a hotspot account, determining a target base table for storing the data to be stored based on the hash value of the serial number of the data to be stored.
Optionally, if the account is a hotspot account, determining a target base table of the data storage to be stored based on a hash value of a serial number of the data to be stored includes:
performing hash calculation on the serial number, and performing modulo calculation on the hash value obtained through the hash calculation to obtain a target sub-table for storing the data to be stored;
performing modular calculation based on the target sub-table of the data storage to be stored, and determining a target library of the data storage to be stored.
Optionally, the data to be stored includes an account number, and the method further includes:
and if the account is a non-hotspot account, determining a target base table for storing the data to be stored based on the hash value of the account number of the data to be stored.
Optionally, the data to be stored further includes a client number, and the method further includes:
determining whether the data to be stored is incremental data or stock data;
if the data to be stored is stock data, judging whether a determined target base table stored by the data to be stored is consistent with a history base table of the data to be stored, wherein the history base table is determined based on a client number;
and if the determined target base table for storing the data to be stored is inconsistent with the history base table of the data to be stored, migrating the data to be stored to a base table corresponding to the target base table.
For better understanding of the technical solution of the present application, the existing design data is stored in the following manner, for example: the account attribute and the account flow information both use the customer number as a routing key, calculate the sub-table to which the routing key belongs modulo 1024 (exemplarily), and calculate the library to which the sub-table belongs modulo 8 (exemplarily).
Examples are: internal client number (client no):900000900001
Route key (route _ key): 900000900001
The sub-tables of the table: 900000900001MOD1024 ═ 929
The library to which it belongs: 900000900001MOD1024MOD8 ═ 1
As a result: store in 1 storehouse 929 sub-table
Specifically, according to the technical scheme, account attributes are obtained by taking account number hash as a routing key, calculating the sub-table to which the routing key belongs modulo 1024, and calculating the library to which the sub-table belongs modulo 8.
Further, the account can be divided into hot account and non-hot account according to the account flow information. The hot account takes the serial number hash as a routing key, the non-hot account takes the account number hash as a routing key, the routing key is subjected to modulo 1024 to calculate the sub-table to which the account belongs, and the sub-table is subjected to modulo 8 to calculate the library to which the account belongs.
Examples are:
[ hotspot account ]
Internal client number (client no):900000900001
9000011431999001000190 internal Account number (base _ acct _ no)
The serial number: 201112bzccsto04861721216305383659
Account attribute correlation table route key (router _ key): hash (9000011431999001000190)
Account pipelining routing key (router _ key): hash (201112 bzccssto 04861721216305383659)
The sub-tables of the table: attribute table: hash (9000011431999001000190) MOD1024 ═ 727 flow sheet: hash (201112 bzccssto 04861721216305383659) MOD1024 ═ 597
The library to which it belongs: attribute table: 727MOD1024 ═ 7 flow water meter: 597MOD8 ═ 5
[ non-hotspot Account ]
Internal client number (client no):900000900001
9000011011019001000070 internal Account number (base _ acct _ no)
Account attribute correlation table route key (router _ key): hash (9000011011019001000070)
Account pipelining routing key (router _ key): hash (9000011011019001000070)
The sub-tables of the table: attribute table: hash (9000011011019001000070) MOD1024 ═ 375 flow sheet: hash (9000011011019001000070) MOD1024 ═ 375
The library to which it belongs: attribute table: 375MOD8 ═ 7 flow water meter: 375MOD 8-7
Compared with a database table for determining data storage based on a client number, the data to be stored is obtained, and the data to be stored comprises a serial number; determining whether an account corresponding to the data to be stored is a hotspot account; and if the account is a hotspot account, determining a target base table for storing the data to be stored based on the hash value of the serial number of the data to be stored. Namely, when the account corresponding to the data to be stored is a hotspot account, the target base table for storing the data to be stored is determined based on the hash value of the serial number of the data to be stored, so that even if the information to be stored of the same client is stored in different base tables, the information to be stored of the same client can be relatively and uniformly stored in different base tables, and the phenomenon that the data storage is too concentrated to cause that the access pressure of one or some databases is too large is avoided, and the performance of the system can be improved.
Example two
As shown in fig. 2, an embodiment of the present application provides a data query method, including:
step S201, obtaining inquiry request information, wherein the inquiry request information comprises a target account number and a target serial number;
step S202, judging whether the target account is a hotspot account;
step S203, if the target account is a hotspot account, determining a database table of the data storage corresponding to the query request based on the hash value of the target serial number.
Optionally, the determining whether the target account is a hotspot account includes:
judging the times of the transactions of the target account in a preset time period;
and if the number of times of the transactions exceeds a preset threshold value, determining that the target account is a hot account.
Optionally, if the target account is a hotspot account, determining, based on the hash value of the target serial number, a database table of the data storage corresponding to the query request includes:
performing hash calculation on the target serial number, and performing modulo calculation on the hash value obtained through the hash calculation to obtain a sub-table of the data storage corresponding to the query request;
and performing modular calculation based on the sub-table of the data storage corresponding to the query request, and determining a database of the data storage corresponding to the query request.
For the embodiment of the application, when the account corresponding to the data to be stored is a hotspot account, the target base table of the data to be stored is determined based on the hash value of the serial number of the data to be stored, so that even if the information to be stored of the same client is stored in different base tables, the information to be stored of the same client can be relatively uniformly stored in different base tables, and the condition that the data storage is too concentrated to cause that the access pressure of one or some databases is too large is avoided, and the performance of the system can be improved.
EXAMPLE III
Based on the data storage method shown in fig. 1, another aspect of the present application provides a data storage device, as shown in fig. 3, wherein,
a first obtaining module 301, configured to obtain data to be stored, where the data to be stored includes a serial number;
a first determining module 302, configured to determine whether an account corresponding to data to be stored is a hotspot account;
a second determining module 302, configured to determine, if the account is a hotspot account, a target base table of the to-be-stored data storage based on a hash value of a serial number of the to-be-stored data.
Optionally, the first determining module includes:
the first judgment unit is used for judging the number of times of transaction of the account in a preset time period;
the first determination unit is used for determining that the account is a hot account if the number of times of transaction occurrence exceeds a preset threshold value.
Optionally, the second determining module includes:
the first calculation unit is used for carrying out Hash calculation on the serial number and carrying out modulo calculation on the Hash value obtained through the Hash calculation to obtain a target sub-table for storing the data to be stored;
and the second determining unit is used for performing modular calculation based on the target sub-table stored by the data to be stored and determining the target library stored by the data to be stored.
Optionally, the data to be stored includes an account number, and the apparatus further includes:
and the third determination module is used for determining a target base table for storing the data to be stored based on the hash value of the account number of the data to be stored if the account is a non-hotspot account.
Optionally, the data to be stored further includes a client number, and the apparatus further includes:
the fourth determining module is used for determining whether the data to be stored is incremental data or stock data;
the judging module is used for judging whether the determined target base table stored by the data to be stored is consistent with the history base table of the data to be stored if the data to be stored is stock data, and the history base table is determined based on the client number;
and the migration module is used for migrating the data to be stored to the base table corresponding to the target base table if the determined target base table of the data to be stored is inconsistent with the history base table of the data to be stored.
In the embodiment of the present application, the beneficial effects that can be achieved by the method can refer to the beneficial effects in the corresponding method provided above, and are not described herein again.
Example four
The embodiment of the application provides a data inquiry device, which is characterized by comprising:
the second acquisition module is used for acquiring inquiry request information, wherein the inquiry request information comprises a target account number and a target serial number;
the second judgment module is used for judging whether the target account is a hotspot account or not;
and the fifth determining module is used for determining a database table of the data storage corresponding to the query request based on the hash value of the target serial number if the target account is the hotspot account.
Optionally, the second determining module includes:
the second judgment unit is used for judging the times of the transaction of the target account in a preset time period;
and the third determining unit is used for determining that the target account is the hot account if the number of times of the transactions exceeds a preset threshold value.
Optionally, the fifth determining module includes:
the second calculation unit is used for carrying out Hash calculation on the target serial number and carrying out modular calculation on the Hash value obtained through Hash calculation to obtain a sub-table of data storage corresponding to the query request;
and the fourth determining unit is used for performing modular calculation based on the sub-table of the data storage corresponding to the query request and determining the library of the data storage corresponding to the query request.
It is to be understood that the illustrated structure of the embodiment of the present invention does not constitute a specific limitation to the specific structure of the database configuration apparatus. In other embodiments of the present application, the database configuration means may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware.
EXAMPLE five
The embodiment of the application provides an electronic device, which comprises a processor and a memory;
a memory for storing operating instructions;
and the processor is used for executing the database configuration method provided by any embodiment of the application by calling the operation instruction.
As an example, fig. 4 shows a schematic structural diagram of an electronic device to which the embodiment of the present application is applicable, and as shown in fig. 4, the electronic device 400 includes: a processor 401 and a memory 403. Wherein the processor 401 is coupled to the memory 403, such as via a bus 402. Optionally, the electronic device 400 may also include a transceiver 404. It should be noted that the transceiver 404 is not limited to one in practical applications. It is to be understood that the illustrated structure of the embodiment of the present invention does not constitute a specific limitation to the specific structure of the electronic device 400. In other embodiments of the present application, electronic device 400 may include more or fewer components than shown, or some components may be combined, some components may be split, or a different arrangement of components. The illustrated components may be implemented in hardware, software, or a combination of software and hardware. Optionally, the electronic device may further include a display screen 405 for displaying images or receiving operation instructions of a user as needed.
The processor 401 is applied to the embodiment of the present application, and is configured to implement the method shown in the foregoing method embodiment. The transceiver 404 may include a receiver and a transmitter, and the transceiver 404 is applied in the embodiment of the present application and is used for implementing the function of the electronic device of the embodiment of the present application to communicate with other devices when executed.
The Processor 401 may be a CPU (Central Processing Unit), a general purpose Processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field Programmable Gate Array) or other Programmable logic device, a transistor logic device, a hardware component, or any combination thereof. Which may implement or perform the various illustrative logical blocks, modules, and circuits described in connection with the disclosure. The processor 401 may also be a combination of computing functions, e.g., comprising one or more microprocessors, a combination of a DSP and a microprocessor, or the like.
Processor 401 may also include one or more processing units, such as: the processor 401 may include an Application Processor (AP), a modem processor, a Graphics Processing Unit (GPU), an Image Signal Processor (ISP), a controller, a memory, a video codec, a Digital Signal Processor (DSP), a baseband processor, and/or a Neural-Network Processing Unit (NPU), etc. The different processing units may be separate devices or may be integrated into one or more processors. The controller may be, among other things, a neural center and a command center of the electronic device 400. The controller can generate an operation control signal according to the instruction operation code and the timing signal to complete the control of instruction fetching and instruction execution. A memory may also be provided in processor 401 for storing instructions and data. In some embodiments, the memory in the processor 401 is a cache memory. The memory may hold instructions or data that have just been used or recycled by processor 401. If the processor 401 needs to reuse the instruction or data, it can be called directly from the memory. Avoiding repeated accesses reduces the latency of the processor 401, thereby increasing the efficiency of the system.
The processor 401 may operate the database configuration method provided in the embodiment of the present application, so as to reduce the operation complexity of the user, improve the intelligent degree of the terminal device, and improve the user experience. The processor 401 may include different devices, for example, when the CPU and the GPU are integrated, the CPU and the GPU may cooperate to execute the database configuration method provided in the embodiment of the present application, for example, part of algorithms in the database configuration method is executed by the CPU, and another part of algorithms is executed by the GPU, so as to obtain faster processing efficiency.
Bus 402 may include a path that transfers information between the above components. The bus 402 may be a PCI (Peripheral Component Interconnect) bus, an EISA (Extended Industry Standard Architecture) bus, or the like. The bus 402 may be divided into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in FIG. 3, but this does not mean only one bus or one type of bus.
The Memory 403 may be a ROM (Read Only Memory) or other types of static storage devices that can store static information and instructions, a RAM (Random Access Memory) or other types of dynamic storage devices that can store information and instructions, an EEPROM (Electrically Erasable Programmable Read Only Memory), a CD-ROM (Compact disk), a high speed Random Access Memory, a non-volatile Memory such as at least one magnetic disk storage device, a flash Memory device, a universal flash Memory (UFS), or other optical disk storage, optical disk storage (including Compact disk, laser disk, optical disk, digital versatile disk, blu-ray disk, etc.), a magnetic disk storage medium or other magnetic storage devices, a magnetic disk storage medium, or other types of magnetic storage devices, Or any other medium which can be used to carry or store desired program code in the form of instructions or data structures and which can be accessed by a computer, but is not limited to such.
Optionally, the memory 403 is used for storing application program codes for executing the scheme of the present application, and is controlled by the processor 401 to execute. The processor 401 is configured to execute the application program code stored in the memory 403 to implement the database configuration method provided in any embodiment of the present application.
The memory 403 may be used to store computer-executable program code, which includes instructions. The processor 401 executes various functional applications of the electronic device 400 and data processing by executing instructions stored in the memory 403. The memory 403 may include a program storage area and a data storage area. Wherein, the storage program area can store the codes of the operating system and the application program, etc. The stored data area may store data created during use of the electronic device 400 (e.g., images, video, etc. captured by a camera application), and the like.
The memory 403 may also store one or more computer programs corresponding to the database configuration method provided in the embodiments of the present application. The one or more computer programs stored in the memory 403 and configured to be executed by the one or more processors 401 include instructions that may be used to perform the steps of the respective embodiments described above.
Of course, the codes of the database configuration method provided in the embodiment of the present application may also be stored in the external memory. In this case, the processor 401 may execute the code of the database configuration method stored in the external memory through the external memory interface, and the processor 401 may control the database configuration flow to be executed.
The display screen 405 includes a display panel. The display panel may be a Liquid Crystal Display (LCD), an organic light-emitting diode (OLED), an active-matrix organic light-emitting diode (active-matrix organic light-emitting diode, AMOLED), a flexible light-emitting diode (FLED), a miniature, a Micro-oeld, a quantum dot light-emitting diode (QLED), or the like. In some embodiments, the electronic device 400 may include 1 or N display screens 405, N being a positive integer greater than 1. The display screen 405 may be used to display information input by or provided to the user as well as various Graphical User Interfaces (GUIs). For example, the display screen 405 may display a photograph, video, web page, or file, etc.
The electronic device provided by the embodiment of the present application is applicable to any embodiment of the above method, and therefore, the beneficial effects that can be achieved by the electronic device can refer to the beneficial effects in the corresponding method provided above, and are not described again here.
EXAMPLE six
The embodiment of the present application provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the database configuration method shown in the above method embodiment.
The computer-readable storage medium provided in the embodiments of the present application is applicable to any embodiment of the foregoing method, and therefore, the beneficial effects that can be achieved by the computer-readable storage medium can refer to the beneficial effects in the corresponding method provided above, and are not described herein again.
The embodiment of the present application further provides a computer program product, which when running on a computer, causes the computer to execute the above related steps to implement the method in the above embodiment. The computer program product provided in the embodiments of the present application is applicable to any of the embodiments of the method described above, and therefore, the beneficial effects that can be achieved by the computer program product can refer to the beneficial effects in the corresponding method provided above, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other manners. For example, the above-described apparatus embodiments are merely illustrative, and for example, a module or a unit may be divided into only one logical function, and may be implemented in other ways, for example, a plurality of units or components may be combined or integrated into another apparatus, or some features may be discarded or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
Units described as separate parts may or may not be physically separate, and parts displayed as units may be one physical unit or a plurality of physical units, may be located in one place, or may be distributed to a plurality of different places. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a readable storage medium. Based on such understanding, the technical solutions of the embodiments of the present application may be essentially or partially contributed to by the prior art, or all or part of the technical solutions may be embodied in the form of a software product, where the software product is stored in a storage medium and includes several instructions to enable a device (which may be a single chip, a chip, or the like) or a processor (processor) to execute all or part of the steps of the methods of the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the present application, and can make several modifications and decorations, and these changes, substitutions, improvements and decorations should also be considered to be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (12)

1. A method of storing data, comprising:
acquiring data to be stored, wherein the data to be stored comprises a serial number;
determining whether an account corresponding to the data to be stored is a hotspot account;
and if the account is a hotspot account, determining a target base table for storing the data to be stored based on the hash value of the serial number of the data to be stored.
2. The method of claim 1, wherein the determining whether the account corresponding to the data to be stored is a hotspot account comprises:
judging the number of times of transaction of the account in a preset time period;
if the number of transactions occurring exceeds a predetermined threshold, the account is determined to be a hotspot account.
3. The method of claim 1, wherein if the account is a hotspot account, determining a target base table of the data storage to be stored based on a hash value of a serial number of the data to be stored comprises:
performing hash calculation on the serial number, and performing modulo calculation on the hash value obtained through the hash calculation to obtain a target sub-table for storing the data to be stored;
performing modular calculation based on the target sub-table of the data storage to be stored, and determining a target library of the data storage to be stored.
4. The method of claim 1, wherein the data to be stored comprises an account number, the method further comprising:
and if the account is a non-hotspot account, determining a target base table for storing the data to be stored based on the hash value of the account number of the data to be stored.
5. The method according to any one of claims 1 to 4, wherein the data to be stored further comprises a customer number, the method further comprising:
determining whether the data to be stored is incremental data or stock data;
if the data to be stored is stock data, judging whether a determined target base table stored by the data to be stored is consistent with a history base table of the data to be stored, wherein the history base table is determined based on a client number;
and if the determined target base table for storing the data to be stored is inconsistent with the history base table of the data to be stored, migrating the data to be stored to a base table corresponding to the target base table.
6. A method for querying data, comprising:
acquiring query request information, wherein the query request information comprises a target account number and a target serial number;
judging whether the target account is a hotspot account or not;
and if the target account is the hotspot account, determining a database table of the data storage corresponding to the query request based on the hash value of the target serial number.
7. The method of claim 6, wherein the determining whether the target account is a hotspot account comprises:
judging the times of the transactions of the target account in a preset time period;
and if the number of times of the transactions exceeds a preset threshold value, determining that the target account is a hot account.
8. The method of claim 6, wherein determining a database table of a data store corresponding to the query request based on the hash value of the target serial number if the target account is a hotspot account comprises:
performing hash calculation on the target serial number, and performing modulo calculation on the hash value obtained through the hash calculation to obtain a sub-table of the data storage corresponding to the query request;
and performing modular calculation based on the sub-table of the data storage corresponding to the query request, and determining a database of the data storage corresponding to the query request.
9. A data storage device, comprising:
the device comprises a first acquisition module, a second acquisition module and a storage module, wherein the first acquisition module is used for acquiring data to be stored, and the data to be stored comprises a serial number;
the first determining module is used for determining whether an account corresponding to the data to be stored is a hotspot account;
and the second determination module is used for determining a target base table for storing the data to be stored based on the hash value of the serial number of the data to be stored if the account is the hotspot account.
10. A data query apparatus, comprising:
the second acquisition module is used for acquiring inquiry request information, wherein the inquiry request information comprises a target account number and a target serial number;
the second judgment module is used for judging whether the target account is a hotspot account or not;
and the fifth determining module is used for determining a database table of the data storage corresponding to the query request based on the hash value of the target serial number if the target account is the hotspot account.
11. An electronic device comprising a processor and a memory;
the memory is used for storing operation instructions;
the processor is used for executing the method of any one of claims 1-8 by calling the operation instruction.
12. A computer-readable storage medium, characterized in that the storage medium has stored thereon a computer program which, when being executed by a processor, carries out the method of any one of claims 1-8.
CN202110091227.1A 2021-01-22 2021-01-22 Data storage method, data query method, data storage device, data query device and electronic equipment Pending CN112817972A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110091227.1A CN112817972A (en) 2021-01-22 2021-01-22 Data storage method, data query method, data storage device, data query device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110091227.1A CN112817972A (en) 2021-01-22 2021-01-22 Data storage method, data query method, data storage device, data query device and electronic equipment

Publications (1)

Publication Number Publication Date
CN112817972A true CN112817972A (en) 2021-05-18

Family

ID=75858985

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110091227.1A Pending CN112817972A (en) 2021-01-22 2021-01-22 Data storage method, data query method, data storage device, data query device and electronic equipment

Country Status (1)

Country Link
CN (1) CN112817972A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114442961A (en) * 2022-02-07 2022-05-06 苏州浪潮智能科技有限公司 Data processing method and device, computer equipment and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103631959A (en) * 2013-12-17 2014-03-12 江苏名通信息科技有限公司 Method for supporting million user data sub-meter based on Hash algorithm
CN106547784A (en) * 2015-09-22 2017-03-29 阿里巴巴集团控股有限公司 A kind of data split storage method and device
CN106557578A (en) * 2016-11-23 2017-04-05 中国工商银行股份有限公司 The inquiry of historical data method and system
CN108153849A (en) * 2017-12-20 2018-06-12 杭州登虹科技有限公司 A kind of database table cutting method, device, system and medium
CN109947846A (en) * 2018-11-30 2019-06-28 网联清算有限公司 Transaction data processing method, device, computer equipment and storage medium
US20190215157A1 (en) * 2017-03-03 2019-07-11 Tencent Technology (Shenzhen) Company Limited Information storage method, device, and computer-readable storage medium
CN111443867A (en) * 2020-03-24 2020-07-24 腾讯科技(深圳)有限公司 Data storage method, device, equipment and storage medium
CN111566611A (en) * 2019-09-12 2020-08-21 阿里巴巴集团控股有限公司 Log structure storage system

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103631959A (en) * 2013-12-17 2014-03-12 江苏名通信息科技有限公司 Method for supporting million user data sub-meter based on Hash algorithm
CN106547784A (en) * 2015-09-22 2017-03-29 阿里巴巴集团控股有限公司 A kind of data split storage method and device
CN106557578A (en) * 2016-11-23 2017-04-05 中国工商银行股份有限公司 The inquiry of historical data method and system
US20190215157A1 (en) * 2017-03-03 2019-07-11 Tencent Technology (Shenzhen) Company Limited Information storage method, device, and computer-readable storage medium
CN108153849A (en) * 2017-12-20 2018-06-12 杭州登虹科技有限公司 A kind of database table cutting method, device, system and medium
CN109947846A (en) * 2018-11-30 2019-06-28 网联清算有限公司 Transaction data processing method, device, computer equipment and storage medium
CN111566611A (en) * 2019-09-12 2020-08-21 阿里巴巴集团控股有限公司 Log structure storage system
CN111443867A (en) * 2020-03-24 2020-07-24 腾讯科技(深圳)有限公司 Data storage method, device, equipment and storage medium

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114442961A (en) * 2022-02-07 2022-05-06 苏州浪潮智能科技有限公司 Data processing method and device, computer equipment and storage medium
CN114442961B (en) * 2022-02-07 2023-08-08 苏州浪潮智能科技有限公司 Data processing method, device, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
US11449576B2 (en) Convolution operation processing method and related product
US20200167344A1 (en) Method and device for writing service data in block chain system
WO2019114128A1 (en) Block chain transaction block processing method, electronic device and readable storage medium
CN112764911A (en) Task scheduling method and device, electronic equipment and readable storage medium
CN111897818A (en) Data storage method and device, electronic equipment and storage medium
CN104751494A (en) Processing and drawing method for OpenGL huge textures
CN116910290B (en) Method, device, equipment and medium for loading slice-free remote sensing image
CN116662038B (en) Industrial information detection method, device, equipment and medium based on shared memory
CN112187530A (en) Log analysis method and device, electronic equipment and readable storage medium
WO2018205689A1 (en) File merging method, storage device, storage apparatus, and storage medium
CN112817972A (en) Data storage method, data query method, data storage device, data query device and electronic equipment
CN112286907A (en) Database configuration method and device, electronic equipment and readable storage medium
US20200327638A1 (en) Connected component detection method, circuit, device and computer-readable storage medium
CN112463598A (en) Pressure measurement method and device, electronic equipment and readable storage medium
US10339052B2 (en) Massive access request for out-of-core textures by a parallel processor with limited memory
US11734007B2 (en) Address generation method, related apparatus, and storage medium
WO2021249030A1 (en) Method for generating random number sequence and random number engine
CN114840388A (en) Data monitoring method and device, electronic equipment and storage medium
CN112416916A (en) Data verification method and device, electronic equipment and readable storage medium
CN112860729A (en) Operation method, operation device, electronic equipment and readable storage medium
CN112487784B (en) Technical document management method, device, electronic equipment and readable storage medium
CN115658351B (en) 2D copying method, device, electronic equipment and computer readable storage medium
CN115002211B (en) Method, device, equipment and medium for realizing after-sale micro-service based on cloud protogenesis
CN112711568A (en) File processing method, device and system
CN112487784A (en) Technical document management method and device, electronic equipment and readable storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination