[go: up one dir, main page]

CN115114332A - Database query method, device and equipment and readable storage medium - Google Patents

Database query method, device and equipment and readable storage medium Download PDF

Info

Publication number
CN115114332A
CN115114332A CN202210675617.8A CN202210675617A CN115114332A CN 115114332 A CN115114332 A CN 115114332A CN 202210675617 A CN202210675617 A CN 202210675617A CN 115114332 A CN115114332 A CN 115114332A
Authority
CN
China
Prior art keywords
query
database
data items
total number
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
CN202210675617.8A
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.)
Kingdee Software China Co Ltd
Original Assignee
Kingdee Software China Co 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 Kingdee Software China Co Ltd filed Critical Kingdee Software China Co Ltd
Priority to CN202210675617.8A priority Critical patent/CN115114332A/en
Publication of CN115114332A publication Critical patent/CN115114332A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2458Special types of queries, e.g. statistical queries, fuzzy queries or distributed queries
    • G06F16/2462Approximate or statistical queries

Landscapes

  • Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Computational Linguistics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Fuzzy Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application discloses a database query method, a database query device, database query equipment and a readable storage medium in the technical field of computers. The method provided by the application comprises the following steps: acquiring a query instruction, and determining a query condition corresponding to the query instruction; querying a database according to the query condition and a preset query limit value; if the preset query limit number of data items are returned by the database, displaying the preset query limit number of data items returned by the database, and asynchronously counting the total number of the data items which can be searched in the database by the query condition while displaying, so that the page loading time can be reduced, the user waiting time is shortened, and the user query experience is improved. Accordingly, the database query device, the database query equipment and the readable storage medium provided by the application also have the technical effects.

Description

一种数据库查询方法、装置、设备及可读存储介质A database query method, apparatus, device and readable storage medium

技术领域technical field

本申请涉及计算机技术领域,特别涉及一种数据库查询方法、装置、设备及可读存储介质。The present application relates to the field of computer technologies, and in particular, to a database query method, apparatus, device, and readable storage medium.

背景技术Background technique

目前,用户可以在数据库中查询想查的数据条目。当用户输入的查询条件过滤出的数据条目较多时,用户客户端显示页面会出现加载时间过长的情况,导致用户等待时间过长。Currently, users can query the database for the desired data entry. When there are many data items filtered out by the query conditions input by the user, the page displayed by the user client may take too long to load, causing the user to wait too long.

因此,如何降低数据库查询过程中的页面加载时长,是本领域技术人员需要解决的问题。Therefore, how to reduce the page loading time during the database query process is a problem to be solved by those skilled in the art.

发明内容SUMMARY OF THE INVENTION

有鉴于此,本申请的目的在于提供一种数据库查询方法、装置、设备及可读存储介质,以降低数据库查询过程中的页面加载时长。其具体方案如下:In view of this, the purpose of the present application is to provide a database query method, apparatus, device and readable storage medium, so as to reduce the page loading time during the database query process. Its specific plan is as follows:

第一方面,本申请提供了一种数据库查询方法,包括:In a first aspect, the present application provides a database query method, including:

获取查询指令,并确定所述查询指令对应的查询条件;Obtain a query instruction, and determine the query condition corresponding to the query instruction;

按照所述查询条件和预设查询限值查询数据库;Query the database according to the query conditions and preset query limits;

若所述数据库返回所述预设查询限值个数据条目,则显示所述数据库返回的所述预设查询限值个数据条目,并在显示的同时,异步统计所述查询条件在所述数据库中可查到的数据条目总数。If the database returns the preset query limit data items, display the preset query limit data items returned by the database, and asynchronously count the query conditions in the database while displaying. The total number of data entries that can be found in the .

可选地,所述异步统计所述查询条件在所述数据库中可查到的数据条目总数之前,还包括:Optionally, before the asynchronous statistics of the total number of data entries that can be found in the database for the query conditions, further include:

在缓存中查询所述数据条目总数;query the cache for the total number of data entries;

若在缓存中查到所述数据条目总数,则从缓存中获取所述数据条目总数;否则,执行所述异步统计所述查询条件在所述数据库中可查到的数据条目总数的步骤。If the total number of data items is found in the cache, the total number of data items is obtained from the cache; otherwise, the step of asynchronously counting the total number of data items that can be found in the database by the query condition is performed.

可选地,还包括:Optionally, also include:

将所述查询条件、所述预设查询限值个数据条目以及所述数据条目总数存储至缓存。The query condition, the preset query limit number of data items, and the total number of data items are stored in the cache.

可选地,若所述预设查询限值个数据条目分页显示,则所述将所述查询条件、所述预设查询限值个数据条目以及所述数据条目总数存储至缓存之后,还包括:Optionally, if the preset query limit number of data items are displayed in paging, after storing the query condition, the preset query limit number of data items, and the total number of data items in the cache, the method further includes: :

获取用户输入的翻页指令;Get the page turning instruction entered by the user;

从所述缓存中获取并显示所述翻页指令对应的数据条目;Acquire and display the data entry corresponding to the page turning instruction from the cache;

从所述缓存中获取并显示所述数据条目总数。Fetch and display the total number of data entries from the cache.

可选地,所述异步统计所述查询条件在所述数据库中可查到的数据条目总数,包括:Optionally, the asynchronous statistics of the total number of data items that can be found in the database for the query conditions include:

从预设线程池调用空闲线程统计所述数据条目总数。The idle thread is called from the preset thread pool to count the total number of the data items.

可选地,还包括:Optionally, also include:

若所述数据库返回的数据条目个数小于所述预设查询限值,则显示所述数据条目个数和所述数据库返回的所有数据条目。If the number of data items returned by the database is less than the preset query limit, the number of data items and all data items returned by the database are displayed.

可选地,还包括:Optionally, also include:

为所述查询条件分配标识信息,并记录所述标识信息和所述查询条件的映射关系;Allocate identification information for the query condition, and record the mapping relationship between the identification information and the query condition;

若获取到包含所述查询条件的查询指令或翻页指令,则按照所述映射关系显示所述数据条目总数。If the query instruction or page turning instruction including the query condition is obtained, the total number of data items is displayed according to the mapping relationship.

第二方面,本申请提供了一种数据库查询装置,包括:In a second aspect, the present application provides a database query device, comprising:

获取模块,用于获取查询指令,并确定所述查询指令对应的查询条件;an acquisition module, configured to acquire a query instruction and determine the query condition corresponding to the query instruction;

查询模块,用于按照所述查询条件和预设查询限值查询数据库;a query module, used for querying the database according to the query conditions and preset query limit values;

显示模块,用于若所述数据库返回所述预设查询限值个数据条目,则显示所述数据库返回的所述预设查询限值个数据条目,并在显示的同时,异步统计所述查询条件在所述数据库中可查到的数据条目总数。A display module, configured to display the preset query limit data items returned by the database if the database returns the preset query limit data items, and asynchronously count the queries while displaying The total number of data entries available in the database for the condition.

可选地,还包括:Optionally, also include:

查缓存模块,用于在缓存中查询按照当前查询条件在数据库中可查到的数据条目总数;若在缓存中查到数据条目总数,则从缓存中获取数据条目总数;否则,执行异步统计查询条件在数据库中可查到的数据条目总数的步骤。Query cache module, which is used to query the total number of data items that can be found in the database according to the current query conditions in the cache; if the total number of data items is found in the cache, the total number of data items is obtained from the cache; otherwise, an asynchronous statistical query is performed. Steps that condition the total number of data entries that can be found in the database.

