Database retrieval method and device, computer equipment and storage medium

By obtaining the starting primary key number and initial step size parameter, a flexible search range is established. By adopting a step-size search method, the problems of extended database search process time and low efficiency are solved, and efficient updates and improved resource utilization are achieved for data tables with large primary key spans.

CN120872969APending Publication Date: 2025-10-31CHINA PING AN PROPERTY INSURANCE CO LTD
View PDF 0 Cites 1 Cited by

Patent Information

Application Number
CN202510849117.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-23
Publication Date
2025-10-31

AI Technical Summary

Technical Problem

Existing databases suffer from prolonged retrieval times and low retrieval and update efficiency when handling retrieval and updating of hundreds of millions of historical data in a single table. This is especially true when dealing with data tables with large primary key spans, where invalid queries lead to a surge in database connection pressure and excessive resource consumption, failing to meet the requirements of efficient processing and timely response to massive amounts of data in fields such as finance and healthcare.

Method used

By obtaining the starting primary key number and initial step size parameter of the user data table, a flexible search range is established. The search is performed by step size to reduce invalid queries. An update strategy is extracted to update the data of the search results, avoiding full table scans and improving database resource utilization.

Benefits of technology

It significantly reduces invalid queries for non-existent data ranges, lowers database connection pressure, improves database resource utilization, enables efficient processing and timely response to massive amounts of data, and enhances retrieval and update efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120872969A_ABST
    Figure CN120872969A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of artificial intelligence and big data, and relates to a database retrieval method which comprises the following steps: in response to an update request for a target field in a user data table, obtaining an initial primary key number of the user data table; acquiring a preset initial step parameter, and establishing a retrieval range according to the initial primary key number and the initial step parameter; retrieving a target field in the user data table according to the retrieval range to obtain a retrieval hit result; and extracting an updating strategy from the updating request, and performing data updating on the target field in the retrieval hit result according to the updating strategy. The invention further provides a database retrieval device, computer equipment and a storage medium. The method can be applied to business management program systems of financial science and technology, medical treatment and the like, and the problems that the retrieval process time is prolonged and the retrieval updating efficiency is low in existing database retrieval can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the fields of artificial intelligence and big data technology, and is applied to online processing business scenarios such as fintech and digital healthcare. In particular, it relates to a database retrieval method, device, computer equipment, and storage medium. Background Technology

[0002] In the wave of digitalization, internet applications in fields such as finance and healthcare are booming, leading to an explosive growth in business data. For example, car insurance service platforms deal with massive amounts of internet user information and need to store large amounts of business data; the financial sector involves massive amounts of transaction records and customer account information; and the healthcare sector covers a large amount of patient medical records, examination reports, and other data. Faced with this massive amount of data, relational databases such as MySQL are typically used for data storage.

[0003] However, MySQL reveals significant limitations when handling the retrieval and updating of hundreds of millions of historical data entries in a single table. The commonly used industry-standard retrieval scheme based on continuously incrementing primary keys is only suitable for processing densely packed, consecutive data tables, such as those with primary key IDs incrementing sequentially from 1 to 5. It performs poorly when dealing with data tables that have a large primary key range. For example, in financial transaction data, in certain specialized business scenarios, the primary key of transaction records might increment by 100, 200, 300, etc.

[0004] Searching tables with primary keys that span sequentially generates numerous invalid requests targeting non-existent data ranges, such as querying primary key ranges like 101-199 or 201-299 in financial transaction records. These invalid requests significantly increase database connection pressure, threatening system stability. Furthermore, invalid queries consume substantial CPU, memory, and disk I / O resources, prolonging the overall retrieval process and reducing retrieval and update efficiency, failing to meet the demands of fields like finance and healthcare for efficient processing and timely response to massive amounts of data. Summary of the Invention

[0005] The purpose of this application is to provide a database retrieval method, apparatus, computer device, and storage medium, aiming to solve the problems of prolonged retrieval process time and low retrieval update efficiency in existing database retrieval methods.

[0006] Firstly, a database retrieval method is provided, which adopts the following technical solution:

[0007] In response to an update request for a target field in a user data table, obtain the starting primary key number of the user data table;

[0008] Obtain the preset initial step size parameter, and establish a search range based on the starting primary key number and the initial step size parameter;

[0009] The target fields in the user data table are searched according to the search scope to obtain the search results;

[0010] An update strategy is extracted from the update request, and the target field in the search results is updated according to the update strategy.

[0011] Secondly, a database retrieval device is provided, which adopts the technical solution described below:

[0012] The request-response module is used to respond to an update request for a target field in the user data table and obtain the starting primary key number of the user data table.

[0013] The range construction module is used to obtain a preset initial step size parameter and establish a search range based on the starting primary key number and the initial step size parameter;

[0014] The field retrieval module is used to retrieve target fields in the user data table according to the retrieval scope and obtain retrieval results;

[0015] The field update module is used to extract the update strategy from the update request and update the target field in the search results according to the update strategy.

[0016] Thirdly, a computer device is provided, including a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the database retrieval method described above.

[0017] Fourthly, a computer-readable storage medium is provided, on which computer-readable instructions are stored, which, when executed by a processor, implement the steps of the database retrieval method described above.

[0018] Compared with the prior art, the embodiments of this application have the following main advantages:

[0019] This application embodiment, in response to an update request for a target field in a user data table, obtains the starting primary key number and initial step size parameter of the user data table. Based on the starting primary key number and initial step size parameter, a search range can be flexibly established, avoiding indiscriminate searching of the entire data table and reducing the search process time. By searching the target field in the user data table according to the constructed search range, the amount of data retrieved can be effectively reduced, and records containing data of the target field can be quickly located to obtain search results. By extracting the update strategy from the update request, the update method and content of the target field can be clearly defined, ensuring accurate and effective data updates to the target field in the search results. Based on this application's solution, for data tables with large primary key spans, using a step-size search method can significantly reduce invalid queries for non-existent data ranges, reduce database connection pressure, improve database resource utilization, and achieve efficient processing and timely response to massive amounts of data. Attached Figure Description

[0020] To more clearly illustrate the solutions in this application, the accompanying drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0021] Figure 1 This is an exemplary system architecture diagram to which this application can be applied;

[0022] Figure 2 This is a flowchart illustrating an embodiment of the database retrieval method of this application;

[0023] Figure 3 This is a flowchart illustrating an embodiment of step S202 of this application;

[0024] Figure 4 This is a flowchart illustrating another embodiment of step S202 of this application;

[0025] Figure 5 This is a schematic diagram of the structure of one embodiment of the database retrieval device of this application;

[0026] Figure 6 This is a schematic diagram of the structure of one embodiment of the computer device according to this application. Detailed Implementation

[0027] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains; the terminology used herein in the specification of the application is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "comprising" and "having," and any variations thereof, in the specification, claims, and foregoing drawings of this application, are intended to cover non-exclusive inclusion. The terms "first," "second," etc., in the specification, claims, or foregoing drawings of this application are used to distinguish different objects, not to describe a particular order.

[0028] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.

[0029] To enable those skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.

[0030] like Figure 1 As shown, system architecture 100 may include terminal device 101, network 102, and server 103. Terminal device 101 may be a laptop 1011, tablet 1012, or mobile phone 1013. Network 102 is used as a medium to provide a communication link between terminal device 101 and server 103. Network 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables.

