CN107045499A - A kind of method and server for realizing data query - Google Patents

A kind of method and server for realizing data query Download PDF

Info

Publication number
CN107045499A
CN107045499A CN201610079493.1A CN201610079493A CN107045499A CN 107045499 A CN107045499 A CN 107045499A CN 201610079493 A CN201610079493 A CN 201610079493A CN 107045499 A CN107045499 A CN 107045499A
Authority
CN
China
Prior art keywords
query
paging
data
statement
preset
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201610079493.1A
Other languages
Chinese (zh)
Inventor
景小卫
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
ZTE Corp
Original Assignee
ZTE Corp
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 ZTE Corp filed Critical ZTE Corp
Priority to CN201610079493.1A priority Critical patent/CN107045499A/en
Priority to PCT/CN2017/072178 priority patent/WO2017133538A1/en
Publication of CN107045499A publication Critical patent/CN107045499A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24564Applying rules; Deductive queries
    • G06F16/24565Triggers; Constraints
    • 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/2455Query execution
    • G06F16/24553Query execution of query operations

Landscapes

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

Abstract

A kind of method and server for realizing data query, including:Server is received after query statement, and paging query sentence is generated according to query statement;Server performs each paging query sentence of generation, returns to corresponding inquiry data.Present invention method, by the paging query sentence that generates inquire about the feedback quantity of data according to query statement when paging query reduces and carries out big table data access, it is to avoid the waste of network communication and server resource, improves user experience.

Description