可选地,还包括:Optionally, also include:

缓存模块,用于将查询条件、预设查询限值个数据条目以及数据条目总数存储至缓存。The cache module is used to store the query condition, the preset query limit number of data items and the total number of data items in the cache.

可选地,还包括:Optionally, also include:

翻页模块,用于若预设查询限值个数据条目分页显示,则获取用户输入的翻页指令;从缓存中获取并显示翻页指令对应的数据条目;从缓存中获取并显示数据条目总数。The page-turning module is used to obtain the page-turning command input by the user if the preset query limit number of data items are displayed in paging; obtain and display the data items corresponding to the page-turning command from the cache; obtain and display the total number of data items from the cache .

可选地,显示模块具体用于:Optionally, the display module is specifically used for:

从预设线程池调用空闲线程统计按照当前查询条件在数据库中可查到的数据条目总数。Call idle threads from the preset thread pool to count the total number of data entries that can be found in the database according to the current query conditions.

可选地,显示模块还用于:Optionally, the display module is also used to:

若数据库返回的数据条目个数小于预设查询限值,则显示数据条目个数和数据库返回的所有数据条目。If the number of data items returned by the database is less than the preset query limit, the number of data items and all data items returned by the database will be displayed.

可选地,还包括:Optionally, also include:

映射模块,用于为查询条件分配标识信息,并记录标识信息和查询条件的映射关系;若获取到包含查询条件的查询指令或翻页指令,则按照映射关系显示按照查询条件在数据库中可查到的数据条目总数。The mapping module is used to assign identification information to the query conditions, and record the mapping relationship between the identification information and the query conditions; if a query command or page-turning command containing the query conditions is obtained, it will be displayed according to the mapping relationship and can be searched in the database according to the query conditions. The total number of data entries received.

第三方面,本申请提供了一种电子设备,包括:In a third aspect, the present application provides an electronic device, comprising:

存储器,用于存储计算机程序;memory for storing computer programs;

处理器,用于执行所述计算机程序,以实现前述公开的数据库查询方法。The processor is configured to execute the computer program to implement the database query method disclosed above.

第四方面,本申请提供了一种可读存储介质,用于保存计算机程序,其中,所述计算机程序被处理器执行时实现前述公开的数据库查询方法。In a fourth aspect, the present application provides a readable storage medium for storing a computer program, wherein when the computer program is executed by a processor, the database query method disclosed above is implemented.

第五方面,本申请提供了一种计算机程序产品,包括计算机指令,当其在计算机上运行时,使得计算机可以执行前述公开的数据库查询方法。In a fifth aspect, the present application provides a computer program product, comprising computer instructions, which, when executed on a computer, enable the computer to execute the database query method disclosed above.

通过以上方案可知,本申请提供了一种数据库查询方法,包括:获取查询指令,并确定所述查询指令对应的查询条件;按照所述查询条件和预设查询限值查询数据库;若所述数据库返回所述预设查询限值个数据条目,则显示所述数据库返回的所述预设查询限值个数据条目,并在显示的同时,异步统计所述查询条件在所述数据库中可查到的数据条目总数。It can be seen from the above solutions that the present application provides a database query method, comprising: obtaining a query instruction, and determining a query condition corresponding to the query instruction; querying a database according to the query condition and a preset query limit value; if the database If the preset query limit data items are returned, the preset query limit data items returned by the database are displayed, and at the same time of displaying, the query conditions can be found in the database asynchronously. The total number of data entries.

可见,本申请在获取到查询指令,并确定查询指令对应的查询条件后,按照查询条件和预设查询限值查询数据库,此步骤中的预设查询限值可使数据库返回不多于预设查询限值个的数据条目,因此在查询条件过滤得到的数据条目较多时,可以先返回一部分进行显示,从而无需等待查询得到的所有数据条目,因此可以降低页面加载时长。在显示当前所返回的这批数据的同时,异步统计查询条件在数据库中可查到的数据条目总数。也就是说,当前所返回的数据条目的显示无需等待能查到的数据条目总数的统计,可以先显示,由此也可以降低页面加载时长,缩短用户等待时间,从而提升了用户查询体验。It can be seen that after obtaining the query instruction and determining the query conditions corresponding to the query instruction, the present application queries the database according to the query conditions and the preset query limit. The preset query limit in this step can make the database return no more than the preset query limit. The limit number of data items is queried, so when there are many data items filtered by the query conditions, a part of the data items can be returned for display first, so that there is no need to wait for all the data items obtained by the query, so the page loading time can be reduced. While displaying the currently returned batch of data, asynchronously count the total number of data items that can be found in the database by the query condition. That is to say, the display of the currently returned data items does not need to wait for the statistics of the total number of data items that can be found, and can be displayed first, which can also reduce the page loading time, shorten the user's waiting time, and improve the user's query experience.

相应地,本申请提供的一种数据库查询装置、设备、可读存储介质和计算机程序产品,也同样具有上述技术效果。Correspondingly, a database query apparatus, device, readable storage medium and computer program product provided by the present application also have the above technical effects.

附图说明Description of drawings

为了更清楚地说明本申请实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据提供的附图获得其他的附图。In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the accompanying drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only It is an embodiment of the present application. For those of ordinary skill in the art, other drawings can also be obtained according to the provided drawings without any creative effort.

图1为本申请公开的一种数据库查询方法流程图;1 is a flowchart of a database query method disclosed in the application;

图2为本申请公开的一种数据条目和数据条目总数的页面显示示意图;2 is a schematic diagram of a page display of a data entry and the total number of data entries disclosed in this application;

图3为本申请公开的另一种数据库查询方法流程图;3 is a flowchart of another database query method disclosed in the application;

图4为本申请公开的一种执行查询与计数任务的示意图;4 is a schematic diagram of a query and counting task disclosed in the present application;

图5为本申请公开的一种结果明细已显示,但明细总条数未统计得到的页面示意图;FIG. 5 is a schematic diagram of a page in which a result detail disclosed by this application has been displayed, but the total number of details has not been counted;

图6为本申请公开的一种数据库查询装置示意图;6 is a schematic diagram of a database query device disclosed in the application;

图7为本申请公开的一种电子设备示意图;7 is a schematic diagram of an electronic device disclosed in the application;

图8为本申请公开的一种服务器的结构示意图;8 is a schematic structural diagram of a server disclosed in the application;

图9为本申请公开的一种终端的结构示意图。FIG. 9 is a schematic structural diagram of a terminal disclosed in this application.

具体实施方式Detailed ways

下面将结合本申请实施例中的附图,对本申请实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例。基于本申请中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本申请保护的范围。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. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present application.

目前,用户可以在数据库中查询想查的数据条目。当用户输入的查询条件过滤出的数据条目较多时,用户客户端显示页面会出现加载时间过长的情况,导致用户等待时间过长。为此,本申请提供了一种数据库查询方案,能够降低数据库查询过程中的页面加载时长。Currently, users can query the database for the desired data entry. When there are many data items filtered out by the query conditions input by the user, the page displayed by the user client may take too long to load, causing the user to wait too long. Therefore, the present application provides a database query solution, which can reduce the page loading time during the database query process.