[0031] Users can use terminal device 101 to interact with server 103 via network 102 to receive or send messages, etc. Various communication client applications can be installed on terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social media platform software, etc.

[0032] Terminal device 101 can be various electronic devices with a display screen and support web browsing. In addition to laptops 1011, tablets 1012, or mobile phones 1013, terminal device 101 can also be e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III), MP4 players (Moving Picture Experts Group Audio Layer IV), laptops, and desktop computers, etc.

[0033] Server 103 can be a server that provides various services, such as a backend server that provides support for the pages displayed on terminal device 101.

[0034] It should be noted that the database retrieval method provided in this application embodiment is generally executed by a server / terminal device, and correspondingly, the database retrieval device is generally set in the server / terminal device.

[0035] It should be understood that Figure 1 The number of terminal devices, networks, and servers shown is merely illustrative. Depending on implementation needs, any number of terminal devices, networks, and servers can be included.

[0036] Continue to refer to Figure 2 A flowchart of an embodiment of the database retrieval method according to this application is shown. The database retrieval method includes the following steps:

[0037] Step S201: In response to an update request for a target field in the user data table, obtain the starting primary key number of the user data table;

[0038] In this embodiment, the database retrieval method runs on an electronic device (e.g., Figure 1 The server / terminal device shown can receive update requests for target fields in the user data table via wired or wireless connections. It should be noted that the aforementioned wireless connection methods may include, but are not limited to, 3G / 4G / 5G connections, WiFi connections, Bluetooth connections, WiMAX connections, Zigbee connections, UWB (ultra-wideband) connections, and other currently known or future-developed wireless connection methods.

[0039] In this embodiment, the user data table is a structured data collection used to store user-related information. For example, in a car insurance service platform, the user data table can be a table storing car insurance information, including fields such as basic user information, vehicle information, policy information, service usage records, and safe driving data; in a financial scenario, the user data table can be a table storing customer account information, including fields such as customer number, account balance, transaction records, and transaction time; in a medical scenario, the user data table can be a table storing patient medical record information, including fields such as patient name, age, disease diagnosis, diagnosis time, and treatment plan. The target field refers to a specific field in the user data table that needs to be updated, such as account balance, time, or disease diagnosis result.

[0040] Specifically, when an electronic device receives an update request for a target field in a user data table, it retrieves the starting primary key number of the user data table to determine from which primary key number to begin subsequent retrieval and update operations. The starting primary key number is the initial value of the primary key field in the user data table used to uniquely identify each record. Primary keys are typically auto-incrementing integers, and the starting primary key number indicates from which subsequent retrieval and update operations will begin.

[0041] For example, in a car insurance service platform, if you need to update the driving years field in a driving record table, you first need to query the minimum value of the primary key field (such as user ID) of that table and use it as the starting primary key number. In a financial scenario, if you need to update the account balance field in a customer account information table, you first need to query the minimum value of the primary key field (such as customer ID) of that table and use it as the starting primary key number. In a medical scenario, if you need to update the disease diagnosis field in a patient medical record information table, you would query the minimum value of the patient ID and use it as the starting primary key number.

[0042] Step S202: Obtain the preset initial step size parameter, and establish the search range based on the starting primary key number and the initial step size parameter;

[0043] In this embodiment, a pre-set initial step size parameter is obtained. This initial step size parameter is used to determine the size of the search range. The initial step size parameter determines the range of primary key numbers covered in each search. The value of this initial step size parameter can be set and adjusted according to factors such as the size of the data table, system processing performance, and the urgency of the update operation. For example, if the data table is small and the system performance is good, the initial step size parameter can be set larger to improve search efficiency; conversely, if the data table is large or the system performance is limited, the initial step size parameter can be set smaller to avoid straining system resources due to retrieving too much data at once.

[0044] In this embodiment, a search range is established based on the starting primary key number and the initial step size parameter. This search range is used to find the primary key number interval of the target field record in the user data table. The search range can include a continuous range and an incrementally increasing range. For example, for a continuously dense data table (e.g., primary key numbers are continuously increasing from 1, 2, 3, etc.), a continuous range (1-100) is established based on the initial step size parameter (e.g., 100); for a data table with incrementally increasing ranges (e.g., primary key numbers are increasing from 100, 200, 300, etc.), an incrementally increasing range (100, 200, 300...1000) is established based on the initial step size parameter (e.g., 100).

[0045] Step S203: Search the target fields in the user data table according to the search scope to obtain the search results;

[0046] In this embodiment, based on the established search scope, target fields are retrieved from the user data table, and the matched target fields are used to form the search results. For example, in a car insurance service platform, in the driving record table, the driving years field (i.e., the target field) is retrieved from records whose search scope includes primary key numbers (1, 2, 3...100); in a financial scenario, in the customer account information table, the account balance field (i.e., the target field) is retrieved from records whose search scope includes primary key numbers (100, 200, 300...1000); in a medical scenario, in the patient medical record information table, the disease diagnosis field (i.e., the target field) is retrieved from records whose search scope includes primary key numbers 1-100.

[0047] Step S204: Extract the update strategy from the update request, and update the target field in the search hit result according to the update strategy.

[0048] In this embodiment, an update strategy for the target field is extracted from the received update request. This update strategy is a rule that guides how to update the data of the target field in the search results. For example, in a financial scenario, the update strategy could be to increase the account balance to a certain amount; in a medical scenario, the update strategy could be to modify a specific disease diagnosis result to a new diagnosis result.

[0049] Specifically, the target fields in the search results are updated according to the update strategy. For example, in a car insurance service platform, if the update strategy is to increase the driving years of all car owners' vehicles by one year, then all the driving years fields retrieved will be updated accordingly. In a financial scenario, if the update strategy is to increase the balance of all accounts that meet a specific condition by 100 yuan, then it is first determined whether the target field (i.e., the account balance field) in the search results meets the specific condition. If it does, then all the account balance fields that meet the specific condition will be updated accordingly. In a medical scenario, the update strategy may be to modify a specific disease diagnosis result to a new diagnosis, such as changing the disease diagnosis of some patients from "cold" to "influenza". According to this update strategy, the disease diagnosis field in the search results is updated.

[0050] In this embodiment, by responding to an update request for a target field in the user data table, the starting primary key number and initial step size parameter of the user data table are obtained. Based on the starting primary key number and initial step size parameter, a search range can be flexibly established, avoiding indiscriminate searching of the entire data table and reducing the search process time. By searching the target field in the user data table according to the constructed search range, the amount of data searched can be effectively reduced, and records containing data of the target field can be quickly located to obtain search results. By extracting the update strategy from the update request, the update method and content of the target field can be clearly defined, ensuring accurate and effective data updates to the target field in the search results. Based on the solution of this application, for data tables with large primary key spans, the step-size search method can significantly reduce invalid queries for non-existent data ranges, reduce database connection pressure, improve database resource utilization, and achieve efficient processing and timely response to massive amounts of data.

[0051] In some optional implementations of this embodiment, refer to Figure 3 Step S202 above, that is, establishing the search range based on the starting primary key number and the initial step size parameter, may include the following steps:

[0052] Step S2021: Establish a data statistics interval based on the starting primary key number and the initial step size parameter;

[0053] Specifically, upon receiving an update request for a target field in the user data table, the starting primary key number and initial step size parameter are obtained. A data statistics interval is established based on the starting primary key number and initial step size parameter, which includes the range of primary key numbers composed of the starting primary key number and the initial step size parameter.

[0054] Taking a financial scenario as an example, suppose we want to update the account balance field in a customer account information table, starting with a primary key number of 100 and an initial step size of 50. Then the established data statistical interval would be from 100 to 149. In a medical scenario, if we want to update the disease diagnosis field in a patient medical record information table, starting with a primary key number of 300 and an initial step size of 30, then the data statistical interval would be from 300 to 329. The purpose of this step is to determine a preliminary range of primary key numbers so that we can subsequently count the number of data records within that range.

[0055] Step S2022: Using a preset data statistics function, count the data records existing in the data statistics interval to obtain the number of records;

[0056] Specifically, the system retrieves preset data statistics functions. For MySQL databases, the COUNT function can be used for SQL statistics, offering advantages such as high performance efficiency and low time consumption. The preset data statistics functions are then used to count the data records existing within the data statistics interval; that is, to query whether data records exist within the data statistics interval and obtain the number of records.

[0057] For example, in a financial scenario, the SQL COUNT function can be used to query a customer account information table and count the number of records with primary key numbers between 100 and 149. In a medical scenario, a data statistics function can be used to query a patient medical record information table and count the number of records with primary key numbers between 300 and 329. After the statistics are performed, the system will obtain the number of records within that statistical range.

[0058] Step S2023: Determine whether the number of records is zero;

[0059] Step S2024: If the number of records is not zero, then obtain a preset value range;

[0060] Specifically, it checks if the count of records is zero. If the count is not zero, it indicates that data records exist within the statistical interval, and a preset value range is then obtained. This preset value range is pre-set based on factors such as system processing performance and the characteristics of the data table. For example, in a financial scenario, considering the system's high processing performance and the efficiency of account information updates, the preset value range might be set to 30-40. In a medical scenario, to ensure the accuracy of medical record information updates, the preset value range might be set to 5-20.

[0061] Step S2025: Determine the target step size parameter based on the preset numerical range, the number of records, and the initial step size parameter;

[0062] Specifically, the target step size parameter is determined based on the preset value range, the number of records, and the initial step size parameter. For example, it could be by comparing the number of records with the preset value range. If the number of records is within the preset value range, the target step size parameter can remain the same as the initial step size parameter. If the number of records exceeds the upper limit of the preset value range, the target step size parameter is appropriately reduced to decrease the amount of data retrieved each time and avoid excessive consumption of system resources.

[0063] For example, in a financial scenario, if the number of records is 50, which is greater than the upper limit of the preset range of 40, the target step size parameter is adjusted from the initial 50 to 40. If the number of records is less than the lower limit of the preset range, the target step size parameter is appropriately increased to improve retrieval efficiency. For example, in a medical scenario, if the number of records is 3, which is less than the lower limit of the preset range of 5, the target step size parameter is adjusted from the initial 30 to 60.

[0064] Step S2026: Establish a search range based on the starting primary key number and the target step size parameter.

[0065] Specifically, for the determined target step size parameter, a search range is established based on the starting primary key number and the target step size parameter.

[0066] In this embodiment, by establishing a data statistics interval based on the starting primary key number and the initial step size parameter, and using a preset data statistics function to count the number of data records within the interval, the data distribution can be quickly located. If the number of records is not zero, the target step size parameter is further determined and the search range is established. Through precise positioning and step-by-step processing, inefficient operations such as full table scans are avoided. Depending on the data sparsity, efficiency improvements can be achieved by ten times or even a hundred times, significantly improving code execution efficiency and saving query time.

[0067] In some optional implementations of this embodiment, refer to Figure 4 After step S2023 above, that is, after determining whether the number of records is zero, the following steps may also be included:

[0068] Step S2027: If the number of records is zero, then the initial step size parameter is superimposed on the starting primary key number to obtain the superimposed starting primary key number;

[0069] Return to the step of establishing a data statistics interval based on the starting primary key number and the initial step size parameter, and using a preset data statistics function to count the data records existing in the data statistics interval to obtain the number of records.

[0070] In this embodiment, a preset data statistics function is used to count the data records existing in the data statistics interval. If the number of records is zero, it indicates that there are no data records that meet the conditions in the current data statistics interval, and the starting primary key number needs to be further adjusted.

[0071] Specifically, the initial step size parameter is added to the starting primary key number, that is, the initial step size parameter is added to the current starting primary key number to obtain the added starting primary key number. For example, if the starting primary key number is 300, the initial step size parameter is 30, and the number of records counted is 0, then the added starting primary key number is 330.

[0072] Next, the data statistics interval is re-established using the superimposed starting primary key number and initial step size parameter. A preset data statistics function is used to count the data records existing in the re-established data statistics interval, obtaining the number of records. Then, the step of checking if the number of records is zero is repeated until a data statistics interval containing data records is found. A preset value range is obtained, and the target step size parameter is determined based on the preset value range, the number of records not equal to zero, and the initial step size parameter.

[0073] In this embodiment, when the number of records within a data statistics interval is zero, it indicates that there is no valid data in the current interval. By adding the initial step size parameter to the starting primary key number, a new starting primary key number is obtained. This allows for quickly skipping primary key number intervals where no data records exist, avoiding invalid search requests and reducing resource consumption. By returning to the steps of establishing the data statistics interval and counting the number of records, a dynamically adjusted loop mechanism is formed. Each time the step size parameter is added, a new data statistics interval is re-established for statistics, dynamically adjusting the query range according to the actual data distribution, enabling more precise location of intervals with data. This processing method allows the query scheme to better adapt to different data distributions. Whether the data is concentrated or sparsely distributed, it can find valid data through dynamic adjustment, improving the targeting and effectiveness of the query.

[0074] In some optional implementations of this embodiment, step S2025, that is, determining the target step size parameter based on the preset numerical range, the number of records, and the initial step size parameter, may include any of the following steps:

[0075] If the number of records meets the preset value range, then the initial step size parameter is determined as the target step size parameter;

[0076] Specifically, the number of records counted is compared with a preset value range. When the number of records meets the preset value range, it indicates that the number of records in the current data statistics interval is within a reasonable range, and the initial step size parameter is determined as the target step size parameter.

[0077] In this embodiment, when the number of records falls within a preset range, the initial step size parameter is directly set as the target step size parameter. This approach ensures that when the data volume is within a suitable range, the query is performed at the current step size. This guarantees sufficient data for analysis or business processing without data loss due to an excessively large step size or inefficient querying due to an excessively small step size. It achieves precise control over the granularity of the query, which helps improve the accuracy and efficiency of the query.

[0078] If the number of records is greater than the preset value range, the initial step size parameter is reduced according to the first parameter adjustment rule, and the reduced initial step size parameter is used as the target step size parameter.

[0079] Specifically, when the number of records exceeds the preset data range, it indicates that there are too many data records within the current data statistics interval. To reduce the system processing pressure, a preset first parameter adjustment rule is obtained. This first parameter adjustment rule is a strategy method used to reduce the initial step size parameter. The initial step size parameter is reduced according to this first parameter adjustment rule, and the reduced initial step size parameter is used as the target step size parameter.

[0080] For example, in a financial scenario, if the preset value range is 30-40, the number of records obtained is 45, and the initial step size parameter is 50, then after reducing it by 20% according to the first parameter adjustment rule, the reduced initial step size parameter is 50 × (1-20%) = 40, and 40 is used as the target step size parameter. In a medical scenario, if the preset value range is 5-20, the number of records is 25, and the initial step size parameter is 30, after reducing it by 10 according to the first parameter adjustment rule, the reduced initial step size parameter is 30-10 = 20, and 20 is used as the target step size parameter.

[0081] In this embodiment, by reducing the initial step size parameter according to the first parameter adjustment rule when the number of records exceeds the preset value range, the step size can be reduced to further subdivide the interval when the amount of data in the current statistical interval is too large, avoiding the acquisition of too much data at once, reducing the database processing pressure, improving the efficiency of a single query, and also locating the required data more accurately.

[0082] If the number of records is less than the preset value range, the initial step size parameter is increased according to the second parameter adjustment rule, and the increased initial step size parameter is used as the target step size parameter.

[0083] Specifically, when the number of records is less than the preset data range, it indicates that there are too few data records in the current data statistics interval, which can easily lead to low retrieval efficiency. In order to improve the utilization of system resources, a preset second parameter adjustment rule is obtained. This second parameter adjustment rule is a strategy method used to increase the initial step size parameter. The initial step size parameter is increased according to the second parameter adjustment rule, and the increased initial step size parameter is used as the target step size parameter.

[0084] For example, in a financial scenario, if the preset value range is 30-40, the number of records obtained is 20, and the initial step size parameter is 50, then after increasing the value by 20% according to the second parameter adjustment rule, the increased initial step size parameter becomes 50 × (1 + 20%) = 60, and 60 is used as the target step size parameter. In a medical scenario, if the preset value range is 5-20, the number of records is 3, and the initial step size parameter is 30, then after increasing the value by 100% according to the second parameter adjustment rule, the increased initial step size parameter becomes 60, and 60 is used as the target step size parameter.

[0085] In this embodiment, by increasing the initial step size parameter according to the second parameter adjustment rule when the number of records is less than a preset value range, the step size can be increased to expand the query range, reduce the number of queries, quickly find more data, and improve the overall query speed when the amount of data in the current interval is too small.

[0086] In some optional implementations of this embodiment, step S203, that is, searching the target field in the user data table according to the search scope to obtain the search results, may include the following steps:

[0087] Obtain all primary key numbers included in the search range, and arrange all primary key numbers to obtain a list of numbers;

[0088] The retrieval process is executed based on the primary key numbers in the number list. The target fields are extracted from the user data table in sequence according to the primary key numbers, and the extracted target fields are combined to form the retrieval results.

[0089] In this embodiment, after establishing the search range based on the starting primary key number and the target step size parameter, all primary key numbers included within the search range are obtained. All primary key numbers are then sorted in ascending order according to their numerical value to obtain a list of numbers.

[0090] Specifically, the retrieval process is executed based on the primary key numbers in the number list. The target fields are extracted from the user data table sequentially according to the order of the primary key numbers in the number list. For example, in a financial scenario, if the target field is the transaction amount in the customer account information table, the first primary key number, such as 100, is extracted from the number list. Then, the corresponding record in the customer account information table is located based on this primary key number, and the value of the transaction amount field is extracted. Next, the next primary key number in the number list is extracted, such as 101, and the above operation is repeated to extract the transaction amount field of the record corresponding to that primary key number from the customer account information table. This process continues until the target fields of each record corresponding to each primary key number in the number list have been extracted in sequence, and all extracted target fields are combined to form the search results.

[0091] In some optional implementations of this embodiment, the system monitors the retrieval process during the retrieval of the target field to promptly detect and handle any anomalies that occur during the retrieval process. After the steps described above for executing the retrieval process based on the primary key number in the number list, the following steps may also be included:

[0092] Detect whether any search anomalies occur during the search process;

[0093] Specifically, during the retrieval process based on the primary key numbers in the number list, the system detects whether any retrieval anomalies occur. These anomalies can include database connection interruptions, corrupted data in the data tables, and insufficient system resources. For example, regarding database connection interruptions, the connection status is checked periodically; if a connection timeout or unexpected closure is detected, it is considered a retrieval anomaly. For data corruption, the validity of extracted data is checked when extracting target fields; if the data format does not meet expectations or the data content is obviously incorrect, it is considered a retrieval anomaly. Regarding insufficient system resources, the usage of resources such as memory and CPU is monitored in real time; if memory usage exceeds a certain threshold or CPU usage is excessively high and persists for a period of time, it is considered a retrieval anomaly.

[0094] When a search error occurs, the search process is interrupted and the current search progress information is obtained and stored in a preset storage unit.

[0095] Specifically, when a retrieval anomaly is detected, the current retrieval process is interrupted to prevent the anomaly from escalating or causing more errors. After interrupting the retrieval process, the current retrieval progress information is obtained. This progress information records the execution status of the retrieval process when the anomaly occurred, and may include information such as the primary key numbers currently being processed, the number of target fields extracted, and the record position corresponding to the primary key number currently being processed. For example, after interrupting the retrieval process, the system will record which primary key number in the list has been processed so far, and the number of target fields successfully extracted. It will also record the specific position of the record corresponding to the primary key number currently being processed in the data table, such as the page number and row number.

[0096] Specifically, after obtaining the retrieval progress information, it is stored in a preset storage unit. The storage unit is a storage area used to store the retrieval progress information, which can be a specific table in a database, a file in a file system, or a cache area in a caching system. If the preset storage unit is a specific table in a database, the retrieval progress information is inserted into that table as a record; if it is a file in a file system, the retrieval progress information is written to the file in a specific format; if it is a cache area in a caching system, the retrieval progress information is stored in the corresponding cache key-value pair.

[0097] Once the retrieval anomaly is resolved, the retrieval progress information is retrieved from the preset storage unit, and the retrieval process is resumed based on the retrieval progress information.

[0098] Specifically, the system continuously monitors the resolution status of retrieval anomalies. For example, in the case of a database connection interruption, the system will attempt to re-establish the connection to the database; once the connection is successfully established, the anomaly is considered resolved. For data corruption issues, the system will attempt to repair the corrupted data or restore data from backups; once the data is restored to normal, the anomaly is considered resolved. For insufficient system resources, the system will wait for resource utilization to drop to a reasonable range; when memory and CPU resources are sufficient, the anomaly is considered resolved.

[0099] Specifically, after a retrieval anomaly is detected and resolved, the previously stored retrieval progress information is retrieved from a preset storage unit. If the preset storage unit is a specific table in a database, the retrieval progress information is obtained by querying that table; if it is a file in a file system, the retrieval progress information is obtained by reading the file content; if it is a cache area in a caching system, the retrieval progress information is obtained from the corresponding cache key-value pairs. After obtaining the retrieval progress information, the retrieval process is resumed based on this information. For example, starting from the next primary key number after the processed primary key number recorded in the retrieval progress information, the target field is extracted from the user data table, and the previous retrieval process continues until the retrieval task for all primary key numbers is completed.

[0100] In this embodiment, by actively detecting retrieval anomalies after executing the retrieval process based on the numbered list, potential problems such as database connection interruptions and data access conflicts can be identified in a timely manner. Once an anomaly is detected, the retrieval process is immediately interrupted to prevent the anomaly from continuing and causing more serious system failures or data errors, ensuring the entire retrieval process remains within a controllable range. When a retrieval anomaly is detected, the current retrieval progress information is obtained and stored in a preset storage unit; this operation records the retrieval "breakpoint." Once the anomaly is resolved, the retrieval progress information is read from the preset storage unit, and the retrieval process is resumed based on this information. This allows the retrieval to continue from the previously interrupted "breakpoint" position, rather than restarting the entire retrieval process. This not only saves significant time and computing resources but also ensures the completeness and accuracy of the retrieval results, improving retrieval efficiency.

[0101] In some optional implementations of this embodiment, step S205, that is, updating the target field in the search hit result according to the update strategy, may include the following steps:

[0102] Retrieve the update field from the update strategy;

[0103] Replace each target field in the search results with the updated field.

[0104] In this embodiment, the update strategy includes rules and parameters that guide how to update target fields in the search results. It specifies the field content to be updated, the update method (such as direct replacement, partial modification, etc.), and the possible update conditions. For example, in a financial system, the update strategy might be defined as updating the account status field in the customer account information table from "normal" to "frozen," and only for customers who opened accounts within a specific time period.

[0105] Specifically, the update fields that need to be used to replace the target fields are extracted from a pre-defined update strategy. Based on these update fields, the target fields in the search results are replaced one by one. For example, each target field is retrieved sequentially according to the order of the search results. Then, the value of the target field is replaced with the value of the previously obtained update field. This process is repeated for each target field in the search results until all target fields have been updated.

[0106] Further reference Figure 5 As a response to the above Figure 2 To implement the method shown, this application provides an embodiment of a database retrieval device, which is similar to... Figure 2 Corresponding to the method embodiments shown, this device can be specifically applied to various electronic devices.

[0107] like Figure 5 As shown, the database retrieval device 400 described in this embodiment includes: a request response module 401, a range construction module 402, a field retrieval module 403, and a field update module 404. Wherein:

[0108] The request response module 401 is used to respond to an update request for a target field in the user data table and obtain the starting primary key number of the user data table.

[0109] The range construction module 402 is used to obtain a preset initial step size parameter and establish a search range based on the starting primary key number and the initial step size parameter;

[0110] The field retrieval module 403 is used to retrieve target fields in the user data table according to the retrieval scope and obtain retrieval results;

[0111] The field update module 404 is used to extract the update strategy from the update request and update the target field in the search hit result according to the update strategy.

[0112] In this embodiment, the user data table is a structured data collection used to store user-related information. For example, in a car insurance service platform, the user data table can be a table storing car insurance information, including fields such as basic user information, vehicle information, policy information, service usage records, and safe driving data; in a financial scenario, the user data table can be a table storing customer account information, including fields such as customer number, account balance, transaction records, and transaction time; in a medical scenario, the user data table can be a table storing patient medical record information, including fields such as patient name, age, disease diagnosis, diagnosis time, and treatment plan. The target field refers to a specific field in the user data table that needs to be updated, such as account balance, time, or disease diagnosis result.

[0113] Specifically, when an electronic device receives an update request for a target field in a user data table, it retrieves the starting primary key number of the user data table to determine from which primary key number to begin subsequent retrieval and update operations. The starting primary key number is the initial value of the primary key field in the user data table used to uniquely identify each record. Primary keys are typically auto-incrementing integers, and the starting primary key number indicates from which subsequent retrieval and update operations will begin.

[0114] For example, in a car insurance service platform, if you need to update the driving years field in a driving record table, you first need to query the minimum value of the primary key field (such as user ID) of that table and use it as the starting primary key number. In a financial scenario, if you need to update the account balance field in a customer account information table, you first need to query the minimum value of the primary key field (such as customer ID) of that table and use it as the starting primary key number. In a medical scenario, if you need to update the disease diagnosis field in a patient medical record information table, you would query the minimum value of the patient ID and use it as the starting primary key number.

[0115] Specifically, the pre-set initial step size parameter is obtained. This parameter determines the size of the search range. The initial step size parameter determines the range of primary key numbers covered in each search. The value of this initial step size parameter can be set and adjusted according to factors such as the size of the data table, system processing performance, and the urgency of the update operation. For example, if the data table is small and the system performance is good, the initial step size parameter can be set larger to improve search efficiency; conversely, if the data table is large or the system performance is limited, the initial step size parameter can be set smaller to avoid straining system resources due to retrieving too much data at once.

[0116] Specifically, a search range is established based on the starting primary key number and the initial step size parameter. This search range is used to find the primary key number interval of the target field record in the user data table. The search range can include continuous ranges and incrementally increasing ranges. For example, for a data table with continuous dense primary key numbers (such as primary key numbers that increase continuously in the order of 1, 2, 3, etc.), a continuous range (1-100) is established based on the initial step size parameter (such as 100); for a data table with incrementally increasing primary key numbers (such as primary key numbers that increase in the order of 100, 200, 300, etc.), an incrementally increasing range (100, 200, 300, ... 1000) is established based on the initial step size parameter (such as 100).

[0117] Specifically, based on the established search scope, target fields are retrieved from the user data table, and the matched target fields are used to form the search results. For example, in a car insurance service platform, in the driving record table, the driving years field (i.e., the target field) is retrieved from records whose search scope includes primary key numbers (1, 2, 3...100); in a financial scenario, in the customer account information table, the account balance field (i.e., the target field) is retrieved from records whose search scope includes primary key numbers (100, 200, 300...1000); in a medical scenario, in the patient medical record information table, the disease diagnosis field (i.e., the target field) is retrieved from records whose search scope includes primary key numbers 1-100.

[0118] Specifically, the update strategy for the target field is extracted from the received update request. This update strategy is a rule that guides how to update the target field in the search results. For example, in a financial scenario, the update strategy could be to increase the account balance to a certain amount; in a medical scenario, the update strategy could be to modify a specific disease diagnosis result to a new diagnosis result.

[0119] Specifically, the target fields in the search results are updated according to the update strategy. For example, in a car insurance service platform, if the update strategy is to increase the driving years of all car owners' vehicles by one year, then all the driving years fields retrieved will be updated accordingly. In a financial scenario, if the update strategy is to increase the balance of all accounts that meet a specific condition by 100 yuan, then it is first determined whether the target field (i.e., the account balance field) in the search results meets the specific condition. If it does, then all the account balance fields that meet the specific condition will be updated accordingly. In a medical scenario, the update strategy may be to modify a specific disease diagnosis result to a new diagnosis, such as changing the disease diagnosis of some patients from "cold" to "influenza". According to this update strategy, the disease diagnosis field in the search results is updated.

[0120] The database retrieval device 400 of this application, in response to an update request for a target field in a user data table, obtains the starting primary key number and initial step size parameter of the user data table. Based on the starting primary key number and initial step size parameter, it can flexibly establish a search range, avoiding indiscriminate searching of the entire data table and reducing the search process time. By searching the target field in the user data table according to the constructed search range, it can effectively reduce the amount of data retrieved, quickly locate records containing data of the target field, and obtain search results. By extracting the update strategy from the update request, it can clarify the update method and content of the target field, ensuring accurate and effective data updates to the target field in the search results. Based on the solution of this application, for data tables with large primary key spans, the step-size retrieval method can significantly reduce invalid queries for non-existent data ranges, reduce database connection pressure, improve database resource utilization, and achieve efficient processing and timely response to massive amounts of data.

[0121] In some optional implementations of this embodiment, the range construction module includes an interval establishment submodule, a record statistics submodule, a quantity judgment submodule, a value acquisition submodule, a parameter determination submodule, and a range establishment submodule, wherein:

[0122] The interval establishment submodule is used to establish a data statistics interval based on the starting primary key number and the initial step size parameter;

[0123] The record statistics submodule is used to use a preset data statistics function to count the data records existing in the data statistics interval and obtain the number of records.

[0124] The quantity determination submodule is used to determine whether the number of records is zero;

[0125] The value acquisition submodule is used to acquire a preset value range if the number of records is not zero;

[0126] The parameter determination submodule is used to determine the target step size parameter based on the preset value range, the number of records, and the initial step size parameter;

[0127] The range establishment submodule is used to establish a search range based on the starting primary key number and the target step size parameter.

[0128] Specifically, upon receiving an update request for a target field in the user data table, the starting primary key number and initial step size parameter are obtained. A data statistics interval is established based on the starting primary key number and initial step size parameter, which includes the range of primary key numbers composed of the starting primary key number and the initial step size parameter.

[0129] Taking a financial scenario as an example, suppose we want to update the account balance field in a customer account information table, starting with a primary key number of 100 and an initial step size of 50. Then the established data statistical interval would be from 100 to 149. In a medical scenario, if we want to update the disease diagnosis field in a patient medical record information table, starting with a primary key number of 300 and an initial step size of 30, then the data statistical interval would be from 300 to 329. The purpose of this step is to determine a preliminary range of primary key numbers so that we can subsequently count the number of data records within that range.

[0130] Specifically, the system retrieves preset data statistics functions. For MySQL databases, the COUNT function can be used for SQL statistics, offering advantages such as high performance efficiency and low time consumption. The preset data statistics functions are then used to count the data records existing within the data statistics interval; that is, to query whether data records exist within the data statistics interval and obtain the number of records.

[0131] For example, in a financial scenario, the SQL COUNT function can be used to query a customer account information table and count the number of records with primary key numbers between 100 and 149. In a medical scenario, a data statistics function can be used to query a patient medical record information table and count the number of records with primary key numbers between 300 and 329. After the statistics are performed, the system will obtain the number of records within that statistical range.

[0132] Specifically, it checks if the count of records is zero. If the count is not zero, it indicates that data records exist within the statistical interval, and a preset value range is then obtained. This preset value range is pre-set based on factors such as system processing performance and the characteristics of the data table. For example, in a financial scenario, considering the system's high processing performance and the efficiency of account information updates, the preset value range might be set to 30-40. In a medical scenario, to ensure the accuracy of medical record information updates, the preset value range might be set to 5-20.

[0133] Specifically, the target step size parameter is determined based on the preset value range, the number of records, and the initial step size parameter. For example, it could be by comparing the number of records with the preset value range. If the number of records is within the preset value range, the target step size parameter can remain the same as the initial step size parameter. If the number of records exceeds the upper limit of the preset value range, the target step size parameter is appropriately reduced to decrease the amount of data retrieved each time and avoid excessive consumption of system resources.

[0134] For example, in a financial scenario, if the number of records is 50, which is greater than the upper limit of the preset range of 40, the target step size parameter is adjusted from the initial 50 to 40. If the number of records is less than the lower limit of the preset range, the target step size parameter is appropriately increased to improve retrieval efficiency. For example, in a medical scenario, if the number of records is 3, which is less than the lower limit of the preset range of 5, the target step size parameter is adjusted from the initial 30 to 60.

[0135] Specifically, for the determined target step size parameter, a search range is established based on the starting primary key number and the target step size parameter.

[0136] In some optional implementations of this embodiment, the range construction module further includes a numbering overlay submodule, wherein:

[0137] The numbering overlay submodule is used to overlay the initial step size parameter onto the starting primary key number if the number of records is zero, so as to obtain the overlaid starting primary key number.

[0138] Return to the step of establishing a data statistics interval based on the starting primary key number and the initial step size parameter, and using a preset data statistics function to count the data records existing in the data statistics interval to obtain the number of records.

[0139] Specifically, a preset data statistics function is used to count the data records within the data statistics interval. If the number of records is zero, it indicates that there are no data records that meet the conditions within the current data statistics interval, and the starting primary key number needs to be further adjusted.

[0140] Specifically, the initial step size parameter is added to the starting primary key number, that is, the initial step size parameter is added to the current starting primary key number to obtain the added starting primary key number. For example, if the starting primary key number is 300, the initial step size parameter is 30, and the number of records counted is 0, then the added starting primary key number is 330.

[0141] Next, the data statistics interval is re-established using the superimposed starting primary key number and initial step size parameter. A preset data statistics function is used to count the data records existing in the re-established data statistics interval, obtaining the number of records. Then, the step of checking if the number of records is zero is repeated until a data statistics interval containing data records is found. A preset value range is obtained, and the target step size parameter is determined based on the preset value range, the number of records not equal to zero, and the initial step size parameter.

[0142] In some optional implementations of this embodiment, the parameter determination submodule further includes a first parameter determination unit, a second parameter determination unit, and a third parameter determination unit, wherein:

[0143] The first parameter determination unit is used to determine the initial step size parameter as the target step size parameter if the number of records meets the preset value range.

[0144] The second parameter determination unit is used to reduce the initial step size parameter according to the first parameter adjustment rule if the number of records is greater than the preset value range, and obtain the reduced initial step size parameter as the target step size parameter.

[0145] The third parameter determination unit is used to increase the initial step size parameter according to the second parameter adjustment rule if the number of records is less than the preset value range, and obtain the increased initial step size parameter as the target step size parameter.

[0146] Specifically, the number of records counted is compared with a preset value range. When the number of records meets the preset value range, it indicates that the number of records in the current data statistics interval is within a reasonable range, and the initial step size parameter is determined as the target step size parameter.

[0147] Specifically, when the number of records exceeds the preset data range, it indicates that there are too many data records within the current data statistics interval. To reduce the system processing pressure, a preset first parameter adjustment rule is obtained. This first parameter adjustment rule is a strategy method used to reduce the initial step size parameter. The initial step size parameter is reduced according to this first parameter adjustment rule, and the reduced initial step size parameter is used as the target step size parameter.

[0148] For example, in a financial scenario, if the preset value range is 30-40, the number of records obtained is 45, and the initial step size parameter is 50, then after reducing it by 20% according to the first parameter adjustment rule, the reduced initial step size parameter is 50 × (1-20%) = 40, and 40 is used as the target step size parameter. In a medical scenario, if the preset value range is 5-20, the number of records is 25, and the initial step size parameter is 30, after reducing it by 10 according to the first parameter adjustment rule, the reduced initial step size parameter is 30-10 = 20, and 20 is used as the target step size parameter.

[0149] Specifically, when the number of records is less than the preset data range, it indicates that there are too few data records in the current data statistics interval, which can easily lead to low retrieval efficiency. In order to improve the utilization of system resources, a preset second parameter adjustment rule is obtained. This second parameter adjustment rule is a strategy method used to increase the initial step size parameter. The initial step size parameter is increased according to the second parameter adjustment rule, and the increased initial step size parameter is used as the target step size parameter.

[0150] For example, in a financial scenario, if the preset value range is 30-40, the number of records obtained is 20, and the initial step size parameter is 50, then after increasing the value by 20% according to the second parameter adjustment rule, the increased initial step size parameter becomes 50 × (1 + 20%) = 60, and 60 is used as the target step size parameter. In a medical scenario, if the preset value range is 5-20, the number of records is 3, and the initial step size parameter is 30, then after increasing the value by 100% according to the second parameter adjustment rule, the increased initial step size parameter becomes 60, and 60 is used as the target step size parameter.

[0151] In some optional implementations of this embodiment, the field retrieval module includes a numbering arrangement submodule and a field retrieval submodule, wherein:

[0152] The numbering and sorting submodule is used to obtain all primary key numbers included in the search range, sort all the primary key numbers, and obtain a number list;

[0153] The field retrieval submodule is used to execute a retrieval process based on the primary key number in the number list, extract target fields from the user data table in sequence according to the primary key number, and combine the extracted target fields into retrieval results.

[0154] In this embodiment, after establishing the search range based on the starting primary key number and the target step size parameter, all primary key numbers included within the search range are obtained. All primary key numbers are then sorted in ascending order according to their numerical value to obtain a list of numbers.

[0155] Specifically, the retrieval process is executed based on the primary key numbers in the number list. The target fields are extracted from the user data table sequentially according to the order of the primary key numbers in the number list. For example, in a financial scenario, if the target field is the transaction amount in the customer account information table, the first primary key number, such as 100, is extracted from the number list. Then, the corresponding record in the customer account information table is located based on this primary key number, and the value of the transaction amount field is extracted. Next, the next primary key number in the number list is extracted, such as 101, and the above operation is repeated to extract the transaction amount field of the record corresponding to that primary key number from the customer account information table. This process continues until the target fields of each record corresponding to each primary key number in the number list have been extracted in sequence, and all extracted target fields are combined to form the search results.

[0156] In some optional implementations of this embodiment, the field retrieval module further includes an anomaly detection submodule, a progress storage submodule, and a process recovery submodule, wherein:

[0157] An anomaly detection submodule is used to detect whether any retrieval anomalies occur during the retrieval process.

[0158] The progress storage submodule is used to interrupt the search process and obtain the current search progress information when a search error occurs, and store the search progress information in a preset storage unit.

[0159] The process recovery submodule is used to retrieve the retrieval progress information from the preset storage unit after the retrieval anomaly is detected and resolved, and to resume the retrieval process based on the retrieval progress information.

[0160] Specifically, during the retrieval process based on the primary key numbers in the number list, the system detects whether any retrieval anomalies occur. These anomalies can include database connection interruptions, corrupted data in the data tables, and insufficient system resources. For example, regarding database connection interruptions, the connection status is checked periodically; if a connection timeout or unexpected closure is detected, it is considered a retrieval anomaly. For data corruption, the validity of extracted data is checked when extracting target fields; if the data format does not meet expectations or the data content is obviously incorrect, it is considered a retrieval anomaly. Regarding insufficient system resources, the usage of resources such as memory and CPU is monitored in real time; if memory usage exceeds a certain threshold or CPU usage is excessively high and persists for a period of time, it is considered a retrieval anomaly.

[0161] Specifically, when a retrieval anomaly is detected, the current retrieval process is interrupted to prevent the anomaly from escalating or causing more errors. After interrupting the retrieval process, the current retrieval progress information is obtained. This progress information records the execution status of the retrieval process when the anomaly occurred, and may include information such as the primary key numbers currently being processed, the number of target fields extracted, and the record position corresponding to the primary key number currently being processed. For example, after interrupting the retrieval process, the system will record which primary key number in the list has been processed so far, and the number of target fields successfully extracted. It will also record the specific position of the record corresponding to the primary key number currently being processed in the data table, such as the page number and row number.

[0162] Specifically, after obtaining the retrieval progress information, it is stored in a preset storage unit. The storage unit is a storage area used to store the retrieval progress information, which can be a specific table in a database, a file in a file system, or a cache area in a caching system. If the preset storage unit is a specific table in a database, the retrieval progress information is inserted into that table as a record; if it is a file in a file system, the retrieval progress information is written to the file in a specific format; if it is a cache area in a caching system, the retrieval progress information is stored in the corresponding cache key-value pair.

[0163] Specifically, the system continuously monitors the resolution status of retrieval anomalies. For example, in the case of a database connection interruption, the system will attempt to re-establish the connection to the database; once the connection is successfully established, the anomaly is considered resolved. For data corruption issues, the system will attempt to repair the corrupted data or restore data from backups; once the data is restored to normal, the anomaly is considered resolved. For insufficient system resources, the system will wait for resource utilization to drop to a reasonable range; when memory and CPU resources are sufficient, the anomaly is considered resolved.

[0164] Specifically, after a retrieval anomaly is detected and resolved, the previously stored retrieval progress information is retrieved from a preset storage unit. If the preset storage unit is a specific table in a database, the retrieval progress information is obtained by querying that table; if it is a file in a file system, the retrieval progress information is obtained by reading the file content; if it is a cache area in a caching system, the retrieval progress information is obtained from the corresponding cache key-value pairs. After obtaining the retrieval progress information, the retrieval process is resumed based on this information. For example, starting from the next primary key number after the processed primary key number recorded in the retrieval progress information, the target field is extracted from the user data table, and the previous retrieval process continues until the retrieval task for all primary key numbers is completed.

[0165] In some optional implementations of this embodiment, the field update module includes a field acquisition submodule and a field replacement submodule, wherein:

[0166] The field acquisition submodule is used to acquire the update fields in the update strategy;

[0167] The field replacement submodule is used to replace the target fields in the search results one by one with the updated fields.

[0168] In this embodiment, the update strategy includes rules and parameters that guide how to update target fields in the search results. It specifies the field content to be updated, the update method (such as direct replacement, partial modification, etc.), and the possible update conditions. For example, in a financial system, the update strategy might be defined as updating the account status field in the customer account information table from "normal" to "frozen," and only for customers who opened accounts within a specific time period.

[0169] Specifically, the update fields that need to be used to replace the target fields are extracted from a pre-defined update strategy. Based on these update fields, the target fields in the search results are replaced one by one. For example, each target field is retrieved sequentially according to the order of the search results. Then, the value of the target field is replaced with the value of the previously obtained update field. This process is repeated for each target field in the search results until all target fields have been updated.

[0170] To address the aforementioned technical problems, embodiments of this application also provide a computer device. Please refer to [link / reference needed]. Figure 6 , Figure 6 This is a basic structural block diagram of the computer device in this embodiment.

[0171] The computer device 6 includes a memory 61, a processor 62, and a network interface 63 that are interconnected via a system bus. It should be noted that only the computer device 6 with memory 61, processor 62, and network interface 63 is shown in the figure; however, it should be understood that it is not required to implement all the components shown, and more or fewer components can be implemented alternatively. Those skilled in the art will understand that the computer device described here is a device capable of automatically performing numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes, but is not limited to, microprocessors, application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0172] The computer device can be a desktop computer, laptop, handheld computer, or cloud server, etc. The computer device can interact with the user via a keyboard, mouse, remote control, touchpad, or voice control.

