CN106874336B - Data matching method, data query method and device - Google Patents

Data matching method, data query method and device Download PDF

Info

Publication number
CN106874336B
CN106874336B CN201610701995.3A CN201610701995A CN106874336B CN 106874336 B CN106874336 B CN 106874336B CN 201610701995 A CN201610701995 A CN 201610701995A CN 106874336 B CN106874336 B CN 106874336B
Authority
CN
China
Prior art keywords
data
matched
application server
matching
returned
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.)
Active
Application number
CN201610701995.3A
Other languages
Chinese (zh)
Other versions
CN106874336A (en
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.)
Ant Fortune Shanghai Financial Information Service Co ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Publication of CN106874336A publication Critical patent/CN106874336A/en
Application granted granted Critical
Publication of CN106874336B publication Critical patent/CN106874336B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/24Querying
    • G06F16/245Query processing
    • G06F16/2457Query processing with adaptation to user needs

Landscapes

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

Abstract

The embodiment of the application discloses a data matching method, a data query method and a data query device. The data matching method comprises the following steps: the application server sends a query request carrying a query statement and a preset numerical value M to a database terminal; the application server matches the data to be matched with the target data one by one based on the M pieces of data to be matched returned by the database end; the data to be matched is inquired by the database end according to the inquiry statement; if the target data are not matched, the application server matches the data to be matched with the target data one by one based on the N data to be matched returned after the database end returns the M data to be matched; n is more than or equal to 1 and less than or equal to M. According to the embodiment of the application, on the premise of avoiding the memory overflow of the application server, the database end is prevented from being greatly loaded by multiple query actions.

Description