参见图1所示,本申请实施例公开了一种数据库查询方法,包括:Referring to FIG. 1 , an embodiment of the present application discloses a database query method, including:

S101、获取查询指令,并确定查询指令对应的查询条件。S101. Acquire a query instruction, and determine a query condition corresponding to the query instruction.

在本实施例中,用户可通过客户端页面输入查询条件,然后客户端将查询条件添加在查询指令中。因此确定查询指令对应的查询条件,包括:从查询指令中获取查询条件。查询条件可以是数据库查询语句,如SQL查询语句等。In this embodiment, the user can input query conditions through the client page, and then the client terminal adds the query conditions to the query instruction. Therefore, determining the query condition corresponding to the query instruction includes: obtaining the query condition from the query instruction. The query condition may be a database query statement, such as an SQL query statement.

S102、按照查询条件和预设查询限值查询数据库。S102, query the database according to the query condition and the preset query limit value.

在本实施例中,数据库可以是任意类型的数据库,如SQL数据库。In this embodiment, the database may be any type of database, such as an SQL database.

S103、若数据库返回预设查询限值个数据条目,则显示数据库返回的预设查询限值个数据条目,并在显示的同时,异步统计查询条件在数据库中可查到的数据条目总数。S103. If the database returns the preset query limit data items, display the preset query limit data items returned by the database, and at the same time of displaying, asynchronously count the total number of data items that can be found in the database by the query condition.

基于查询条件可以在数据库中查询符合该查询条件的所有数据条目。本实施例为避免因查询到的数据条目较多导致用户客户端加载时间过长,设置了预设查询限值,该预设查询限值可减少数据库返回至用户客户端的数据量多少。例如:当预设查询限值为500时,表明数据库针对一个查询条件最多返回500个数据条目,那么若某一次数据库返回了500个数据条目,此时无法确定本次查询到的总数据条目是500还是多于500。但为了避免客户端显示延迟,先显示这500个数据条目,并且后台异步统计本次查询到的总数据条目。当然,若某一次数据库返回了300个数据条目,此时可直接确定本次查询到的总数据条目就是300,因此可同时显示这300个数据条目以及本次查询到的总数据条目300。一般地,数据条目本身和总数据条目在客户端的同一页面显示。如图2所示,各数据条目以列表形式分页显示,总数据条目也显示在当前页面中;翻页时,总数据条目的显示位置和数值不变。Based on the query conditions, all data items that meet the query conditions can be queried in the database. In this embodiment, a preset query limit is set to avoid excessively long loading time of the user client due to a large number of queried data items, and the preset query limit can reduce the amount of data returned from the database to the user client. For example: when the preset query limit is 500, it means that the database returns a maximum of 500 data items for a query condition, then if the database returns 500 data items at a time, it cannot be determined that the total data items queried this time are 500 or more than 500. However, in order to avoid the client display delay, the 500 data items are displayed first, and the total data items queried this time are counted asynchronously in the background. Of course, if the database returns 300 data items at one time, it can be directly determined that the total data items queried this time is 300, so the 300 data items and the total data items 300 queried this time can be displayed at the same time. Typically, the data entry itself and the total data entry are displayed on the same page on the client side. As shown in Figure 2, each data item is displayed in a paging form in the form of a list, and the total data item is also displayed on the current page; when the page is turned, the display position and value of the total data item remain unchanged.

为了实现数据条目显示和数据条目总数统计的异步,可以在后台预设用于统计数据条目总数的线程池。在显示的同时,调用线程池中的线程就可以实现数据条目总数的异步统计。因此在一种具体实施方式中,异步统计查询条件在数据库中可查到的数据条目总数,包括:从预设线程池调用空闲线程统计按照当前查询条件在数据库中可查到的数据条目总数。In order to realize the asynchronous display of data items and the statistics of the total number of data items, a thread pool for counting the total number of data items can be preset in the background. At the same time of displaying, calling the thread in the thread pool can realize the asynchronous statistics of the total number of data items. Therefore, in a specific embodiment, asynchronously counting the total number of data items that can be found in the database by query conditions includes: calling an idle thread from a preset thread pool to count the total number of data items that can be found in the database according to the current query conditions.

当然,用户可能在客户端连续输入查询条件进行查询,那么用于统计数据条目总数的线程可能同时间有多个在运行,为了使用户客户端所显示数据条目和数据条目总数是对应的,可以为每个查询条件分配一个操作标识信息,当需要显示数据条目总数时,基于当前显示的数据条目对应的查询条件确定当前需要显示的数据条目总数。因此在一种具体实施方式中,为查询条件分配标识信息,并记录标识信息和查询条件的映射关系;若获取到包含查询条件的查询指令或翻页指令,则按照映射关系显示按照查询条件在数据库中可查到的数据条目总数。Of course, the user may continuously input query conditions on the client side to conduct queries, so there may be multiple threads running at the same time for counting the total number of data items. An operation identification information is assigned to each query condition, and when the total number of data items needs to be displayed, the total number of data items that need to be displayed currently is determined based on the query condition corresponding to the currently displayed data item. Therefore, in a specific embodiment, identification information is allocated to the query conditions, and the mapping relationship between the identification information and the query conditions is recorded; if a query command or a page-turning command containing the query conditions is obtained, the query conditions are displayed according to the mapping relationship. The total number of data entries available in the database.

需要说明的是,上述确定的查询条件、预设查询限值个数据条目以及数据条目总数都可以存储至客户端缓存,后续如果需要重复显示这些信息(如页面刷新等),可以直接从缓存中获取这些信息进行显示,由此也能降低页面加载时长。因此在一种具体实施方式中,异步统计查询条件在数据库中可查到的数据条目总数之前,还包括:在缓存中查询按照当前查询条件在数据库中可查到的数据条目总数;若在缓存中查到数据条目总数,则从缓存中获取数据条目总数;否则,执行异步统计查询条件在数据库中可查到的数据条目总数的步骤。It should be noted that the above-determined query conditions, the preset query limit number of data items, and the total number of data items can be stored in the client cache. If you need to display these information repeatedly (such as page refresh, etc.), you can directly retrieve the information from the cache. Obtaining this information for display can also reduce page load times. Therefore, in a specific implementation manner, before the asynchronous statistical query condition is before the total number of data items that can be found in the database, it further includes: querying the cache for the total number of data items that can be found in the database according to the current query condition; If the total number of data items found in the database is obtained, the total number of data items is obtained from the cache; otherwise, the step of asynchronously counting the total number of data items that can be found in the database by the query condition is performed.

在一种具体实施方式中,将查询条件、预设查询限值个数据条目以及数据条目总数存储至缓存。其中,若预设查询限值个数据条目分页显示,则将查询条件、预设查询限值个数据条目以及数据条目总数存储至缓存之后,还包括:获取用户输入的翻页指令;从缓存中获取并显示翻页指令对应的数据条目;从缓存中获取并显示数据条目总数。In a specific implementation manner, the query conditions, the preset query limit number of data items, and the total number of data items are stored in the cache. Wherein, if the preset query limit number of data items are displayed in pages, the query conditions, the preset query limit number of data items and the total number of data items are stored in the cache, and the method further includes: obtaining the page-turning instruction input by the user; Get and display the data entry corresponding to the page turning instruction; get and display the total number of data entries from the cache.