[0173] The memory 61 includes at least one type of readable storage medium, including flash memory, hard disk, multimedia card, card-type memory (e.g., SD or DX memory), random access memory (RAM), static random access memory (SRAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), programmable read-only memory (PROM), magnetic memory, magnetic disk, optical disk, etc. In some embodiments, the memory 61 may be an internal storage unit of the computer device 6, such as the hard disk or memory of the computer device 6. In other embodiments, the memory 61 may also be an external storage device of the computer device 6, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 6. Of course, the memory 61 may include both the internal storage unit and its external storage device of the computer device 6. In this embodiment, the memory 61 is typically used to store the operating system and various application software installed on the computer device 6, such as computer-readable instructions for database retrieval methods. In addition, the memory 61 can also be used to temporarily store various types of data that have been output or will be output.

[0174] In some embodiments, the processor 62 may be a central processing unit (CPU), controller, microcontroller, microprocessor, or other data processing chip. The processor 62 is typically used to control the overall operation of the computer device 6. In this embodiment, the processor 62 is used to execute computer-readable instructions stored in the memory 61 or to process data, for example, to execute computer-readable instructions for the database retrieval method.

[0175] The network interface 63 may include a wireless network interface or a wired network interface, which is typically used to establish communication connections between the computer device 6 and other electronic devices.