Method and server for realizing data query
Technical Field
The present invention relates to data processing technologies, and in particular, to a method and a server for implementing data query.
Background
Network management for telecommunications, power system monitoring, online stores, etc. often maintain large amounts of data, which are typically stored in tables in database systems; for example, data such as daily performance and alarm information of a system need to be maintained in telecommunication network management and power system monitoring, a large amount of commodity information data need to be maintained in an online store, the maintained data is usually huge in quantity, and a table used for storing the data is called a large table; for example, a large table for storing daily performance data of telecommunication network management is generated every 15 minutes according to various detection points in network elements, single boards and single boards, and the daily performance data stored by the large table in 1 month coupled with a large telecommunication network can reach an amazing scale. The user queries and browses the data stored in the large table through the client to obtain the required content (interesting and valuable content). The purpose of a user querying a large table is very broad and may involve a large amount of data.
Currently, the following methods are mainly used for accessing data in a large table: firstly, when data is queried, a server acquires all data meeting a query command according to the query command and then sends all the data to a client; and secondly, the server sends the query results with fixed number or fixed time to the client in batches according to the query command.
When the two methods are adopted to access the data in the large table, no matter the user looks at or does not look at the large table, a large amount of query data is continuously sent to the client, so that the waste of network communication and server resources is caused, and meanwhile, the response speed of the client is reduced, and the use experience of the user is influenced.
Disclosure of Invention
In order to solve the technical problem, the invention provides a method and a server for realizing data query, which can avoid a large amount of feedback query data when accessing a large table.
In order to achieve the purpose of the invention, the invention provides a method for realizing data query, which comprises the following steps:
after receiving the query instruction, the server generates a paging query statement according to the query instruction;
and the server executes the generated paging query statements and returns corresponding query data according to the paging query statements.
Optionally, generating the paging query statement includes:
generating the paging query statement according to the query instruction and a fixed query scale; or,
generating a first paging query statement according to a fixed query scale, and then generating a subsequent paging query statement according to a query record of a previous paging query statement;
the query scale is the product of the number of query windows and the display data volume of the query windows;
the query record comprises: the query window number, the query duration, the transmission duration of the query data and the insertion duration of the query data when each paging query statement is executed are in one-to-one correspondence with each paging query statement.
Optionally, generating a subsequent paging query statement according to a query record of a previous paging query statement includes:
calculating a quotient obtained by dividing the query duration of a previous paging query statement by a preset response threshold value, and taking the quotient as an easy-to-use coefficient;
if the easy-to-use coefficient is in the preset interval, the query scale is not adjusted;
if the easy-to-use coefficient exceeds the preset interval, when the number of the query records is smaller than a preset value, the query scale of the next subsequent paging query statement is not adjusted, and the next subsequent paging query statement is generated;
and if the easy-to-use coefficient exceeds a preset interval, when the number of the query records is greater than a preset value, adjusting the query scale of a next paging query statement according to the query records, and generating a next paging query statement according to the adjusted query scale.
Optionally, before generating a subsequent paging query statement according to a query duration of a previous paging query statement, the method further includes:
and respectively carrying out query timing on each paging query statement to obtain the query duration of the previous paging query statement.
Optionally, the method further includes:
when the paging query statement fails to query, feeding back query failure information;
the query failure information comprises a query failure reason and/or a preset query failure code.
Optionally, the method further includes:
determining whether the returned query data is the last packet data of the last paging query statement;
if the data is the last sub-packet data of the last paging inquiry statement, executing the insertion processing of the last sub-packet data in an inquiry window for browsing inquiry data: and if the data is not the last sub-packet data of the last paging inquiry statement, executing the insertion processing of the intermediate data in an inquiry window for browsing the inquiry data.
Optionally, the method further includes:
when detecting that a query window for browsing query data turns pages, determining whether the number of the query windows for displaying the query data which are left at present reaches a preset post-trigger threshold value;
if the number of the query windows for displaying the query data which are left at present does not reach a preset triggered post-threshold value, continuing to display the query data of the query statement of the current page; and if the number of the query windows for displaying the query data which are remained at present reaches a preset post-trigger threshold, executing the next post-paging query statement.
Optionally, the method further includes:
and stopping executing the paging query statement when the page turning of the query window is not detected or the operation of closing the query window is received.
Optionally, the method further includes:
counting the display time of the query windows with the preset number;
determining the display duration of the rest query windows according to the average display duration of the query windows;
and when the display duration of the rest query windows reaches a preset trigger threshold, executing the following paging query statement.
On the other hand, an embodiment of the present invention further provides a server for implementing data query, including: a generating unit and a returning unit; wherein,
the generating unit is used for generating a paging query statement according to the query instruction after receiving the query instruction;
and the return unit is used for executing the generated paging query statements and returning corresponding query data according to the paging query statements.
Optionally, the generating unit is specifically configured to,
after the query instruction is received, the query instruction is sent to the user,
generating the paging query statement according to the query instruction and a fixed query scale; or,
generating a first paging query statement according to a fixed query scale, and then generating a subsequent paging query statement according to a query record of a previous paging query statement;
the query scale is the product of the number of query windows and the display data volume of the query windows;
the query record comprises: the query window number, the query duration, the transmission duration of the query data and the insertion duration of the query data when each paging query statement is executed are in one-to-one correspondence with each paging query statement.
Optionally, the generating unit is specifically configured to,
after the query instruction is received, the query instruction is sent to the user,
generating the paging query statement according to the query instruction and a fixed query scale; or,
calculating a quotient obtained by dividing the query duration of a previous paging query statement by a preset response threshold value, and taking the quotient as an easy-to-use coefficient;
if the easy-to-use coefficient is in the preset interval, the query scale is not adjusted;
if the easy-to-use coefficient exceeds the preset interval, when the number of the query records is smaller than a preset value, the query scale of the next subsequent paging query statement is not adjusted, and the next subsequent paging query statement is generated;
if the easy-to-use coefficient exceeds the preset interval, when the number of the query records is larger than a preset value, the query scale of a next paging query statement is adjusted according to the query time, and a next paging query statement is generated according to the adjusted query scale.
Optionally, the server further includes a timing unit, configured to generate a timing sequence according to the query duration of the previous paging query statement before the subsequent paging query statement,
and respectively carrying out query timing on each paging query statement to obtain the query duration of the previous paging query statement.
Optionally, the server further includes a query feedback unit, configured to feed back query failure information when the paging query statement fails to query;
the query failure information comprises a query failure reason and/or a preset query failure code.
Optionally, the server further includes a sub-packet processing unit, configured to determine whether the returned query data is the last sub-packet data of the last paging query statement;
if the data is the last sub-packet data of the last paging inquiry statement, executing the insertion processing of the last sub-packet data in an inquiry window for browsing inquiry data: and if the data is not the last sub-packet data of the last paging inquiry statement, executing the insertion processing of the intermediate data in an inquiry window for browsing the inquiry data.
Optionally, the server further includes a page turning processing unit:
when detecting that a query window for browsing query data turns pages, determining whether the number of the query windows for displaying the query data which are left at present reaches a preset post-trigger threshold value;
if the number of the query windows for displaying the query data which are left at present does not reach a preset triggered post-threshold value, continuing to display the query data of the query statement of the current page; and if the number of the query windows for displaying the query data which are remained at present reaches a preset post-trigger threshold, executing the next post-paging query statement.
Optionally, the server further includes a stopping unit, configured to stop executing the paging query statement when no page turning of the query window is detected or an operation of closing the query window is received.
Optionally, the server further includes a triggering unit, configured to count display times of a preset number of query windows;
determining the display duration of the rest query windows according to the average display duration of the query windows;
and when the display duration of the rest query windows reaches a preset trigger threshold, executing the following paging query statement.
Compared with the related art, the technical scheme of the application comprises the following steps: after receiving the query instruction, the server generates a paging query statement according to the query instruction; and the server executes the generated paging query statements and returns corresponding query data according to the paging query statements. According to the method provided by the embodiment of the invention, the paging query is carried out according to the paging query statement generated by the query instruction, so that the feedback quantity of query data during large-table data access is reduced, the waste of network communication and server resources is avoided, and the use experience of a user is improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a method for implementing data query according to an embodiment of the present invention;
FIG. 2 is a block diagram of a server for implementing data query according to an embodiment of the present invention;
fig. 3 is a flowchart of a method of an application example of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that the embodiments and features of the embodiments in the present application may be arbitrarily combined with each other without conflict.
Fig. 1 is a flowchart of a method for implementing data query according to an embodiment of the present invention, as shown in fig. 1, including:
step 100, after receiving a query instruction, a server generates a paging query statement according to the query instruction;
optionally, generating the paging query statement includes:
generating a paging query statement according to a query instruction and a fixed query scale; or,
generating a first paging query statement according to a fixed query scale, and then generating a subsequent paging query statement according to a query record of a previous paging query statement;
the query scale is the product of the number of query windows and the display data volume of the query windows; here, the query window display data amount may be understood as a query window size;
the query records comprise: the query window number, the query duration, the transmission duration of the query data and the insertion duration of the query data when each paging query statement is executed are in one-to-one correspondence with each paging query statement. Each paging query statement includes a query record corresponding to each other.
Optionally, generating a subsequent paging query statement according to a query record of a previous paging query statement includes:
calculating a quotient obtained by dividing the query duration of a previous paging query statement by a preset response threshold value, and taking the quotient as an easy-to-use coefficient;
if the easy-to-use coefficient is in the preset interval, the query scale is not adjusted;
it should be noted that the preset interval in the embodiment of the present invention may be (0.8, 1.05). The preset interval may be an empirical value of a person skilled in the art, and the reference is made to smoothly browse the query data, and the bottom line is made to be the feedback time of the slowest query data that can be accepted.
If the easy-to-use coefficient exceeds the preset interval, when the number of the query records is smaller than a preset numerical value, the query scale of the next subsequent paging query statement is not adjusted;
and if the usability coefficient exceeds the preset interval, adjusting the query scale of the next paging query statement according to the query record when the number of the query records is greater than the preset value.
It should be noted that, the query duration of the application example may be recorded by the server; the time from the starting time of executing the paging query statement to the time of inserting the query data into the query window can be recorded through a client timer, and the transmission time length of the query data is obtained by subtracting the query time length from the time from the starting time of executing the paging query statement to the time of inserting the query data into the query window. In addition, the query duration, the transmission duration of the query data and the insertion duration of the query data can be stored in a queue mode.
In the embodiment of the present invention, it is assumed that the number of query windows is w, and the sum of the transmission time length of query data and the insertion time length of query data is T1A first fitting function T can be obtained by fitting1A and b in the first fitting function can be obtained by querying the content of the record by a preset number; suppose a query duration is T2Fitting to obtain a second fitting function T2C and w + d in the second fitting function can be obtained by inquiring the content of the record by a preset number; setting target response time, and calculating the number of the query window number w of the next page query statement according to the target response time equal to (a x w + c) + (b x w + d)Values, rounded up or down if the calculated value is not an integer. In the application example, the target response time may be set to be the same as a preset response threshold value, and may also be adjusted according to the feedback speed requirement of the actual query data.
Optionally, the query scale of the subsequent paging query statement may be calculated at the client, for example, the server sends the recorded query duration to the client, and the client calculates the query scale of the subsequent paging query statement by using the first fitting function, the second fitting function and the target response time in combination with the transmission duration of the query data recorded by the client and the insertion duration of the query data; the query scale of the next paging query statement may be calculated at the server, for example, the client sends the recorded transmission duration of the query data and the insertion duration of the query data to the server, and the server calculates the query scale of the next paging query statement by using the first fitting function, the second fitting function and the target response time in combination with the query duration recorded by the server;
in the embodiment of the invention, when the query scale of the subsequent paging query statement is adjusted according to the query record, if the query scale is too large, the easy-to-use coefficient is theoretically larger than the maximum value of the preset interval, the feedback of query data can be accelerated by reducing the number of query windows of the subsequent paging query statement, and the easy-to-use coefficient is theoretically reduced; if the query scale is too small, the usability coefficient is theoretically smaller than the minimum value of the preset interval, and the data volume of the query data can be increased by increasing the number of query windows of the subsequent paging query statement; the method comprises the steps that a user can obtain enough information when executing a paging query statement; that is, when the easy-to-use coefficient is larger than the maximum value of the preset interval, the number of query windows of the next paging query statement is reduced; and when the usability coefficient is smaller than the maximum value of the preset interval, increasing the number of the query windows of the next paging query statement. The reduction and the increase of the specific query window number can be obtained by calculation with reference to a fitting function, and can also be adjusted according to a preset step length or an adjusting function.
Step 101, the server executes the generated paging query statements, and returns corresponding query data according to the paging query statements.
Before generating a subsequent paging query statement according to the query duration of a previous paging query statement, the method of the embodiment of the present invention further includes:
and respectively carrying out query timing on each paging query statement so as to obtain the query duration of the previous paging query statement.
Optionally, the method in the embodiment of the present invention further includes:
when the paging query statement fails to query, feeding back query failure information;
the query failure information comprises a query failure reason and/or a preset query failure code.
Optionally, the method in the embodiment of the present invention further includes:
determining whether the returned query data is the last packet data of the last paging query statement;
if the data is the last sub-packet data of the last paging inquiry statement, executing the insertion processing of the last sub-packet data in an inquiry window for browsing inquiry data: and if the data is not the last sub-packet data of the last paging inquiry statement, executing the insertion processing of the intermediate data in an inquiry window for browsing the inquiry data.
Optionally, the method in the embodiment of the present invention further includes:
when detecting that a query window for browsing query data turns pages, determining whether the number of the query windows for displaying the query data which are left at present reaches a preset post-trigger threshold value; here, the post-trigger threshold may be set to a fixed number, e.g., set to 1/3 for rounding up or down the number of query windows;
if the number of the query windows for displaying the query data which are left at present does not reach a preset triggered post-threshold value, continuing to display the query data of the query statement of the current page; and if the number of the query windows for displaying the query data which are remained at present reaches a preset post-trigger threshold, executing the next post-paging query statement.
It should be noted that, by determining whether the number of the query windows displaying the query data currently remaining reaches a preset post-trigger threshold, and then determining whether to execute the next subsequent paging query statement, the data query of the subsequent paging query statement is performed in advance, so that the feedback efficiency of the query data is improved.
Optionally, the method in the embodiment of the present invention further includes:
and stopping executing the paging query statement when the page turning of the query window is not detected or the operation of closing the query window is received.
Optionally, the method in the embodiment of the present invention further includes:
counting the display time of the query windows with the preset number;
determining the display duration of the rest query windows according to the average display duration of the query windows;
and when the display duration of the rest query windows reaches a preset trigger threshold, executing the following paging query statement.
It should be noted that, when it is determined whether the trigger threshold is met according to the display time of the query window, the execution of the query statement in the following page is performed in advance, so that the speed of the user obtaining the query data corresponding to the query statement in the following page is increased, and the user experience is improved. The processing of the method of the embodiment of the invention can be realized by a central processing unit; the execution content related to the embodiment method can be added to the central processing unit after generating a corresponding execution instruction.
According to the method provided by the embodiment of the invention, the feedback quantity of the query data during large-table data access is reduced through paging query statements, the waste of network communication and server resources is avoided, and the user experience is improved.
Fig. 2 is a block diagram of a server for implementing data query according to an embodiment of the present invention, as shown in fig. 2, including: a generating unit and a returning unit; wherein,
the generating unit is used for generating a paging query statement according to the query instruction after receiving the query instruction;
and the return unit is used for executing the generated paging query statements and returning corresponding query data according to the paging query statements.
Optionally, the generating unit is specifically configured to,
after the query command is received, the query command is transmitted,
generating a paging query statement according to a query instruction and a fixed query scale; or,
generating a first paging query statement according to a fixed query scale, and then generating a subsequent paging query statement according to a query record of a previous paging query statement;
the query scale is the product of the number of query windows and the display data volume of the query windows;
the query records comprise: the query window number, the query duration, the transmission duration of the query data and the insertion duration of the query data when each paging query statement is executed are in one-to-one correspondence with each paging query statement.
Optionally, the generating unit is specifically configured to,
generating a paging query statement according to a query instruction and a fixed query scale; or,
calculating a quotient obtained by dividing the query duration of a previous paging query statement by a preset response threshold value, and taking the quotient as an easy-to-use coefficient;
if the easy-to-use coefficient is in the preset interval, the query scale is not adjusted;
if the easy-to-use coefficient exceeds the preset interval, when the number of the query records is smaller than a preset value, the query scale of the next subsequent paging query statement is not adjusted, and the next subsequent paging query statement is generated;
and if the easy-to-use coefficient exceeds a preset interval, when the number of the query records is greater than a preset value, adjusting the query scale of a next paging query statement according to the query records, and generating a next paging query statement according to the adjusted query scale.
Optionally, the server in the embodiment of the present invention further includes a timing unit, configured to generate a timing sequence before a subsequent paging query statement according to a query duration of a previous paging query statement,
and respectively carrying out query timing on each paging query statement so as to obtain the query duration of the previous paging query statement.
Optionally, the server in the embodiment of the present invention further includes a query feedback unit, configured to feed back query failure information when a paging query statement fails to be queried;
the query failure information comprises a query failure reason and/or a preset query failure code.
Optionally, the server in the embodiment of the present invention further includes a packet processing unit, configured to determine whether the returned query data is the last packet data of the last paging query statement;
if the data is the last sub-packet data of the last paging inquiry statement, executing the insertion processing of the last sub-packet data in an inquiry window for browsing inquiry data: and if the data is not the last sub-packet data of the last paging inquiry statement, executing the insertion processing of the intermediate data in an inquiry window for browsing the inquiry data.
Optionally, the server in the embodiment of the present invention further includes a page turning processing unit:
when detecting that a query window for browsing query data turns pages, determining whether the number of the query windows for displaying the query data which are left at present reaches a preset post-trigger threshold value;
if the number of the query windows for displaying the query data which are left at present does not reach a preset triggered post-threshold value, continuing to display the query data of the query statement of the current page; and if the number of the query windows for displaying the query data which are remained at present reaches a preset post-trigger threshold, executing the next post-paging query statement.
Optionally, the server according to the embodiment of the present invention further includes a stopping unit, configured to stop executing the paging query statement when no page turning of the query window is detected or an operation of closing the query window is received.
Optionally, the server in the embodiment of the present invention further includes a triggering unit, configured to count display times of the previous preset number of query windows;
determining the display duration of the rest query windows according to the average display duration of the query windows;
and when the display duration of the rest query windows reaches a preset trigger threshold, executing the following paging query statement.
The method of the embodiment of the present invention is described in detail below with specific application examples, which are only used for illustrating the present invention and are not used for limiting the protection scope of the present invention.
Application example
The system of the application example includes a client and a server, the client is deployed in a data access interface of the application system, fig. 3 is a flowchart of a method of the application example of the present invention, as shown in fig. 3, including:
step 300, starting a query thread of data access by a server;
it should be noted that the application example data query thread of the present invention may also be established when the user opens the browse window, which belongs to the conventional technical means of those skilled in the art and is not described herein again. Here, the query thread refers to a query thread that accesses large table data.
Step 301, a client receives a user instruction to determine a data range of access data, and sends a query instruction to a server;
this step triggers the client to enter the data browsing process, which may include the following processing: enabling the client to enter a query state by determining a data range, namely setting the query end state of the client to be false; and sending a query instruction to the server, and enabling the server to enter a query state. The query instruction sent by the application example to the server may include: conditional query statements, browsing window page size, number of query windows; the initial value of the number of query windows may be a preset value, for example, the preset value may be set as the average value of the number of access pages determined by the statistical analysis, for example, the initial value of the number of query windows is set to 5.
Step 302, after receiving the query instruction, the server generates a paging query statement according to the query instruction;
in this step, generating the paging query statement includes:
generating a paging query statement according to a query instruction and a fixed query scale; or,
generating a first paging query statement according to a fixed query scale, and then generating a subsequent paging query statement according to a query record of a previous paging query statement;
the query scale is the product of the number of query windows and the display data volume of the query windows;
the query records comprise: the query window number, the query duration, the transmission duration of the query data and the insertion duration of the query data when each paging query statement is executed are in one-to-one correspondence with each paging query statement.
Optionally, when the paging query statements are generated according to the query instruction and according to the fixed query scale, the query scale of each generated paging query statement may be the same; for example, the number of query windows in the query scale is set to be a fixed value of 5 to 7, and all required paging query statements are generated according to the query instruction at this time.
Generating a subsequent paging query statement from a query record of a previous paging query statement comprises:
calculating the query duration of the previous paging query statement divided by a preset response threshold value to serve as an easy-to-use coefficient;
it should be noted that the response threshold may be determined based on industry standards, customer requirements, or technical design indicators, and the response threshold mainly refers to the response duration of the paging query statement; generally, when large-scale data is queried, the response time of the small operation is in the second level, for example, 3 to 5 seconds, and at this time, the response threshold may be set to 3 to 5 seconds, and if the response threshold is set too large, the user experience of data query by the user will be affected under the condition that the preset interval is not changed.
If the easy-to-use coefficient is in the preset interval, the query scale is not adjusted; the preset interval of the present application example may be (0.8, 1.05). The preset interval may be an empirical value of a person skilled in the art, and the reference is made to smoothly browse the query data, and the bottom line is made to be the feedback time of the slowest query data that can be accepted.
If the easy-to-use coefficient exceeds the preset interval, when the number of the query records is smaller than a preset numerical value, the query scale is not adjusted; here, not adjusting the query size includes: generating a subsequent query statement according to the query scale of the previous paging query statement; the preset numerical value may be set to an integer greater than or equal to 2.
The query records comprise: when each paging query statement is executed, the number of query windows and the query response time which are in one-to-one correspondence with each paging query statement are obtained; wherein the query response time comprises: query duration, query data transmission duration and query data insertion duration;
the query duration of the application example is recorded through the server; the application example can also record the time from the starting time of executing the paging query statement to the time of inserting the query data into the query window through the client timer, and the transmission time length of the query data is obtained by subtracting the query time length from the time from the starting time of executing the paging query statement to the time of inserting the query data into the query window.
Note that the adjustment record may be processed in the server in a queue manner.
And if the usability coefficient exceeds the preset interval, adjusting the query scale of the subsequent paging query statement according to the query record when the number of the query records is greater than a preset value.
In this application example, it is assumed that the sum of the number of query windows w, the transmission time of the query data and the insertion time of the query data is T1A first fitting function T can be obtained by fitting1A and b in the first fitting function can be obtained by querying the content of the record by a preset number; suppose a query duration is T2Fitting to obtain a second fitting function T2C and w + d in the second fitting function can be obtained by inquiring the content of the record by a preset number; setting a target response time, calculating the value of the number w of the query windows of the next page query statement by the target response time being equal to (a × w + c) + (b × w + d), and rounding up or down if the calculated value is not an integer. In the application example, the target response time may be set to be the same as a preset response threshold value, and may also be adjusted according to the feedback speed requirement of the actual query data.
In this application example, the query scale of the next paging query statement may be calculated at the client, for example, the server sends the recorded query duration to the client, and the client calculates the query scale of the next paging query statement by using the first fitting function, the second fitting function and the target response time in combination with the transmission duration of the query data and the insertion duration of the query data recorded by the client; the query scale of the next paging query statement may be calculated at the server, for example, the client sends the recorded transmission duration of the query data and the insertion duration of the query data to the server, and the server calculates the query scale of the next paging query statement by using the first fitting function, the second fitting function and the target response time in combination with the query duration recorded by the server;
here, the condition that the easy-to-use coefficient exceeds the preset interval includes two conditions that the value of the easy-to-use coefficient is smaller than the minimum value of the preset interval and the value of the easy-to-use coefficient is larger than the maximum value of the preset interval; when the numerical value of the easy-to-use coefficient is smaller than the minimum value of the preset interval, the application example obtains a first fitting function and a second fitting function according to the fitting of the query records, and the number of query windows of the next subsequent paging query statement is larger than that of the previous paging query statement through the set target response time; when the numerical value of the easy-to-use coefficient is larger than the maximum value of the preset interval, the application example obtains a first fitting function and a second fitting function according to the fitting of the query records, and the number of query windows of the next subsequent paging query statement is smaller than that of the previous paging query statement through the set target response time; through adjustment, the query data fed back by each paging query statement is integrated in data volume and feedback rate, and the use experience of a user in data query in a large table is improved.
It should be noted that, when a subsequent paging query statement is generated according to the query duration of a previous paging query statement, a preset default value may be used as the query scale of a first paging query statement, where the query scale is equal to the product of the number of query windows and the display data size of the client window; the initial value of the number of the general query windows can be 5-7, and the specific value can be adjusted according to the query data return speed and the user experience when the paging query statement is executed.
The application example method of the invention further comprises: and respectively carrying out query timing on each paging query statement so as to obtain the query duration of the previous paging query statement.
It should be noted that, the application example query timing of the present invention can be performed by a timer, the query duration can be obtained by recording the query start time and the query end time of each paging query statement, and if the query is a continuous query, the end time of the last paging query statement is the start time of the current paging query statement; if the paging query is a discontinuous query, the query duration can be obtained by reading the system time from the beginning to the end of the paging query.
Step 303, the server executes the generated paging query statements and returns corresponding query data according to the paging query statements;
when the paging query statement is queried, the starting time and the query scale are generally pressed into the query stack, and the paging query statement in the query stack is emptied when the execution of the paging query statement is completed.
It should be noted that, the query instruction is executed to access the database or the large table to be accessed according to the existing connection, for example, the connection is established with the database through the database large table access interface; accessing the contents of the connection database or the large tables in the database is a routine technique for those skilled in the art and will not be described herein.
The application example of the invention further comprises:
when the paging query statement fails to query, feeding back query failure information;
optionally, the query failure information may be a query failure reason and/or a preset query failure code.
The application example of the invention further comprises: determining whether the returned query data is the last subcontract data of the last paged query statement:
if the data is the last sub-packet data of the last paging inquiry statement, executing the insertion processing of the last sub-packet data in an inquiry window for browsing inquiry data: alternatively to this, the first and second parts may,
determining whether each piece of extracted sub-packet data is query data of a paging query statement, if so, inserting the extracted data into a client access window for displaying until the data is inserted when the last piece of data of the query data of the paging query statement in the sub-packet data;
it should be noted that, when performing the insertion process, the insertion state is true; when the insertion is stopped, the insertion state is false, the query is finished to be true, and the paging query statement is finished.
And if the data is not the last sub-packet data of the last paging inquiry statement, executing the insertion processing of the intermediate data in an inquiry window for browsing the inquiry data.
It should be noted that, the insertion processing of the intermediate data is the prior art, and each piece of data of the sub-packet data is extracted one by one and inserted into the client access window, so that the out-of-range insertion state is set to be false when the data is inserted; the application example of the invention counts the query duration of the paging query statement, and the query duration of the paging query statement is cut off when the last data completes the insertion of the client access port in the insertion processing of the intermediate data.
The application example method further comprises: when detecting that a query window for browsing query data turns pages, determining whether the number of the query windows for displaying the query data which are left at present reaches a preset post-trigger threshold value;
if the number of the query windows for displaying the query data which are left at present does not reach a preset triggered post-threshold value, continuing to display the query data of the query statement of the current page; and if the number of the query windows for displaying the query data which are remained at present reaches a preset post-trigger threshold, executing the next post-paging query statement.
The application example method further comprises:
and stopping executing the paging query statement when no page turning is detected or an operation of closing the query window is received.
The application example of the invention further comprises:
counting the display time of the query windows with the preset number;
determining the display duration of the rest query windows according to the average display duration of the query windows;
and when the display duration of the rest query windows reaches a preset trigger threshold, executing the following paging query statement.
It should be noted that the preset number is set according to the actual use condition, for example, two or three, and the larger the query scale is, the larger the numerical value of the preset number is.
Step 304, finishing data query according to the query instruction finishing information; here, when the query is finished, the query scale, the query duration, and the like are cleared, disconnected from or kept connected to the database, and the query thread is finished or reserved according to the actual situation.
Although the embodiments of the present invention have been described above, the above description is only for the convenience of understanding the present invention, and is not intended to limit the present invention. It will be understood by those skilled in the art that various changes in form and details may be made therein without departing from the spirit and scope of the invention as defined by the appended claims.