在本实施例中,数据条目总数可以按照下述情况进行显示。第一:异步统计得到某一查询条件在数据库中可查到的数据条目总数后,在客户端同一页面显示异步统计得到的数据条目总数以及本次数据库返回的数据条目,显示页面可参照图2。如果客户端页面当前显示的数据条目明细与当前异步统计得到的数据条目总数不对应,则不显示该数据条目总数,而是基于当前页面显示的数据条目所对应的查询条件,确定与当前页面显示的数据条目对应的数据条目总数进行显示。第二:用户翻页时,从缓存获取已缓存的数据条目总数进行显示,因此图2所示的数据条目总数不变。In this embodiment, the total number of data items can be displayed as follows. First: After asynchronous statistics get the total number of data items that can be found in the database for a certain query condition, the total number of data items obtained by asynchronous statistics and the data items returned by the database are displayed on the same page of the client. The display page can refer to Figure 2 . If the details of the data items currently displayed on the client page do not correspond to the total number of data items currently obtained by asynchronous statistics, the total number of data items will not be displayed, but based on the query conditions corresponding to the data items displayed on the current page, the The total number of data entries corresponding to the data entry is displayed. Second: when the user turns pages, the total number of cached data items is obtained from the cache for display, so the total number of data items shown in Figure 2 remains unchanged.

在一种具体实施方式中,若数据库返回的数据条目个数小于预设查询限值,则显示数据条目个数和数据库返回的所有数据条目,而无需再调用后台线程进行数据条目总数的统计,由此能够节约计算机资源,提升页面加载效率。也即:当用户通过搜索条件过滤出来的数据比较少时,不再调用后台线程进行总数目的统计,而是直接基于返回的所有数据条目确定数据条目总数,由此能够同时兼顾查询性能和用户体验。In a specific implementation, if the number of data items returned by the database is less than the preset query limit, the number of data items and all data items returned by the database are displayed, without calling the background thread to count the total number of data items, Therefore, computer resources can be saved, and page loading efficiency can be improved. That is, when the data filtered out by the user through the search criteria is relatively small, the background thread is no longer called to count the total number, but the total number of data items is directly determined based on all the returned data items, so that both query performance and user experience can be considered.

可见,本实施例在获取到查询指令,并确定查询指令对应的查询条件后,按照查询条件和预设查询限值查询数据库,此步骤中的预设查询限值可使数据库返回不多于预设查询限值个的数据条目,因此在查询条件过滤得到的数据条目较多时,可以先返回一部分进行显示,从而无需等待查询得到的所有数据条目,因此可以降低页面加载时长。在显示当前所返回的这批数据的同时,异步统计查询条件在数据库中可查到的数据条目总数。也就是说,当前所返回的数据条目的显示无需等待能查到的数据条目总数的统计,可以先显示,由此也可以降低页面加载时长,缩短用户等待时间,从而提升了用户查询体验。It can be seen that in this embodiment, after the query instruction is obtained and the query conditions corresponding to the query instruction are determined, the database is queried according to the query conditions and the preset query limit. The preset query limit in this step can make the database return no more than the preset query limit. Set the query limit number of data items, so when there are many data items filtered by the query conditions, a part of the data items can be returned for display first, so that there is no need to wait for all the data items obtained by the query, so the page loading time can be reduced. While displaying the currently returned batch of data, asynchronously count the total number of data items that can be found in the database by the query condition. That is to say, the display of the currently returned data items does not need to wait for the statistics of the total number of data items that can be found, and can be displayed first, which can also reduce the page loading time, shorten the user's waiting time, and improve the user's query experience.

下面对本申请实施例提供的一种数据库查询方案进行介绍,下文描述的数据库查询方案与上文描述的一种数据库查询方法可以相互参照。The following describes a database query solution provided by the embodiments of the present application. The database query solution described below and the database query method described above can be referred to each other.

请参见图3,当用户在前端客户端页面输入过滤条件(即查询条件)搜索时,客户端按照过滤条件和500这一预设查询限值查询数据库。若数据库返回的数据条目个数小于500,则客户端后台将查询到的数据条目个数发送给前端,而无需再调用后台线程进行数据条目总数的统计。若数据库查到的数据条目个数不小于500,则客户端后台判断客户端缓存中是否有当前过滤条件对应的相同实体及数据条目总数的计数,如果有,则从缓存中获取相应数据发送给前端,如果没有,则显示这些数据条目,并调用后台线程统计得到本次过滤条件查到的数据条目总数,并将其发送至前端进行展示。当然,还将其进行缓存。当页面关闭或页面刷新时,可以及时清理缓存中的数据。Referring to FIG. 3 , when the user enters filter conditions (ie, query conditions) on the front-end client page to search, the client queries the database according to the filter conditions and a preset query limit of 500. If the number of data items returned by the database is less than 500, the client-side background sends the number of data items queried to the front-end without calling the background thread to count the total number of data items. If the number of data items found in the database is not less than 500, the client backend determines whether there is a count of the same entity and the total number of data items corresponding to the current filter condition in the client cache, and if so, obtains the corresponding data from the cache and sends it to Front-end, if not, display these data items, and call the background thread to count the total number of data items found by this filter condition, and send it to the front-end for display. Of course, it is also cached. When the page is closed or the page is refreshed, the data in the cache can be cleaned up in time.

其中,前端客户端的查询结果列表页面用于数据的展示和搜索等场景。列表页面可基于动态表单模型开发,可以通过绑定不同的动态表单实现不同的列表页面样式;列表页面中的字段一般需要通过映射已有的字段添加;列表页面支持快速搜索,方案过滤等搜索过滤功能。Among them, the query result list page of the front-end client is used for scenarios such as data display and search. The list page can be developed based on the dynamic form model, and different list page styles can be realized by binding different dynamic forms; the fields in the list page generally need to be added by mapping existing fields; the list page supports search filtering such as quick search and scheme filtering Function.

可见,按照本实施例在查询数据库时,查询任务负责查询具体结果明细,同时后台还有计数线程在运行,查询到的相应结果明细不必等待计数线程输出数值后再显示,而是先行显示具体结果明细,在显示的同时执行计数任务。具体的,查询任务和计数任务可参见图4。在显示查询到的具体结果明细时,明细总条数未统计得到之前,明细总条数显示为“加载中”,如图5所示。It can be seen that when querying the database according to this embodiment, the query task is responsible for querying the specific result details, and at the same time, there are counting threads running in the background. Detail, the counting task is performed at the same time as it is displayed. Specifically, the query task and the counting task can be seen in FIG. 4 . When displaying the queried specific result details, before the total number of details is counted, the total number of details is displayed as "Loading", as shown in Figure 5.