[0176] This application also provides another embodiment, namely, providing a computer-readable storage medium storing computer-readable instructions that can be executed by at least one processor to cause the at least one processor to perform the steps of the database retrieval method described above.

[0177] This application provides a computer device and a computer-readable storage medium. In response to an update request for a target field in a user data table, the processor obtains the starting primary key number and initial step size parameter of the user data table. Based on the starting primary key number and initial step size parameter, a search range can be flexibly established, avoiding indiscriminate searching of the entire data table and reducing search process time. By searching the target field in the user data table according to the constructed search range, the amount of data retrieved can be effectively reduced, and records containing the target field data can be quickly located, resulting in search hits. By extracting the update strategy from the update request, the update method and content of the target field can be clearly defined, ensuring accurate and effective data updates to the target field in the search hits. Based on this application's solution, for data tables with large primary key spans, using a step-size search method can significantly reduce invalid queries on non-existent data ranges, reduce database connection pressure, improve database resource utilization, and achieve efficient processing and timely response to massive amounts of data.

[0178] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in the various embodiments of this application.

[0179] Obviously, the embodiments described above are only some embodiments of this application, not all embodiments. The accompanying drawings show preferred embodiments of this application, but do not limit the patent scope of this application. This application can be implemented in many different forms; rather, the purpose of providing these embodiments is to provide a more thorough and comprehensive understanding of the disclosure of this application. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or make equivalent substitutions for some of the technical features. Any equivalent structures made using the content of this application's specification and drawings, directly or indirectly applied to other related technical fields, are similarly within the scope of patent protection of this application.