Data matching method, data query method and device
Technical Field
The present application relates to database technologies, and in particular, to a data matching method, a data query method, and a data query device.
Background
Generally, the data matching process is to match the data a with the data b one by one according to the characteristics of the data a and the characteristics of each data b in the data set Q, in the data matching scene, to-be-processed data can be obtained generally through a database Query action of a database Query statement, for example, Query is performed through SQ L (Structured Query L) in the prior art, the database Query mode applied to the data matching scene mainly comprises a full Query mode and a paging Query mode.
Generally, a full query method obtains a result set including all data to be matched which meet a query statement by executing a query operation of an SQ L statement once, and finally writes all the data to be matched in the result set into a memory of a computer at one time and matches the data to be matched with target data one by one.
In the paging query mode, a result set obtained by query is paged (namely each page contains a certain amount of data to be matched) by executing query action of an SQ L statement, so that the database end can only return data to be matched in one page to an application server at a time, and the application server matches with target data based on the data to be matched in one page, thereby avoiding the problem that the memory of the application server overflows due to excessive data returned at one time.
Disclosure of Invention
An embodiment of the present application provides a data matching method, a data query method, and a device, so as to solve the above problems in the prior art.
In order to solve the above technical problem, the data matching method, the data query method, and the data query device provided in the embodiments of the present application are implemented as follows:
a method of data matching, comprising:
the application server sends a query request carrying a query statement and a preset numerical value M to a database terminal;
the application server matches the data to be matched with the target data one by one based on the M pieces of data to be matched returned by the database end; the data to be matched is inquired by the database end according to the inquiry statement;
if the target data are not matched, the application server matches the data to be matched with the target data one by one based on the N data to be matched returned after the database end returns the M data to be matched; n is more than or equal to 1 and less than or equal to M.
A method of data query, comprising:
the database end receives a query request which is sent by an application server and carries a query statement and a preset numerical value M;
the database end returns M pieces of data to be matched to the application server; the data to be matched are inquired by the database end according to the inquiry statement, and the data to be matched are used for matching with target data one by one;
if the target data is not matched, the database end returns N pieces of data to be matched after the M pieces of data to be matched to the application server after returning the M pieces of data to be matched to the application server; n is more than or equal to 1 and less than or equal to M.
A data matching apparatus comprising:
the sending unit is used for sending a query request carrying a query statement and a preset numerical value M to the database end;
the matching unit is used for matching the data to be matched with the target data one by one based on the M pieces of data to be matched returned by the database end; the data to be matched is inquired by the database end according to the inquiry statement;
the matching unit is also used for:
if the target data are not matched, matching the data to be matched with the target data one by one based on N data to be matched which are returned after the M data to be matched are returned by the database end; n is more than or equal to 1 and less than or equal to M.
A data query apparatus, comprising:
the receiving unit is used for receiving a query request which is sent by an application server and carries a query statement and a preset numerical value M;
the return unit is used for returning M pieces of data to be matched to the application server; the data to be matched are inquired according to the query statement, and the data to be matched are used for matching with target data one by one;
the return unit is further configured to:
if the target data is not matched, after the M pieces of data to be matched are returned to the application server, returning N pieces of data to be matched behind the M pieces of data to be matched to the application server; n is more than or equal to 1 and less than or equal to M.
According to the technical scheme provided by the embodiments of the application, in the embodiments of the application, the database terminal receives the query request carrying the query statement and the preset numerical value M sent by the application server, and executes the query action according to the query request to obtain the data to be matched. After the data to be matched is obtained through query, the database end returns M pieces of data to be matched to the application server according to preset data M in the query request, the application server performs matching (matching of the data to be matched and target data) based on the M pieces of data to be matched, and if the matching action of the M pieces of data to be matched is finished and the application server does not finish matching the target data, the application server can perform the matching action of the data to be matched and the target data one by one based on N (N is not less than 1 and not more than M) pieces of data to be matched returned by the database end after the M pieces of data to be matched are returned. Compared with the prior art, in the process of data matching, the database end returns M pieces of data to be matched to the application server at each time, and the preset value M can be determined according to the memory of the application server to ensure that the memory of the application server does not overflow. In addition, compared with the prior art that query requests need to be sent for multiple times in paging query, in the embodiment of the application, in the whole matching process, the application server only sends a query request to the database end once, and returns the queried data to be matched according to the preset value M and the data matching condition of the application server end (whether matching of target data is completed) in the data query process, so that the load of the database end can be greatly relieved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings needed to be used in the description of the embodiments or the prior art will be briefly introduced below, it is obvious that the drawings in the following description are only some embodiments described in the present application, and for those skilled in the art, other drawings can be obtained according to the drawings without any creative effort.
Fig. 1 is a flowchart of a data matching and data query method provided in the embodiment of the present application;
fig. 2 is a flowchart of a data matching method mainly based on an application server according to an embodiment of the present disclosure;
fig. 3 is a flowchart of a data query method using a data end as a main body according to an embodiment of the present application;
fig. 4 is a schematic block diagram of a data matching apparatus according to an embodiment of the present disclosure;
fig. 5 is a schematic block diagram of a data query apparatus according to an embodiment of the present application.
Detailed Description
In order to make those skilled in the art better understand the technical solutions in the present application, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The application aims to provide a data matching method and a data query method applied to a data matching scene so as to relieve the load of a database end under the condition of avoiding the problem of memory overflow of an application server.
Fig. 1 is a flow of a data matching and data query method provided in an embodiment of the present application, including:
s101: and the application server sends a query request carrying a query statement and a preset numerical value M to the database terminal.
The data to be matched herein is counted in strips, and each piece of data to be matched may contain a plurality of features.
In the embodiment of the application, the application server is used for executing a task of matching the target data and one or more data to be matched one by one, and the database end is pre-stored with a plurality of data to be matched. And matching the target data and the data to be matched according to the characteristics of the target data and the characteristics of each data to be matched.
In the embodiment of the present application, before the application server sends a query request to the database, the application server may establish a connection with the database (generally, the connection establishment may be a process of establishing a Data link between the application server and the database to transmit the Data to be matched), the database terminal may analyze the SQ L statement and execute a corresponding Data query operation after receiving the query request.
In the embodiment of the application, when the number of the data to be matched inquired by the database end is greater than the preset value M, the database end can return the inquired data to be matched to the application server for matching for multiple times. The preset value M may be the number of data to be matched that the database end returns to the application server at most each time. Generally, the preset value M may be set according to the memory capacity of the application server, so as to ensure that the data to be matched that is returned to the application server at a time does not overflow the memory of the application server. In this embodiment of the application, the preset value M (M ═ t/s) may be determined according to the average size s of the storage capacity occupied by each piece of data to be matched and the total capacity t of the storage space used for storing the data to be matched in the memory of the application server.
It should be noted that, in the embodiment of the present application, the data to be matched may be stored in an I/O buffer (I/O buffer) area opened in a memory of the application server. The process for data matching on the application server may extract data to be matched from the I/O buffer (may be batch extraction), and match the extracted data to be matched with the target data one by one. The preset value M may be equal to the number of pieces of data to be matched (which may be calculated) that can be stored in the I/O buffer at most.
S102: the database receives the query request.
S103: and the database end executes the query action according to the query statement carried in the query request.
In this embodiment of the present application, the data query process at the database end may be a streaming query process. The so-called streaming query procedure is: in the process of querying data, the database side returns queried data to the query requesting side (application server), that is, the data to be matched is returned while querying. In contrast, in the non-streaming query mode, the database returns the queried data to the query request end after the query process is finished. For example: in the paging query mode, after the database query process is finished, data of a certain page in the queried result set is returned to the query request end.
S104: and when the database end inquires the M data to be matched, returning the M data to be matched to the application server, and recording the position of the currently returned data to be matched.
In the process of querying data to be matched according to the query statement at the database end, two conditions exist, namely that the data to be matched queried at ① is less than or equal to M, and the data to be matched queried at ② is greater than M, wherein only one data return action is needed for the condition ①, and at least two data return actions are needed for the condition ② to avoid memory overflow of the application server.
For the above situation ②, since the database end needs to return the queried data to be matched to the application server at least twice, after a certain amount (M pieces of data to be matched) of the data to be matched is returned at the previous time, in order to ensure that the database end can determine which data has been returned at the previous time when the database end returns data at the next time, it is necessary to record the position of the data to be matched that has been returned to the application server after a certain amount of data to be matched is returned at each time.
S105: and the application server matches the M pieces of data to be matched with the target data one by one based on the returned data.
As described above, the matching is to match the data to be matched with the target data according to the characteristics of the target data and the characteristics of the data to be matched, that is, when the characteristics of the data to be matched are matched with the characteristics of the target data, it is indicated that the data to be matched can be successfully matched with the target data.
S106: and the application server judges whether the matching of the target data is finished. If yes, go to step S109; if not, the process proceeds to step S107.
In the embodiment of the application, the target data generally needs to be successfully matched with a certain amount of data to be matched respectively to indicate that the matching task of the current target data is finished, and at this time, the matching action can be terminated. For example, for a certain target data, 100 pieces of data to be matched need to be successfully matched with each other, and the matching task of the target data is only completed, if the matching task is performed based on the M pieces of data to be matched, and if it is found that 90 pieces of data to be matched with the target data are successfully matched with each other in the M pieces of data to be matched, 10 pieces of data to be matched with the target data are still lacked, so that it is necessary that the database end continues to return a certain amount of data to be matched to the application server after returning the M pieces of data to be matched, and performs the next matching task until the 10 pieces of data to be matched are successfully matched.
In the process that the application server carries out matching based on the M pieces of data to be matched, the following conditions are included:
in case ③, after the application server finishes matching based on the M pieces of data to be matched, the matching of the current target data is not finished;
the situation ④ is that the application server already matches the current target data in the process of matching based on the M pieces of data to be matched, the situation ④ includes a situation that when the application server matches the X-th (1 < X < M) piece of data to be matched in the M pieces of data to be matched, the matching of the current target data is already completed, and the rest pieces of data to be matched do not need to be matched any more.
In the case ③, the process proceeds to step S107, and in the case ④, the process proceeds to step S109.
In the embodiment of the present application, there is a case where: although the current target data is not matched, the data to be matched inquired by the database end is completely returned to the application server end for matching (no more data to be matched can be returned), and the matching task should be terminated at this time. Therefore, the application server can judge whether all the data to be matched inquired by the database end are returned, and if all the data to be matched inquired by the database end are not returned and the target data are not matched, the application server matches the data to be matched with the target data one by one based on the N data to be matched returned after the database end returns the M data to be matched. In the above process, the database end can notify the application server whether more data to be matched can be returned in a message manner while returning a certain amount of data to be matched each time. Of course, in other embodiments, the application server may not determine whether the database end has more data to be matched that can be returned, but when matching is not completed and needs more data to be matched to perform matching, send a message requesting to return more data to the database end to trigger the database end to return the next batch of data to be matched, where after receiving the message, the database end performs a return action if there are more data to be matched at the database end, and if there are no more data to be matched, does not return data and may notify the application server that the matching task is completed.
S107: and after the database end returns the M pieces of data to be matched to the application server, returning N pieces of data to be matched behind the M pieces of data to be matched to the application server. Wherein N is more than or equal to 1 and less than or equal to M.
S108: and the application server matches the received N pieces of data to be matched with the target data one by one.
S109: and the application server releases the connection with the database terminal.
In the embodiment of the application, if the matching of the target data is finished, or all the data to be matched, which are inquired by the database end, are returned, the application server can release the connection with the database end to finish the data inquiry action of the database end and the data matching action of the application server end.
After the step S108, the process may return to the step S106, and continuously determine whether matching of the current target data is completed, and if not, continuously request the database end to return more data to be matched (if the database end has more data); if the process is completed, the process proceeds to step S109.
It is worth mentioning that, in an embodiment of the present application, after the application server performs matching one by one based on M pieces of data to be matched sent by the database terminal, if it is found that the matching task of the current target data is not completed yet and more data to be matched are needed to perform matching, the database terminal may be triggered to return the next piece of data to be matched by sending a request message requesting to return the next piece of data to be matched to the database terminal. In another embodiment of the present application, the application server may not need to trigger the database side to return more data by sending the request message. Alternatively, the database side may adopt a congestion mechanism of TCP to return the data to be matched, that is, after returning M pieces of data to be matched to the application server, the database side may continuously return n pieces of data to be matched, which are obtained by querying and are located after the M pieces of data to be matched, to the application server (may return to an I/O buffer of the application server). According to the congestion mechanism, the data to be matched in the I/O buffer area of the application server can be continuously extracted for matching, and the I/O buffer area can be continuously changed from full to idle. Generally, the database end may send data to be matched to the I/O buffer one by one, if the I/O buffer is full, the application server may return a message that the reception of the current data to be matched fails to the database end, otherwise, if the I/O buffer is idle, the application server may return a message that the reception of the current data to be matched succeeds to the database end. After receiving the message that the current data to be matched fails to be received, the database end may send the data to be matched to the application server (stored in the I/O buffer) again at intervals, and so on until the current data to be matched is successfully received. In summary, according to the congestion mechanism, the database side may continuously fill more data to be matched into the I/O buffer of the application server side when the I/O buffer is free, until the I/O buffer is full (congested).
In the data matching method provided by the embodiment of the application, the database end receives a query request which is sent by the application server and carries a query statement and a preset numerical value M, and executes a query action according to the query request to obtain data to be matched. After the data to be matched is obtained through query, the database end returns M pieces of data to be matched to the application server according to preset data M in the query request, the application server performs matching (matching of the data to be matched and target data) based on the M pieces of data to be matched, and if the matching action of the M pieces of data to be matched is finished and the application server does not finish matching the target data, the application server can perform the matching action of the data to be matched and the target data one by one based on N (N is not less than 1 and not more than M) pieces of data to be matched returned by the database end after the M pieces of data to be matched are returned. Compared with the prior art, in the process of data matching, the database end returns M pieces of data to be matched to the application server at each time, and the preset value M can be determined according to the memory of the application server to ensure that the memory of the application server does not overflow. In addition, compared with the prior art that query requests need to be sent for multiple times in paging query, in the embodiment of the application, in the whole matching process, the application server only sends a query request to the database end once, and returns the queried data to be matched according to the preset value M and the data matching condition of the application server end (whether matching of target data is completed) in the data query process, so that the load of the database end can be greatly relieved.
In addition, the conventional paging query method has the following problems: since the data to be matched at the general database end is constantly changed, the data to be matched contained in each page in the result set obtained by query is not fixed, and if the data to be matched is returned to the application server every time, the data to be matched received by the application server is possibly inaccurate. For example, if the sequence number of the data to be matched of page 1 in the result set obtained by the previous query is: 1-100, the serial number of the data to be matched on page 2 is: 101-. If the data to be matched with the sequence number of "80" is deleted from the database before the next query operation is started, the next query operation is executed, and the sequence number of the data to be matched of page 1 in the obtained result set is: 1-79, 81-101', the sequence number of the data to be matched on page 2 is: "102-201", so that if the data to be matched in the 2 nd page is returned to the application server this time, the data to be matched with the sequence number "101" is omitted. In the embodiment of the application, the database end only receives the query request once, and at most M pieces of data are returned each time in the query process, and the position of the data to be matched which is returned each time is recorded, so that the condition that the finally queried data to be matched is inaccurate due to unfixed data to be matched per page in the paging query process can be avoided. On the other hand, the query request is only once, which indicates that the whole data query process is continuously performed, so that the query process can be ensured to search the data to be matched in real time, and the data accuracy of the data matching process is further ensured.
Fig. 2 is a flowchart of a data matching method with an application server as a main body according to an embodiment of the present application, and the method may include:
s201: and the application server sends a query request carrying a query statement and a preset numerical value M to the database terminal.
This step S201 can refer to the content of the above step S101.
S202: the application server matches the data to be matched with the target data one by one based on the M pieces of data to be matched returned by the database end; and the data to be matched is inquired by the database end according to the inquiry statement.
This step S202 can refer to the content of the above step S105.
S203: if the target data are not matched, the application server matches the data to be matched with the target data one by one based on the N data to be matched returned after the database end returns the M data to be matched; n is more than or equal to 1 and less than or equal to M.
This step S203 can refer to the content of the above step S108.
It can be seen from the above method flow provided by this embodiment that, the application server first receives M pieces of data to be matched returned by the database end, performs matching based on the M pieces of data to be matched, and performs matching based on N pieces of data to be matched returned by the database end if matching of the target data is not completed after matching of the M pieces of data to be matched is completed; the N pieces of data to be matched may be returned by the database after the database returns the M pieces of data to be matched. In the whole matching process, the application server sends the query request to the database end only once, and returns the queried data to be matched in batches according to the preset value M and the data matching condition of the application server end (whether the matching of the target data is finished) in the data query process, so that the load of the database end can be greatly relieved on the premise of ensuring that the memory of the application server cannot overflow.
Taking a scene of matching between the reservation sheet (Appointment) and the Product (Product) as an example, the data matching method may include:
and the application server sends a query request carrying a query statement and a preset numerical value M to the database terminal.
The application server matches the reservation order data with preset product data one by one based on M reservation order data returned by the database end; the reservation list data is inquired by the database end according to the query statement, the reservation list data comprises condition information corresponding to product attributes, and the matching is to match the product attributes of the preset product data with the condition information.
If the preset product data are not matched, the application server matches the reservation order data with the preset product data one by one based on N reservation order data returned after the M reservation order data are returned by the database end; n is more than or equal to 1 and less than or equal to M.
If the product is a financial product, the product data may be: financing demands issued by financers on an internet platform; the reservation ticket data may be: investment requirements (i.e., condition information corresponding to product attributes) published by investors on internet platforms. Specifically, each financial product data may include a plurality of product attributes, such as: expected rate of return, term, product type, amount, etc., wherein each product attribute corresponds to a value or threshold. The condition information corresponding to the product attribute contained in the reservation ticket data may be a value or a threshold value.
For example, a product data includes values of product attributes:
expected profitability: 3.4% -5.4%, term: 1-5 years, product type: fund, amount: 1 to 50 ten thousand.
The values of the condition information corresponding to each product attribute contained in a certain preset single data are respectively as follows:
expected profitability: 2% -8%, term: 3 years, product type: fund, amount: 10 to 20 ten thousand.
Then, the value (characteristic) of each condition information of the preset form data matches with the value (characteristic) of each product attribute of the product data, and the preset form data and the product data can be successfully matched. Otherwise, the match fails.
Taking a matching scenario between financial product data and preset document data as an example, in the data query method, if the target data is financial product data, the application server needs to query preset document data that may satisfy conditions from the database, and the set query condition (query statement) may be preset document data of a certain service type. By querying the database, the reservation sheet data meeting the conditions of certain data can be queried, but the queried reservation sheet data can be matched with the current financial product data. For example, the account of an investor is frozen or the balance is insufficient, which may cause the preset order of the user not to match the current product. Therefore, after obtaining reservation order data of certain data through stream query, the database end needs to return to the application server in batches, and the application server matches the preset order data with the product data. Wherein, the mark of matching is as follows: the current product is sold (for example, 1000 thousands of products exist, if the sum of each preset order is 1 million on average, then 1000 pieces of preset order data need to be matched successfully, the matching task is completed, and after the application server finds that the current product is matched completely, the connection between the current application server and the database end can be released, and the database end does not return any more reservation order data even if more reservation order data exist.
Of course, in the matching scenario, the target data may also be preset data, and the data to be queried may be product data. Therefore, the matching task aims to find suitable product data for the current preset data and subscribe, and the process is basically consistent with the scene that the target data is the product data and is not repeated. The only difference is that the mark of matching task completion is as follows: and matching the current preset list data with the qualified product data and subscribing. Generally, product data that was earlier returned to the application server and meets the matching requirements may be released for the connection to the database once the match is successful indicating that the current matching task has been completed.
It is worth mentioning that the M may be adjusted according to actual service requirements. In the above scenario of matching, M may be at least the number of data pieces required for the estimated completion of matching. For example, if there are financial products having a money amount of 1000 ten thousand and the average reserved money amount of the reservation tickets in the database is 1 ten thousand, at least 1000 reservation tickets are required to match the financial products, so that the M may be set to 1000, and the database side may return at most 1000 pieces of data to the application server to match. In the embodiment of the present application, M is the average reserved amount + buffer of the inventory of the product/one reservation list, where 1 is greater than or equal to buffer and less than or equal to 50, and the setting of the buffer may be related to the data validity of the database. Such as: the account of a certain user may be frozen (probability is one millionth), then assuming that the number of users is 100 ten thousand, this buffer may be set to 1, and so on, if there are other factors affecting the validity of the matching data, the value of this buffer may be increased accordingly.
It should be noted that the application scenarios in the embodiments of the present application are not limited to the foregoing, and may also be, for example: and encapsulating the inquired data into a message body (such as a mail or a short message) for sending, and the like.
Fig. 3 is a flowchart of a data query method using a data end as a main body according to an embodiment of the present application, including:
s301: and the database end receives a query request which is sent by the application server and carries the query statement and the preset numerical value M.
S302: the database end returns M pieces of data to be matched to the application server; and the data to be matched is inquired by the database end according to the query statement, and the data to be matched is used for matching with the target data one by one.
S303: if the target data is not matched, the database end returns N pieces of data to be matched after the M pieces of data to be matched to the application server after returning the M pieces of data to be matched to the application server; n is more than or equal to 1 and less than or equal to M.
Similarly, the database end receives the query request sent by the application server only once, and returns the queried data to be matched in batches according to the preset value M and the data matching condition of the application server end (whether the matching of the target data is finished) in the data query process, so that the load of the database end can be greatly relieved on the premise of ensuring that the memory of the application server cannot overflow.
Corresponding to the method flow, the embodiment of the application also provides a data matching device and a data query device. The means may be implemented by a computer software program or computer hardware or a combination of both.
Fig. 4 is a schematic block diagram of a data matching apparatus according to an embodiment of the present disclosure. The functions of the units in the device are similar to the functions of the steps in the method, so that reference can be made to the contents of the embodiments of the method. In this embodiment of the application, the data matching device may include a sending unit 101 and a matching unit 102, where:
the sending unit 101 is configured to send a query request carrying a query statement and a preset value M to a database.
The matching unit 102 is used for matching the data to be matched with the target data one by one based on the M pieces of data to be matched returned by the database end; and the data to be matched is inquired by the database end according to the inquiry statement.
The matching unit 102 is further configured to: if the target data are not matched, matching the data to be matched with the target data one by one based on N data to be matched which are returned after the M data to be matched are returned by the database end; n is more than or equal to 1 and less than or equal to M.
In the data matching device, the database end receives the query request sent by the sending unit 101 only once, and returns the queried data to be matched in batches according to the preset value M and the data matching condition of the matching unit 102 (whether matching of target data is finished) in the data query process, so that the load of the database end can be greatly relieved on the premise of ensuring that the memory of the data matching device does not overflow.
In an embodiment of the present application, the apparatus further includes:
the judging unit is used for judging whether all the data to be matched inquired by the database end are returned;
the matching unit 102 is specifically configured to: and if the data to be matched inquired by the database end are not completely returned and the target data are not matched, matching the data to be matched with the target data one by one based on the N data to be matched returned after the M data to be matched are returned by the database end.
In an embodiment of the present application, the apparatus further includes:
the connection unit is used for establishing connection with the database end;
the apparatus is further configured to: and if the matching of the target data is finished or the data to be matched inquired by the database end is completely returned, releasing the connection with the database end.
In an embodiment of the present application, the preset value M is equal to the number of at most data to be matched that can be stored in the memory of the application server.
In a scenario where reservation slip data and product data are matched, the data matching apparatus includes:
a sending unit 101, configured to send a query request carrying a query statement and a preset value M to a database;
the matching unit 102 is configured to match the reservation order data with preset product data one by one based on the M reservation order data returned by the database; the reservation list data is inquired by a database end according to the query statement, the reservation list data comprises condition information corresponding to product attributes, and the matching is to match the product attributes of the preset product data with the condition information;
the matching unit 102 is further configured to: if the preset product data are not matched, matching the reservation order data with the preset product data one by one based on N reservation order data returned after the M reservation order data are returned by the database end; n is more than or equal to 1 and less than or equal to M.
Fig. 5 is a schematic block diagram of a data query apparatus according to an embodiment of the present application. The functions of the units in the device are similar to the functions of the steps in the method, so that reference can be made to the contents of the embodiments of the method. In this embodiment of the application, the data query apparatus may include:
a receiving unit 201, configured to receive a query request carrying a query statement and a preset value M sent by an application server;
a returning unit 202, configured to return M pieces of data to be matched to the application server; the data to be matched are inquired according to the query statement, and the data to be matched are used for matching with target data one by one;
the return unit 202 is further configured to: if the target data is not matched, after the M pieces of data to be matched are returned to the application server, returning N pieces of data to be matched behind the M pieces of data to be matched to the application server; n is more than or equal to 1 and less than or equal to M.
In the data query device, the receiving unit 201 receives the query request sent by the application server only once, and in the data query process, the returning unit 202 returns the queried data to be matched in batches according to the preset value M and the data matching condition of the application server (whether matching of target data is completed), so that the load of a database end can be greatly relieved on the premise of ensuring that the memory of the data matching device does not overflow.
In a scenario where reservation order data is matched with product data, the data query method may include:
a receiving unit 201, configured to receive a query request carrying a query statement and a preset value M sent by an application server;
a returning unit 202, configured to return M reservation ticket data to the application server; the reservation data is inquired according to the query statement, and the reservation data is used for matching with product data one by one; the reservation sheet data comprises condition information corresponding to product attributes, and the matching is to match the product attributes of the preset product data with the condition information;
the return unit 202 is further configured to: if the target data is not matched, after the M pieces of reservation single data are returned to the application server, returning N pieces of reservation single data behind the M pieces of reservation single data to the application server; n is more than or equal to 1 and less than or equal to M.
It is worth mentioning that what this application provided is a kind of STREAMING inquiry mechanism, compare with the paging inquiry mode of prior art, this kind of STREAMING inquiry is fit for the scene that the data to be matched in the database is in constantly changing very much, it can sense the data change to be matched in the database in the inquiry process, thus can inquire comparatively real-time, accurate data to be matched and return to the application server in batches and carry out the match, thus has guaranteed the accuracy of the data matching process.
For convenience of description, the above devices are described as being divided into various units by function, and are described separately. Of course, the functionality of the units may be implemented in one or more software and/or hardware when implementing the present application.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
The embodiments in the present specification are described in a progressive manner, and the same and similar parts among the embodiments are referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for the system embodiment, since it is substantially similar to the method embodiment, the description is simple, and for the relevant points, reference may be made to the partial description of the method embodiment.
The above description is only an example of the present application and is not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (14)

1. A method for data matching, comprising:
the application server sends a query request carrying a query statement and a preset numerical value M to a database terminal;
the application server matches the data to be matched with the target data one by one based on the M pieces of data to be matched returned by the database end; the data to be matched is inquired by the database end according to the inquiry statement;
if the target data are not matched, the application server matches the data to be matched with the target data one by one based on the N data to be matched returned after the database end returns the M data to be matched; n is more than or equal to 1 and less than or equal to M.
2. The method of claim 1, wherein before the application server matches the data to be matched with the target data one by one based on the N data to be matched returned by the database after the M data to be matched are returned, the method further comprises:
the application server judges whether the data to be matched inquired by the database end is returned completely;
if the target data is not matched, the application server matches the data to be matched with the target data one by one based on the N data to be matched which are returned by the database end and are behind the M data to be matched, and the method specifically comprises the following steps:
and if the data to be matched inquired by the database end are not completely returned and the target data are not matched, the application server matches the data to be matched with the target data one by one based on the N data to be matched returned after the database end returns the M data to be matched.
3. The method of claim 2, wherein before the application server sends the query request carrying the query statement and the preset value M to the database, the method further comprises:
the application server establishes connection with a database end;
the method further comprises:
and if the matching of the target data is finished or the data to be matched inquired by the database end is completely returned, the application server releases the connection with the database end.
4. The method of claim 1, wherein the predetermined value M is equal to at most the number of pieces of data to be matched that can be stored in the memory of the application server.
5. A method for data matching, comprising:
the application server sends a query request carrying a query statement and a preset numerical value M to a database terminal;
the application server matches the reservation order data with preset product data one by one based on M reservation order data returned by the database end; the reservation list data is inquired by a database end according to the query statement, the reservation list data comprises condition information corresponding to product attributes, and the matching is to match the product attributes of the preset product data with the condition information;
if the preset product data are not matched, the application server matches the reservation order data with the preset product data one by one based on N reservation order data returned after the M reservation order data are returned by the database end; n is more than or equal to 1 and less than or equal to M.
6. A method for querying data, comprising:
the database end receives a query request which is sent by an application server and carries a query statement and a preset numerical value M;
the database end returns M pieces of data to be matched to the application server; the data to be matched are inquired by the database end according to the inquiry statement, and the data to be matched are used for matching with target data one by one;
if the target data is not matched, the database end returns N pieces of data to be matched after the M pieces of data to be matched to the application server after returning the M pieces of data to be matched to the application server; n is more than or equal to 1 and less than or equal to M.
7. A method for querying data, comprising:
the database end receives a query request which is sent by an application server and carries a query statement and a preset numerical value M;
the database end returns M pieces of reservation list data to the application server; the reservation list data is inquired by the database end according to the query statement, and the reservation list data is used for matching with the product data one by one; the reservation sheet data comprises condition information corresponding to product attributes, and the matching is to match the product attributes of the preset product data with the condition information;
if the target data is not matched, the database end returns N pieces of reservation order data behind the M pieces of reservation order data to the application server after returning the M pieces of reservation order data to the application server; n is more than or equal to 1 and less than or equal to M.
8. A data matching apparatus, comprising:
the sending unit is used for sending a query request carrying a query statement and a preset numerical value M to the database end;
the matching unit is used for matching the data to be matched with the target data one by one based on the M pieces of data to be matched returned by the database end; the data to be matched is inquired by the database end according to the inquiry statement;
the matching unit is also used for:
if the target data are not matched, matching the data to be matched with the target data one by one based on N data to be matched which are returned after the M data to be matched are returned by the database end; n is more than or equal to 1 and less than or equal to M.
9. The apparatus of claim 8, wherein the apparatus further comprises:
the judging unit is used for judging whether all the data to be matched inquired by the database end are returned;
the matching unit is specifically configured to:
and if the data to be matched inquired by the database end are not completely returned and the target data are not matched, matching the data to be matched with the target data one by one based on the N data to be matched returned after the M data to be matched are returned by the database end.
10. The apparatus of claim 9, wherein the apparatus further comprises:
the connection unit is used for establishing connection with the database end;
the apparatus is further configured to:
and if the matching of the target data is finished or the data to be matched inquired by the database end is completely returned, releasing the connection with the database end.
11. The apparatus of claim 8, wherein the predetermined value M is equal to at most the number of pieces of data to be matched that can be stored in the memory of the application server.
12. A data matching apparatus, comprising:
the sending unit is used for sending a query request carrying a query statement and a preset numerical value M to the database end;
the matching unit is used for matching the reservation bill data with preset product data one by one on the basis of M reservation bill data returned by the database end; the reservation list data is inquired by a database end according to the query statement, the reservation list data comprises condition information corresponding to product attributes, and the matching is to match the product attributes of the preset product data with the condition information;
the matching unit is also used for:
if the preset product data are not matched, matching the reservation order data with the preset product data one by one based on N reservation order data returned after the M reservation order data are returned by the database end; n is more than or equal to 1 and less than or equal to M.
13. A data query apparatus, comprising:
the receiving unit is used for receiving a query request which is sent by an application server and carries a query statement and a preset numerical value M;
the return unit is used for returning M pieces of data to be matched to the application server; the data to be matched are inquired according to the query statement, and the data to be matched are used for matching with target data one by one;
the return unit is further configured to:
if the target data is not matched, after the M pieces of data to be matched are returned to the application server, returning N pieces of data to be matched behind the M pieces of data to be matched to the application server; n is more than or equal to 1 and less than or equal to M.
14. A data query apparatus, comprising:
the receiving unit is used for receiving a query request which is sent by an application server and carries a query statement and a preset numerical value M;
the return unit is used for returning M pieces of reservation sheet data to the application server; the reservation data is inquired according to the query statement, and the reservation data is used for matching with product data one by one; the reservation sheet data comprises condition information corresponding to product attributes, and the matching is to match the product attributes of the preset product data with the condition information;
the return unit is further configured to:
if the target data is not matched, after the M pieces of reservation order data are returned to the application server, returning N pieces of reservation order data behind the M pieces of reservation order data to the application server; n is more than or equal to 1 and less than or equal to M.
CN201610701995.3A 2016-03-28 2016-08-22 Data matching method, data query method and device Active CN106874336B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2016101846929 2016-03-28
CN201610184692 2016-03-28

Publications (2)

Publication Number Publication Date
CN106874336A CN106874336A (en) 2017-06-20
CN106874336B true CN106874336B (en) 2020-07-28

Family

ID=59238900

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610701995.3A Active CN106874336B (en) 2016-03-28 2016-08-22 Data matching method, data query method and device

Country Status (1)

Country Link
CN (1) CN106874336B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107402982A (en) * 2017-07-07 2017-11-28 阿里巴巴集团控股有限公司 Data write-in, data matching method, device and computing device
CN109544329B (en) * 2018-10-09 2023-09-05 创新先进技术有限公司 Method, device and system for matching

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101535945A (en) * 2006-04-25 2009-09-16 英孚威尔公司 Full text query and search systems and method of use
CN101626372A (en) * 2008-07-07 2010-01-13 华为技术有限公司 Method and system for realizing relative condition evaluation, server and client
CN101826084A (en) * 2009-03-05 2010-09-08 深圳市万泉河科技有限公司 Fast searching method for files, fast searching method for mass talent hiring on Internet and system
CN104809130A (en) * 2014-01-27 2015-07-29 腾讯科技(深圳)有限公司 Method, equipment and system for data query

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7152060B2 (en) * 2002-04-11 2006-12-19 Choicemaker Technologies, Inc. Automated database blocking and record matching
US10083249B2 (en) * 2010-09-23 2018-09-25 Fisher-Rosemount Systems, Inc. Systems, methods and articles of manufacture to provide a search service to a process control system
CN104615726B (en) * 2015-02-06 2017-12-22 北京神舟航天软件技术有限公司 A kind of method based on slow loading technique displaying a large number of services object
CN104965891B (en) * 2015-06-18 2018-04-27 福建富士通信息软件有限公司 The method and system realized across the sequence of more relational databases are calculated based on distributed stream

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101535945A (en) * 2006-04-25 2009-09-16 英孚威尔公司 Full text query and search systems and method of use
CN101626372A (en) * 2008-07-07 2010-01-13 华为技术有限公司 Method and system for realizing relative condition evaluation, server and client
CN101826084A (en) * 2009-03-05 2010-09-08 深圳市万泉河科技有限公司 Fast searching method for files, fast searching method for mass talent hiring on Internet and system
CN104809130A (en) * 2014-01-27 2015-07-29 腾讯科技(深圳)有限公司 Method, equipment and system for data query

Also Published As

Publication number Publication date
CN106874336A (en) 2017-06-20

Similar Documents

Publication Publication Date Title
CN109936511B (en) Token obtaining method, device, server, terminal equipment and medium
CN108881448B (en) API request processing method and device
AU2010314292C1 (en) Method and system for adapting a session timeout period
CN109614209B (en) Task processing method, application server and system
US20160285812A1 (en) Method of issuing messages of a message queue and a message issuing device
CN107451853B (en) Method, device and system for real-time red packet distribution and storage medium
CN111404838A (en) Message processing method, device and equipment
CN110969387A (en) Order distribution method, server, terminal and system
CN106874336B (en) Data matching method, data query method and device
CN107886424B (en) Settlement data processing method and device, computer equipment and storage medium
CN111178568B (en) Service reservation request processing method, device, server and storage medium
CN110910557A (en) Service handling duration prediction method, device, server and storage medium
CN111459675A (en) Data processing method and device, readable storage medium and electronic equipment
CN111092814A (en) Service handling request message distribution method and equipment
CN110659272A (en) Data cleaning method and system
CN111582407B (en) Task processing method and device, readable storage medium and electronic equipment
CN111400283B (en) Data processing method, system, electronic equipment and storage medium
CN108647801A (en) Predict the method and device of account hot spot
CN106530084B (en) Information processing method and server
CN112596985A (en) IT asset detection method, device, equipment and medium
CN116226178A (en) Data query method and device, storage medium and electronic device
CN111724788B (en) Service processing method, device and equipment
CN111311150B (en) Distribution task grouping method, platform, electronic equipment and storage medium
CN113781214A (en) Packaging method, device and equipment for promoting transaction TPS (transaction transfer protocol) based on PoW (PoW)
CN111340413A (en) Distribution method, distribution device, server and storage medium of distribution tasks

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
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20200921

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Patentee after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Patentee before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200921

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Patentee after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Patentee before: Alibaba Group Holding Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20220411

Address after: Room 602, No. 618, Wai Road, Huangpu District, Shanghai 200010

Patentee after: Ant fortune (Shanghai) Financial Information Service Co.,Ltd.

Address before: Ky1-9008 business centre, 27 Hospital Road, Georgetown, grand caiman, UK

Patentee before: Innovative advanced technology Co.,Ltd.

TR01 Transfer of patent right