其中,计数线程输出数值即为结果明细的总行数。在计算这个数据行数时,使用后台线程执行,等后台线程计算完这个数据行数时,再将这个计算结果展示在前端,因此用户不需要等待数据行数计算完成后再显示数据。当然,在等待这个数据行数的过程中,用户可能选择其他过滤条件又触发了一次查询,那么就会有相应的另一次行数计算。按照用户查询的顺序,在前端列表中显示最后一次查询操作对应的数据行数。由于数据行数计算利用后台线程池执行,因此不同此查询操作对应的计数任务的执行顺序可能不确定,如:后台计数线程可能存在并发情况。Among them, the count thread output value is the total number of rows of result details. When calculating the number of data rows, use the background thread to execute, and when the background thread has finished calculating the number of data rows, the calculation result will be displayed on the front end, so the user does not need to wait for the calculation of the number of data rows to complete before displaying the data. Of course, in the process of waiting for this number of data rows, the user may select other filter conditions and trigger a query again, then there will be another corresponding row number calculation. Display the number of data rows corresponding to the last query operation in the front-end list according to the order of user query. Since the calculation of the number of data rows is performed using the background thread pool, the execution order of the counting tasks corresponding to different query operations may be uncertain, for example, the background counting threads may be concurrent.

为此,本实施例维护了一个位图Map<Long,String>,用于记录每一次查询条件和对应的操作序号。每点击一次查询,操作序号自增加1,并将操作序号和当前查询的SQL查询语句的映射关系记录下来,那么在前端显示行数计数结果时,将最大的操作序号对应的SQL查询语句的计数结果返回并显示。To this end, this embodiment maintains a bitmap Map<Long, String> for recording each query condition and the corresponding operation sequence number. Each time a query is clicked, the operation number increases by 1, and the mapping relationship between the operation number and the SQL query statement of the current query is recorded, then when the row count result is displayed on the front end, the SQL query statement corresponding to the largest operation number is counted. The result is returned and displayed.

可见,本实施例支持异步计数和缓存计数,降低了页面加载时长,缩短了用户等待时间,从而提升了用户查询体验。其中,异步计数指:用户无需等待计数结果的返回就能在前端显示查询结果明细。缓存计数指:可以从缓存中获取与当前页面查询条件对应的计数结果。例如:用户通过上一页/下一页来进行翻页时,不会触发数据行数的计数,而是通过缓存的技术,从缓存中获取当前搜索条件下的数据行数计数结果进行显示。It can be seen that this embodiment supports asynchronous counting and cache counting, reduces the page loading time, shortens the user's waiting time, and thus improves the user's query experience. Among them, asynchronous counting means that the user can display the query result details on the front end without waiting for the return of the counting result. The cache count refers to: the count result corresponding to the query condition of the current page can be obtained from the cache. For example, when the user turns the page through the previous page/next page, the count of the number of data rows will not be triggered, but the count result of the number of data rows under the current search condition is obtained from the cache through the cache technology and displayed.

下面对本申请实施例提供的一种数据库查询装置进行介绍,下文描述的一种数据库查询装置与上文描述的一种数据库查询方法可以相互参照。The following describes a database query apparatus provided by an embodiment of the present application. A database query apparatus described below and a database query method described above can be referred to each other.

参见图6所示,本申请实施例公开了一种数据库查询装置,包括:Referring to FIG. 6 , an embodiment of the present application discloses a database query device, including:

获取模块601,用于获取查询指令,并确定查询指令对应的查询条件;an obtaining module 601, configured to obtain a query instruction, and determine a query condition corresponding to the query instruction;

查询模块602,用于按照查询条件和预设查询限值查询数据库;a query module 602, configured to query a database according to query conditions and preset query limits;

显示模块603,用于若数据库返回预设查询限值个数据条目,则显示数据库返回的预设查询限值个数据条目,并在显示的同时,异步统计查询条件在数据库中可查到的数据条目总数。The display module 603 is configured to display the preset query limit data items returned by the database if the database returns the preset query limit data items, and at the same time of displaying, asynchronously count the data that can be found in the database by the query conditions Total number of entries.

在一种具体实施方式中,还包括:In a specific embodiment, it also includes:

查缓存模块,用于在缓存中查询按照当前查询条件在数据库中可查到的数据条目总数;若在缓存中查到数据条目总数,则从缓存中获取数据条目总数;否则,执行异步统计查询条件在数据库中可查到的数据条目总数的步骤。Query cache module, which is used to query the total number of data items that can be found in the database according to the current query conditions in the cache; if the total number of data items is found in the cache, the total number of data items is obtained from the cache; otherwise, an asynchronous statistical query is performed. Steps that condition the total number of data entries that can be found in the database.

在一种具体实施方式中,还包括:In a specific embodiment, it also includes:

缓存模块,用于将查询条件、预设查询限值个数据条目以及数据条目总数存储至缓存。The cache module is used to store the query condition, the preset query limit number of data items and the total number of data items in the cache.

在一种具体实施方式中,还包括:In a specific embodiment, it also includes:

翻页模块,用于若预设查询限值个数据条目分页显示,则获取用户输入的翻页指令;从缓存中获取并显示翻页指令对应的数据条目;从缓存中获取并显示数据条目总数。The page-turning module is used to obtain the page-turning command input by the user if the preset query limit number of data items are displayed in paging; obtain and display the data items corresponding to the page-turning command from the cache; obtain and display the total number of data items from the cache .

在一种具体实施方式中,显示模块具体用于:In a specific embodiment, the display module is specifically used for:

从预设线程池调用空闲线程统计按照当前查询条件在数据库中可查到的数据条目总数。Call idle threads from the preset thread pool to count the total number of data entries that can be found in the database according to the current query conditions.

在一种具体实施方式中,显示模块还用于:In a specific embodiment, the display module is also used for:

若数据库返回的数据条目个数小于预设查询限值,则显示数据条目个数和数据库返回的所有数据条目。If the number of data items returned by the database is less than the preset query limit, the number of data items and all data items returned by the database will be displayed.

在一种具体实施方式中,还包括:In a specific embodiment, it also includes:

映射模块,用于为查询条件分配标识信息,并记录标识信息和查询条件的映射关系;若获取到包含查询条件的查询指令或翻页指令,则按照映射关系显示按照查询条件在数据库中可查到的数据条目总数。The mapping module is used to assign identification information to the query conditions, and record the mapping relationship between the identification information and the query conditions; if a query command or page-turning command containing the query conditions is obtained, it will be displayed according to the mapping relationship and can be searched in the database according to the query conditions. The total number of data entries received.

其中,关于本实施例中各个模块、单元更加具体的工作过程可以参考前述实施例中公开的相应内容,在此不再进行赘述。For the more specific working process of each module and unit in this embodiment, reference may be made to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.

可见,本实施例提供了一种数据库查询装置,能够降低数据库查询过程中的页面加载时长。It can be seen that this embodiment provides a database query device, which can reduce the page loading time during the database query process.

下面对本申请实施例提供的一种电子设备进行介绍,下文描述的一种电子设备与上文描述的一种数据库查询方法及装置可以相互参照。The following describes an electronic device provided by an embodiment of the present application. An electronic device described below and a database query method and apparatus described above can be referred to each other.

参见图7所示,本申请实施例公开了一种电子设备,包括:Referring to FIG. 7 , an embodiment of the present application discloses an electronic device, including:

存储器701,用于保存计算机程序;a memory 701 for storing computer programs;

处理器702,用于执行所述计算机程序,以实现上述任意实施例公开的方法。The processor 702 is configured to execute the computer program to implement the method disclosed in any of the foregoing embodiments.