[0180] The software tools or components not belonging to our company that appear in the embodiments of this application are merely examples and do not represent actual use.

Claims

1. A database retrieval method, characterized in that, Includes the following steps: In response to an update request for a target field in a user data table, obtain the starting primary key number of the user data table; Obtain the preset initial step size parameter, and establish a search range based on the starting primary key number and the initial step size parameter; The target fields in the user data table are searched according to the search scope to obtain the search results; An update strategy is extracted from the update request, and the target field in the search results is updated according to the update strategy.

2. The database retrieval method according to claim 1, characterized in that, The step of establishing a search range based on the starting primary key number and the initial step size parameter includes: Establish a data statistics interval based on the starting primary key number and the initial step size parameter; A preset data statistics function is used to count the data records existing in the data statistics interval to obtain the number of records. Determine whether the number of records is zero; If the number of records is not zero, then a preset value range is obtained; The target step size parameter is determined based on the preset numerical range, the number of records, and the initial step size parameter; The search range is established based on the starting primary key number and the target step size parameter.

3. The database retrieval method according to claim 2, characterized in that, After the step of determining whether the number of records is zero, the method further includes: If the number of records is zero, the initial step size parameter is added to the starting primary key number to obtain the added starting primary key number; Return to the step of establishing a data statistics interval based on the starting primary key number and the initial step size parameter, and using a preset data statistics function to count the data records existing in the data statistics interval to obtain the number of records.