Claims (18)

1. A method for implementing a data query, comprising:
after receiving the query instruction, the server generates a paging query statement according to the query instruction;
and the server executes the generated paging query statements and returns corresponding query data according to the paging query statements.
2. The method of claim 1, wherein generating the paged query statement comprises:
generating the paging query statement according to the query instruction and a fixed query scale; or,
generating a first paging query statement according to a fixed query scale, and then generating a subsequent paging query statement according to a query record of a previous paging query statement;
the query scale is the product of the number of query windows and the display data volume of the query windows;
the query record comprises: the query window number, the query duration, the transmission duration of the query data and the insertion duration of the query data when each paging query statement is executed are in one-to-one correspondence with each paging query statement.
3. The method of claim 2, wherein generating subsequent paged query statements from query records of previous paged query statements comprises:
calculating a quotient obtained by dividing the query duration of a previous paging query statement by a preset response threshold value, and taking the quotient as an easy-to-use coefficient;
if the easy-to-use coefficient is in the preset interval, the query scale is not adjusted;
if the easy-to-use coefficient exceeds the preset interval, when the number of the query records is smaller than a preset value, the query scale of the next subsequent paging query statement is not adjusted, and the next subsequent paging query statement is generated;
and if the easy-to-use coefficient exceeds a preset interval, when the number of the query records is greater than a preset value, adjusting the query scale of a next paging query statement according to the query records, and generating a next paging query statement according to the adjusted query scale.
4. The method of claim 2 or 3, wherein generating the subsequent paged query statement before the subsequent paged query statement according to the query duration of the previous paged query statement, further comprises:
and respectively carrying out query timing on each paging query statement to obtain the query duration of the previous paging query statement.
5. A method according to any one of claims 1 to 3, further comprising:
when the paging query statement fails to query, feeding back query failure information;
the query failure information comprises a query failure reason and/or a preset query failure code.
6. A method according to any one of claims 1 to 3, further comprising:
determining whether the returned query data is the last packet data of the last paging query statement;
if the data is the last sub-packet data of the last paging inquiry statement, executing the insertion processing of the last sub-packet data in an inquiry window for browsing inquiry data: and if the data is not the last sub-packet data of the last paging inquiry statement, executing the insertion processing of the intermediate data in an inquiry window for browsing the inquiry data.
7. A method according to any one of claims 1 to 3, further comprising:
when detecting that a query window for browsing query data turns pages, determining whether the number of the query windows for displaying the query data which are left at present reaches a preset post-trigger threshold value;
if the number of the query windows for displaying the query data which are left at present does not reach a preset triggered post-threshold value, continuing to display the query data of the query statement of the current page; and if the number of the query windows for displaying the query data which are remained at present reaches a preset post-trigger threshold, executing the next post-paging query statement.
8. A method according to any one of claims 1 to 3, further comprising:
and stopping executing the paging query statement when the page turning of the query window is not detected or the operation of closing the query window is received.
9. A method according to any one of claims 1 to 3, further comprising:
counting the display time of the query windows with the preset number;
determining the display duration of the rest query windows according to the average display duration of the query windows;
and when the display duration of the rest query windows reaches a preset trigger threshold, executing the following paging query statement.
10. A server for implementing a data query, comprising: a generating unit and a returning unit; wherein,
the generating unit is used for generating a paging query statement according to the query instruction after receiving the query instruction;
and the return unit is used for executing the generated paging query statements and returning corresponding query data according to the paging query statements.
11. The server according to claim 10, characterized in that the generating unit is specifically configured to,
after the query instruction is received, the query instruction is sent to the user,
generating the paging query statement according to the query instruction and a fixed query scale; or,
generating a first paging query statement according to a fixed query scale, and then generating a subsequent paging query statement according to a query record of a previous paging query statement;
the query scale is the product of the number of query windows and the display data volume of the query windows;
the query record comprises: the query window number, the query duration, the transmission duration of the query data and the insertion duration of the query data when each paging query statement is executed are in one-to-one correspondence with each paging query statement.
12. The server according to claim 10, characterized in that the generating unit is specifically configured to,
after the query instruction is received, the query instruction is sent to the user,
generating the paging query statement according to the query instruction and a fixed query scale; or,
calculating a quotient obtained by dividing the query duration of a previous paging query statement by a preset response threshold value, and taking the quotient as an easy-to-use coefficient;
if the easy-to-use coefficient is in the preset interval, the query scale is not adjusted;
if the easy-to-use coefficient exceeds the preset interval, when the number of the query records is smaller than a preset value, the query scale of the next subsequent paging query statement is not adjusted, and the next subsequent paging query statement is generated;
if the easy-to-use coefficient exceeds the preset interval, when the number of the query records is larger than a preset value, the query scale of a next paging query statement is adjusted according to the query time, and a next paging query statement is generated according to the adjusted query scale.
13. The server according to claim 11 or 12, further comprising a timing unit for generating a preceding paged query statement before a following paged query statement according to a query duration of a preceding paged query statement,
and respectively carrying out query timing on each paging query statement to obtain the query duration of the previous paging query statement.
14. The server according to any one of claims 10 to 12, further comprising a query feedback unit, configured to feed back query failure information when the paged query statement fails to query;
the query failure information comprises a query failure reason and/or a preset query failure code.
15. The server according to any one of claims 10 to 12, further comprising a packetization processing unit configured to determine whether the returned query data is last packetized data of a last paged query statement;
if the data is the last sub-packet data of the last paging inquiry statement, executing the insertion processing of the last sub-packet data in an inquiry window for browsing inquiry data: and if the data is not the last sub-packet data of the last paging inquiry statement, executing the insertion processing of the intermediate data in an inquiry window for browsing the inquiry data.
16. The server according to any one of claims 10 to 12, further comprising a page turning processing unit:
when detecting that a query window for browsing query data turns pages, determining whether the number of the query windows for displaying the query data which are left at present reaches a preset post-trigger threshold value;
if the number of the query windows for displaying the query data which are left at present does not reach a preset triggered post-threshold value, continuing to display the query data of the query statement of the current page; and if the number of the query windows for displaying the query data which are remained at present reaches a preset post-trigger threshold, executing the next post-paging query statement.
17. The server according to any one of claims 10 to 12, further comprising a stopping unit, configured to stop executing the paged query statement when no page turning of the query window is detected or an operation of closing the query window is received.
18. The server according to any one of claims 10 to 12, further comprising a triggering unit, configured to count display times of a preset number of previous query windows;
determining the display duration of the rest query windows according to the average display duration of the query windows;
and when the display duration of the rest query windows reaches a preset trigger threshold, executing the following paging query statement.
CN201610079493.1A 2016-02-05 2016-02-05 A kind of method and server for realizing data query Pending CN107045499A (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201610079493.1A CN107045499A (en) 2016-02-05 2016-02-05 A kind of method and server for realizing data query
PCT/CN2017/072178 WO2017133538A1 (en) 2016-02-05 2017-01-23 Method for realizing data query and server

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610079493.1A CN107045499A (en) 2016-02-05 2016-02-05 A kind of method and server for realizing data query

Publications (1)

Publication Number Publication Date
CN107045499A true CN107045499A (en) 2017-08-15

Family

ID=59500457

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610079493.1A Pending CN107045499A (en) 2016-02-05 2016-02-05 A kind of method and server for realizing data query

Country Status (2)

Country Link
CN (1) CN107045499A (en)
WO (1) WO2017133538A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112416967A (en) * 2020-12-11 2021-02-26 北京北信源软件股份有限公司 Data paging query method and device, electronic equipment and storage medium

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109359060B (en) * 2018-10-24 2023-06-16 三六零科技集团有限公司 Data extraction method, device, computing equipment and computer storage medium
CN111125148B (en) * 2019-12-12 2023-07-07 中化石化销售有限公司 Paging query method and device for database
CN112667662B (en) * 2020-12-25 2022-11-08 银盛支付服务股份有限公司 Common method for analyzing sql and nosql based on json key values
CN114039970A (en) * 2021-11-11 2022-02-11 北京沃东天骏信息技术有限公司 Information downloading method and device, electronic equipment and computer readable medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102880685A (en) * 2012-09-13 2013-01-16 北京航空航天大学 Method for interval and paging query of time-intensive B/S (Browser/Server) with large data size
CN103853727A (en) * 2012-11-29 2014-06-11 深圳中兴力维技术有限公司 Method and system for improving large data volume query performance
US20150178399A1 (en) * 2004-12-15 2015-06-25 W. Daniel Hillis Data storage with lock-free stateless paging capability
CN104965873A (en) * 2015-06-10 2015-10-07 努比亚技术有限公司 Paging inquiring method and apparatus

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7146365B2 (en) * 2003-01-27 2006-12-05 International Business Machines Corporation Method, system, and program for optimizing database query execution
CN101216840A (en) * 2008-01-21 2008-07-09 金蝶软件(中国)有限公司 Data enquiry method and data enquiry system
CN102521405B (en) * 2011-12-26 2014-06-25 中国科学院计算技术研究所 Massive structured data storage and query methods and systems supporting high-speed loading

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150178399A1 (en) * 2004-12-15 2015-06-25 W. Daniel Hillis Data storage with lock-free stateless paging capability
CN102880685A (en) * 2012-09-13 2013-01-16 北京航空航天大学 Method for interval and paging query of time-intensive B/S (Browser/Server) with large data size
CN103853727A (en) * 2012-11-29 2014-06-11 深圳中兴力维技术有限公司 Method and system for improving large data volume query performance
CN104965873A (en) * 2015-06-10 2015-10-07 努比亚技术有限公司 Paging inquiring method and apparatus

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112416967A (en) * 2020-12-11 2021-02-26 北京北信源软件股份有限公司 Data paging query method and device, electronic equipment and storage medium
CN112416967B (en) * 2020-12-11 2024-05-14 北京北信源软件股份有限公司 Data paging query method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
WO2017133538A1 (en) 2017-08-10

Similar Documents

Publication Publication Date Title
CN107045499A (en) A kind of method and server for realizing data query
US9704503B2 (en) Command handling method, apparatus, and system
US20160239540A1 (en) Data Query Method and Apparatus, Server, and System
US20160012150A1 (en) System and method for main distribution network graph/model/data integration based on remote access and information interaction
WO2019019396A1 (en) Push result prediction method and apparatus, computer device and storage medium
KR20130100320A (en) Method for displaying message and message display apparatus
CN111177201B (en) Data stream processing method and related device
US11481318B2 (en) Method and apparatus, and storage system for translating I/O requests before sending
WO2017004921A1 (en) Search result pushing method, device and apparatus, and non-volatile computer storage medium
CN113806651B (en) Data caching method, device, server and storage medium
CN110620699B (en) Message arrival rate determination method, device, equipment and computer readable storage medium
CN111400482A (en) Method and device for establishing question-answer pairs
EP2610759A1 (en) Method and apparatus for managing massive data messages
CN102571371A (en) Network information pushing method and system
CN111159131A (en) Performance optimization method, device, equipment and computer readable storage medium
KR20220108190A (en) Subscription data push method and apparatus in Internet of Things, device and storage medium
CN106257449A (en) A kind of information determines method and apparatus
CN111461198A (en) Action determination method, system and device
CN110134547B (en) Middleware-based repeated data deleting method and related device
CN110730323B (en) Conference interaction information processing method and device, computer device and storage medium
CN108966160B (en) Short message processing method and device and computer readable storage medium
CN113676531A (en) E-commerce flow peak clipping method and device, electronic equipment and readable storage medium
CN106990938A (en) Random number acquisition methods, device and electronic equipment
CN108156241B (en) Method and system for synchronizing information of mobile client and computer network page
CN110909289B (en) Data processing method and system

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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20170815

WD01 Invention patent application deemed withdrawn after publication