进一步的,本申请实施例还提供了一种电子设备。其中,上述电子设备既可以是如图8所示的服务器50,也可以是如图9所示的终端60。图8和图9均是根据一示例性实施例示出的电子设备结构图,图中的内容不能被认为是对本申请的使用范围的任何限制。Further, the embodiments of the present application also provide an electronic device. The above electronic device may be either the server 50 as shown in FIG. 8 or the terminal 60 as shown in FIG. 9 . FIG. 8 and FIG. 9 are both structural diagrams of an electronic device according to an exemplary embodiment, and the contents in the figures should not be considered as any limitation on the scope of use of the present application.

图8为本申请实施例提供的一种服务器的结构示意图。该服务器50,具体可以包括:至少一个处理器51、至少一个存储器52、电源53、通信接口54、输入输出接口55和通信总线56。其中,所述存储器52用于存储计算机程序,所述计算机程序由所述处理器51加载并执行,以实现前述任一实施例公开的发布应用程序的监控中的相关步骤。FIG. 8 is a schematic structural diagram of a server according to an embodiment of the present application. The server 50 may specifically include: at least one processor 51 , at least one memory 52 , a power supply 53 , a communication interface 54 , an input and output interface 55 and a communication bus 56 . Wherein, the memory 52 is used for storing a computer program, and the computer program is loaded and executed by the processor 51, so as to realize the relevant steps in the monitoring of publishing the application program disclosed in any of the foregoing embodiments.

本实施例中,电源53用于为服务器50上的各硬件设备提供工作电压;通信接口54能够为服务器50创建与外界设备之间的数据传输通道,其所遵循的通信协议是能够适用于本申请技术方案的任意通信协议,在此不对其进行具体限定;输入输出接口55,用于获取外界输入数据或向外界输出数据,其具体的接口类型可以根据具体应用需要进行选取,在此不进行具体限定。In this embodiment, the power supply 53 is used to provide working voltage for each hardware device on the server 50; the communication interface 54 can create a data transmission channel between the server 50 and external devices, and the communication protocol it follows is applicable to this Any communication protocol applying for the technical solution is not specifically limited here; the input and output interface 55 is used to obtain external input data or output data to the outside world, and its specific interface type can be selected according to specific application needs, which is not carried out here. Specific restrictions.

另外,存储器52作为资源存储的载体,可以是只读存储器、随机存储器、磁盘或者光盘等,其上所存储的资源包括操作系统521、计算机程序522及数据523等,存储方式可以是短暂存储或者永久存储。In addition, the memory 52, as a carrier for resource storage, can be a read-only memory, a random access memory, a magnetic disk or an optical disk, etc. The resources stored on the memory 52 include the operating system 521, the computer program 522, and the data 523, etc., and the storage method can be short-term storage or Permanent storage.

其中,操作系统521用于管理与控制服务器50上的各硬件设备以及计算机程序522,以实现处理器51对存储器52中数据523的运算与处理,其可以是Windows Server、Netware、Unix、Linux等。计算机程序522除了包括能够用于完成前述任一实施例公开的发布应用程序的监控方法的计算机程序之外,还可以进一步包括能够用于完成其他特定工作的计算机程序。数据523除了可以包括应用程序的更新信息等数据外,还可以包括应用程序的开发商信息等数据。The operating system 521 is used to manage and control each hardware device and computer program 522 on the server 50, so as to realize the operation and processing of the data 523 in the memory 52 by the processor 51, which can be Windows Server, Netware, Unix, Linux, etc. . In addition to the computer program 522 that can be used to complete the monitoring method for publishing an application program disclosed in any of the foregoing embodiments, the computer program 522 may further include a computer program that can be used to complete other specific tasks. The data 523 may include, in addition to data such as update information of the application, data such as developer information of the application.

图9为本申请实施例提供的一种终端的结构示意图,该终端60具体可以包括但不限于智能手机、平板电脑、笔记本电脑或台式电脑等。FIG. 9 is a schematic structural diagram of a terminal according to an embodiment of the present application. The terminal 60 may specifically include, but is not limited to, a smart phone, a tablet computer, a notebook computer, or a desktop computer.

通常,本实施例中的终端60包括有:处理器61和存储器62。Generally, the terminal 60 in this embodiment includes: a processor 61 and a memory 62 .

其中,处理器61可以包括一个或多个处理核心,比如4核心处理器、8核心处理器等。处理器61可以采用DSP(Digital Signal Processing,数字信号处理)、FPGA(Field-Programmable Gate Array,现场可编程门阵列)、PLA(Programmable Logic Array,可编程逻辑阵列)中的至少一种硬件形式来实现。处理器61也可以包括主处理器和协处理器,主处理器是用于对在唤醒状态下的数据进行处理的处理器,也称CPU(Central ProcessingUnit,中央处理器);协处理器是用于对在待机状态下的数据进行处理的低功耗处理器。在一些实施例中,处理器61可以在集成有GPU(Graphics Processing Unit,图像处理器),GPU用于负责显示屏所需要显示的内容的渲染和绘制。一些实施例中,处理器61还可以包括AI(Artificial Intelligence,人工智能)处理器,该AI处理器用于处理有关机器学习的计算操作。The processor 61 may include one or more processing cores, such as a 4-core processor, an 8-core processor, and the like. The processor 61 may adopt at least one hardware form among DSP (Digital Signal Processing, digital signal processing), FPGA (Field-Programmable Gate Array, field programmable gate array), PLA (Programmable Logic Array, programmable logic array) accomplish. The processor 61 may also include a main processor and a co-processor. The main processor is a processor used to process data in the wake-up state, and is also called a CPU (Central Processing Unit, central processing unit); A low-power processor for processing data in a standby state. In some embodiments, the processor 61 may be integrated with a GPU (Graphics Processing Unit, image processor), and the GPU is used for rendering and drawing the content that needs to be displayed on the display screen. In some embodiments, the processor 61 may further include an AI (Artificial Intelligence, artificial intelligence) processor, where the AI processor is used to process computing operations related to machine learning.

存储器62可以包括一个或多个计算机可读存储介质,该计算机可读存储介质可以是非暂态的。存储器62还可包括高速随机存取存储器,以及非易失性存储器,比如一个或多个磁盘存储设备、闪存存储设备。本实施例中,存储器62至少用于存储以下计算机程序621,其中,该计算机程序被处理器61加载并执行之后,能够实现前述任一实施例公开的由终端侧执行的发布应用程序的监控方法中的相关步骤。另外,存储器62所存储的资源还可以包括操作系统622和数据623等,存储方式可以是短暂存储或者永久存储。其中,操作系统622可以包括Windows、Unix、Linux等。数据623可以包括但不限于应用程序的更新信息。Memory 62 may include one or more computer-readable storage media, which may be non-transitory. Memory 62 may also include high-speed random access memory, as well as non-volatile memory, such as one or more magnetic disk storage devices, flash storage devices. In this embodiment, the memory 62 is at least used to store the following computer program 621, wherein, after the computer program is loaded and executed by the processor 61, it can implement the monitoring method for publishing an application program executed by the terminal side disclosed in any of the foregoing embodiments related steps in . In addition, the resources stored in the memory 62 may also include an operating system 622, data 623, etc., and the storage mode may be short-term storage or permanent storage. The operating system 622 may include Windows, Unix, Linux, and the like. Data 623 may include, but is not limited to, update information for applications.