4. The database retrieval method according to claim 2, characterized in that, The step of determining the target step size parameter based on the preset numerical range, the number of records, and the initial step size parameter includes any one of the following: If the number of records meets the preset value range, then the initial step size parameter is determined as the target step size parameter; If the number of records is greater than the preset value range, the initial step size parameter is reduced according to the first parameter adjustment rule, and the reduced initial step size parameter is used as the target step size parameter. If the number of records is less than the preset value range, the initial step size parameter is increased according to the second parameter adjustment rule, and the increased initial step size parameter is used as the target step size parameter.

5. The database retrieval method according to claim 1, characterized in that, The step of searching the target field in the user data table according to the search scope to obtain the search results includes: Obtain all primary key numbers included in the search range, and arrange all primary key numbers to obtain a list of numbers; The retrieval process is executed based on the primary key numbers in the number list. The target fields are extracted from the user data table in sequence according to the primary key numbers, and the extracted target fields are combined to form the retrieval results.

6. The database retrieval method according to claim 5, characterized in that, Following the step of performing the retrieval process based on the primary key number in the number list, the method further includes: Detect whether any search anomalies occur during the search process; When a search error occurs, the search process is interrupted and the current search progress information is obtained and stored in a preset storage unit. Once the retrieval anomaly is resolved, the retrieval progress information is retrieved from the preset storage unit, and the retrieval process is resumed based on the retrieval progress information.

7. The database retrieval method according to claim 1, characterized in that, The step of updating the target field in the search results according to the update strategy includes: Retrieve the update field from the update strategy; Replace each target field in the search results with the updated field.

8. A database retrieval device, characterized in that, include: The request-response module is used to respond to an update request for a target field in the user data table and obtain the starting primary key number of the user data table. The range construction module is used to obtain a preset initial step size parameter and establish a search range based on the starting primary key number and the initial step size parameter; The field retrieval module is used to retrieve target fields in the user data table according to the retrieval scope and obtain retrieval results; The field update module is used to extract the update strategy from the update request and update the target field in the search results according to the update strategy.

9. A computer device, characterized in that, The system includes a memory and a processor, wherein the memory stores computer-readable instructions, and the processor executes the computer-readable instructions to implement the steps of the database retrieval method as described in any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer-readable instructions, which, when executed by a processor, implement the steps of the database retrieval method as described in any one of claims 1 to 7.

Citation Information

Cited By

  • Vector retrieval method and system based on probability distribution

    CN121117193A