在一些实施例中,终端60还可包括有显示屏63、输入输出接口64、通信接口65、传感器66、电源67以及通信总线68。In some embodiments, the terminal 60 may further include a display screen 63 , an input/output interface 64 , a communication interface 65 , a sensor 66 , a power supply 67 and a communication bus 68 .

本领域技术人员可以理解,图9中示出的结构并不构成对终端60的限定,可以包括比图示更多或更少的组件。Those skilled in the art can understand that the structure shown in FIG. 9 does not constitute a limitation on the terminal 60, and may include more or less components than those shown in the drawings.

下面对本申请实施例提供的一种可读存储介质进行介绍,下文描述的一种可读存储介质与上文描述的一种数据库查询方法、装置及设备可以相互参照。A readable storage medium provided by an embodiment of the present application is introduced below. A readable storage medium described below and a database query method, apparatus, and device described above can be referred to each other.

一种可读存储介质,用于保存计算机程序,其中,所述计算机程序被处理器执行时实现前述实施例公开的数据库查询方法。关于该方法的具体步骤可以参考前述实施例中公开的相应内容,在此不再进行赘述。A readable storage medium for storing a computer program, wherein when the computer program is executed by a processor, the database query method disclosed in the foregoing embodiments is implemented. For the specific steps of the method, reference may be made to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.

下面对本申请实施例提供的一种计算机程序产品进行介绍,下文描述的一种计算机程序产品与上文描述的一种数据库查询方法、装置及设备可以相互参照。The following describes a computer program product provided by the embodiments of the present application. The computer program product described below and the database query method, apparatus, and device described above can be referred to each other.

一种计算机程序产品,包括计算机指令,当其在计算机上运行时,使得计算机可以执行前述公开的数据库查询方法。关于该方法的具体步骤可以参考前述实施例中公开的相应内容,在此不再进行赘述。A computer program product comprising computer instructions which, when run on a computer, enable the computer to perform the aforementioned disclosed database query method. For the specific steps of the method, reference may be made to the corresponding content disclosed in the foregoing embodiments, which will not be repeated here.

本申请涉及的“第一”、“第二”、“第三”、“第四”等(如果存在)是用于区别类似的对象,而不必用于描述特定的顺序或先后次序。应该理解这样使用的数据在适当情况下可以互换,以便这里描述的实施例能够以除了在这里图示或描述的内容以外的顺序实施。此外,术语“包括”和“具有”以及他们的任何变形,意图在于覆盖不排他的包含,例如,包含了一系列步骤或单元的过程、方法或设备不必限于清楚地列出的那些步骤或单元,而是可包括没有清楚地列出的或对于这些过程、方法或设备固有的其它步骤或单元。References in this application to "first", "second", "third", "fourth", etc. (if any) are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It is to be understood that data so used may be interchanged under appropriate circumstances so that the embodiments described herein can be practiced in sequences other than those illustrated or described herein. Furthermore, the terms "comprising" and "having", and any variations thereof, are intended to cover non-exclusive inclusion, for example, a process, method or apparatus comprising a series of steps or elements is not necessarily limited to those steps or elements expressly listed , but may include other steps or elements not expressly listed or inherent to these processes, methods or apparatus.

需要说明的是,在本申请中涉及“第一”、“第二”等的描述仅用于描述目的,而不能理解为指示或暗示其相对重要性或者隐含指明所指示的技术特征的数量。由此,限定有“第一”、“第二”的特征可以明示或者隐含地包括至少一个该特征。另外,各个实施例之间的技术方案可以相互结合,但是必须是以本领域普通技术人员能够实现为基础,当技术方案的结合出现相互矛盾或无法实现时应当认为这种技术方案的结合不存在,也不在本申请要求的保护范围之内。It should be noted that the descriptions involving "first", "second", etc. in this application are only for the purpose of description, and should not be construed as indicating or implying their relative importance or implying the number of indicated technical features . Thus, a feature delimited with "first", "second" may expressly or implicitly include at least one of that feature. In addition, the technical solutions between the various embodiments can be combined with each other, but must be based on the realization by those of ordinary skill in the art. When the combination of technical solutions is contradictory or cannot be realized, it should be considered that the combination of such technical solutions does not exist. , is not within the scope of protection claimed in this application.

本说明书中各个实施例采用递进的方式描述,每个实施例重点说明的都是与其它实施例的不同之处,各个实施例之间相同或相似部分互相参见即可。The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments, and the same or similar parts between the various embodiments may be referred to each other.

结合本文中所公开的实施例描述的方法或算法的步骤可以直接用硬件、处理器执行的软件模块,或者二者的结合来实施。软件模块可以置于随机存储器(RAM)、内存、只读存储器(ROM)、电可编程ROM、电可擦除可编程ROM、寄存器、硬盘、可移动磁盘、CD-ROM、或技术领域内所公知的任意其它形式的可读存储介质中。The steps of a method or algorithm described in conjunction with the embodiments disclosed herein may be directly implemented in hardware, a software module executed by a processor, or a combination of the two. A software module can be placed in random access memory (RAM), internal memory, read only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other in the technical field. in any other form of readable storage medium that is well known.

本文中应用了具体个例对本申请的原理及实施方式进行了阐述,以上实施例的说明只是用于帮助理解本申请的方法及其核心思想;同时,对于本领域的一般技术人员,依据本申请的思想,在具体实施方式及应用范围上均会有改变之处,综上所述,本说明书内容不应理解为对本申请的限制。The principles and implementations of the present application are described herein by using specific examples. The descriptions of the above embodiments are only used to help understand the methods and core ideas of the present application. There will be changes in the specific implementation and application scope. To sum up, the content of this specification should not be construed as a limitation to the application.

Claims (10)

1.一种数据库查询方法,其特征在于,包括:1. a database query method, is characterized in that, comprises: 获取查询指令,并确定所述查询指令对应的查询条件;Obtain a query instruction, and determine the query condition corresponding to the query instruction; 按照所述查询条件和预设查询限值查询数据库;Query the database according to the query conditions and preset query limits; 若所述数据库返回所述预设查询限值个数据条目,则显示所述数据库返回的所述预设查询限值个数据条目,并在显示的同时,异步统计所述查询条件在所述数据库中可查到的数据条目总数。If the database returns the preset query limit data items, display the preset query limit data items returned by the database, and asynchronously count the query conditions in the database while displaying. The total number of data entries that can be found in the . 2.根据权利要求1所述的方法,其特征在于,所述异步统计所述查询条件在所述数据库中可查到的数据条目总数之前,还包括:2. The method according to claim 1, wherein the asynchronously counting the total number of data entries that can be found in the database for the query condition further comprises: 在缓存中查询所述数据条目总数;query the cache for the total number of data entries; 若在缓存中查到所述数据条目总数,则从缓存中获取所述数据条目总数;否则,执行所述异步统计所述查询条件在所述数据库中可查到的数据条目总数的步骤。If the total number of data items is found in the cache, the total number of data items is obtained from the cache; otherwise, the step of asynchronously counting the total number of data items that can be found in the database by the query condition is performed. 3.根据权利要求1所述的方法,其特征在于,还包括:3. The method of claim 1, further comprising: 将所述查询条件、所述预设查询限值个数据条目以及所述数据条目总数存储至缓存。The query condition, the preset query limit number of data items, and the total number of data items are stored in the cache. 4.根据权利要求3所述的方法,其特征在于,若所述预设查询限值个数据条目分页显示,则所述将所述查询条件、所述预设查询限值个数据条目以及所述数据条目总数存储至缓存之后,还包括:4 . The method according to claim 3 , wherein, if the preset query limit data items are displayed on a page, the query condition, the preset query limit data items and all the data items are displayed in a page. 5 . After the total number of data entries is stored in the cache, it also includes: 获取用户输入的翻页指令;Get the page turning instruction entered by the user; 从所述缓存中获取并显示所述翻页指令对应的数据条目;Acquire and display the data entry corresponding to the page turning instruction from the cache; 从所述缓存中获取并显示所述数据条目总数。Fetch and display the total number of data entries from the cache. 5.根据权利要求1所述的方法,其特征在于,所述异步统计所述查询条件在所述数据库中可查到的数据条目总数,包括:5. The method according to claim 1, wherein the asynchronous statistics of the total number of data entries that can be found in the database for the query conditions, comprising: 从预设线程池调用空闲线程统计所述数据条目总数。The idle thread is called from the preset thread pool to count the total number of the data items. 6.根据权利要求5所述的方法,其特征在于,还包括:6. The method of claim 5, further comprising: 若所述数据库返回的数据条目个数小于所述预设查询限值,则显示所述数据条目个数和所述数据库返回的所有数据条目。If the number of data items returned by the database is less than the preset query limit, the number of data items and all data items returned by the database are displayed. 7.根据权利要求1至5任意一项所述的方法,其特征在于,还包括:7. The method according to any one of claims 1 to 5, characterized in that, further comprising: 为所述查询条件分配标识信息,并记录所述标识信息和所述查询条件的映射关系;Allocate identification information for the query condition, and record the mapping relationship between the identification information and the query condition; 若获取到包含所述查询条件的查询指令或翻页指令,则按照所述映射关系显示所述数据条目总数。If the query instruction or page turning instruction including the query condition is acquired, the total number of data items is displayed according to the mapping relationship. 8.一种数据库查询装置,其特征在于,包括:8. A database query device, comprising: 获取模块,用于获取查询指令,并确定所述查询指令对应的查询条件;an acquisition module, configured to acquire a query instruction and determine the query condition corresponding to the query instruction; 查询模块,用于按照所述查询条件和预设查询限值查询数据库;a query module, used for querying the database according to the query conditions and preset query limit values; 显示模块,用于若所述数据库返回所述预设查询限值个数据条目,则显示所述数据库返回的所述预设查询限值个数据条目,并在显示的同时,异步统计所述查询条件在所述数据库中可查到的数据条目总数。A display module, configured to display the preset query limit data items returned by the database if the database returns the preset query limit data items, and asynchronously count the queries while displaying The total number of data entries available in the database for the condition. 9.一种电子设备,其特征在于,包括:9. An electronic device, characterized in that, comprising: 存储器,用于存储计算机程序;memory for storing computer programs; 处理器,用于执行所述计算机程序,以实现如权利要求1至7任一项所述的方法。A processor for executing the computer program to implement the method according to any one of claims 1 to 7. 10.一种可读存储介质,其特征在于,用于保存计算机程序,其中,所述计算机程序被处理器执行时实现如权利要求1至7任一项所述的方法。10. A readable storage medium, characterized by being used for storing a computer program, wherein the computer program implements the method according to any one of claims 1 to 7 when the computer program is executed by a processor.
CN202210675617.8A 2022-06-15 2022-06-15 Database query method, device and equipment and readable storage medium Pending CN115114332A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210675617.8A CN115114332A (en) 2022-06-15 2022-06-15 Database query method, device and equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210675617.8A CN115114332A (en) 2022-06-15 2022-06-15 Database query method, device and equipment and readable storage medium

Publications (1)

Publication Number Publication Date
CN115114332A true CN115114332A (en) 2022-09-27

Family

ID=83327752

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210675617.8A Pending CN115114332A (en) 2022-06-15 2022-06-15 Database query method, device and equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN115114332A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117931896A (en) * 2024-02-29 2024-04-26 双一力(宁波)电池有限公司 Database query method, device and database query system

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102968322A (en) * 2012-11-22 2013-03-13 用友软件股份有限公司 Data loading device and data loading method
CN109325049A (en) * 2018-07-27 2019-02-12 平安科技(深圳)有限公司 Divide the asynchronous loading method of journey, device, terminal device and storage medium
CN111368006A (en) * 2020-03-31 2020-07-03 中国工商银行股份有限公司 Mass data strip conditional centralized extraction system and method
CN112579641A (en) * 2019-09-30 2021-03-30 北京国双科技有限公司 Data query method and device, storage medium and electronic equipment

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102968322A (en) * 2012-11-22 2013-03-13 用友软件股份有限公司 Data loading device and data loading method
CN109325049A (en) * 2018-07-27 2019-02-12 平安科技(深圳)有限公司 Divide the asynchronous loading method of journey, device, terminal device and storage medium
CN112579641A (en) * 2019-09-30 2021-03-30 北京国双科技有限公司 Data query method and device, storage medium and electronic equipment
CN111368006A (en) * 2020-03-31 2020-07-03 中国工商银行股份有限公司 Mass data strip conditional centralized extraction system and method

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
CHINA、李白: "分页查询探究", 《CSDN HTTPS://BLOG.CSDN.NET/QQ_43484972/ARTICLE/DETAILS/121056214》, 30 October 2021 (2021-10-30) *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117931896A (en) * 2024-02-29 2024-04-26 双一力(宁波)电池有限公司 Database query method, device and database query system

Similar Documents

Publication Publication Date Title
US7669033B2 (en) Pretranslating input/output buffers in environments with multiple page sizes
US20110093478A1 (en) Filter hints for result sets
CN113010312B (en) Super-parameter tuning method, device and storage medium
WO2017219524A1 (en) Page saving method and electronic device
WO2019041500A1 (en) Pagination realization method and device, computer equipment and storage medium
US20200409757A1 (en) Managing workloads of a deep neural network processor
CN106095417A (en) A kind of prospect Application Program Interface refresh synchronization method and system
CN107451227A (en) Paging query method and device
CN106227769B (en) Date storage method and device
CN112506992B (en) Fuzzy query method and device for Kafka data, electronic equipment and storage medium
CN117609245A (en) Paging query method, device, equipment and medium
CN115114332A (en) Database query method, device and equipment and readable storage medium
CN110222046B (en) List data processing method, device, server and storage medium
CN118689741B (en) Information management method, device, medium and program product
CN109063210B (en) Resource object query method, device, equipment and storage medium of storage system
US20080077868A1 (en) System and Method for Visually Representing Resource Usage in a Multi-Node Data Processing System
CN112882843A (en) Method for automatically complementing Chinese value by English enumeration
CN108763421B (en) Data searching method and system based on logic circuit
CN110688223A (en) Data processing methods and related products
CN112269538B (en) A data reading method, device, equipment and medium
CN115543317A (en) Front-end page development method and device
CN114329165A (en) Searching method, device and medium
US10909098B2 (en) Setting a flag to indicate that a user interface has stale data within a subject matter category
CN112416213A (en) List checking method, list checking device and storage medium
CN113821172B (en) Storage volume capacity acquisition method and device and related equipment

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