CN107315753B - Paging method and device across multiple databases - Google Patents

Paging method and device across multiple databases Download PDF

Info

Publication number
CN107315753B
CN107315753B CN201610270531.1A CN201610270531A CN107315753B CN 107315753 B CN107315753 B CN 107315753B CN 201610270531 A CN201610270531 A CN 201610270531A CN 107315753 B CN107315753 B CN 107315753B
Authority
CN
China
Prior art keywords
records
paging
database
rows
record
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201610270531.1A
Other languages
Chinese (zh)
Other versions
CN107315753A (en
Inventor
陈俊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology 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 Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201610270531.1A priority Critical patent/CN107315753B/en
Publication of CN107315753A publication Critical patent/CN107315753A/en
Application granted granted Critical
Publication of CN107315753B publication Critical patent/CN107315753B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/25Integrating or interfacing systems involving database management systems
    • G06F16/254Extract, transform and load [ETL] procedures, e.g. ETL data flows in data warehouses

Abstract

The application discloses a paging method and device across multiple databases. One embodiment of the method comprises: receiving a paging request of a client to the contents of M databases, wherein the paging request comprises: the method comprises the following steps of 1, paging number N, paging record number K and query conditions, wherein M, N and K are natural numbers; acquiring the number records of each database, wherein each number record is the row number of the last row of record taken from the database corresponding to the number record in the K rows of records of the pagination with the paging number of N-1; taking K rows of records meeting the query condition from the next row of the number records in the corresponding database according to each number record; merging the K rows of records obtained from each database, and sorting the merged MXK rows of records according to a preset sorting condition; and taking the sorted front K rows of records as a paging result set, and sending response information to the client, wherein the response information comprises the paging result set. The method realizes real-time paging display of the content of multiple data bases.

Description

Paging method and device across multiple databases
Technical Field
The application relates to the technical field of computers, in particular to the technical field of database paging, and particularly relates to a paging method and device across multiple databases.
Background
With the development of internet technology, many large Web applications are generated, through which users can browse various data stored in a Web server by being embedded in a browser. Also, in these large web applications, the production and consumption of data often involve multiple databases. Sometimes, in order to respond to the needs of the user, the data of different databases needs to be merged and displayed to the user, and meanwhile, based on performance and convenience for the user to view, the merged data needs to be paged.
The currently adopted scheme for determining paging of multiple databases is to use a data merger to extract data of multiple databases at regular time, merge the data and store the merged data into a specific merged database, and perform paging query on the merged database when a client sends a paging request. Essentially, this is still paging a single database. Meanwhile, the data merging paging method has poor real-time performance, and additional storage resources are required to be added to store the aggregated data.
Disclosure of Invention
The present application is directed to a method and an apparatus for paging across multiple databases, so as to solve the technical problems mentioned in the background section above.
In a first aspect, the present application provides a method for paging multiple data, where the method includes: receiving a paging request of a client to the contents of M databases, wherein the paging request comprises: the method comprises the following steps of 1, paging number N, paging record number K and query conditions, wherein M, N and K are natural numbers; acquiring the number records of each database, wherein each number record is the row number of the last row record in the database corresponding to the number record in the K row records of the pagination with the paging number of N-1; taking K rows of records meeting the query condition from the next row of the number records in the corresponding database according to each number record; merging the K rows of records obtained from each database, and sorting the merged MxK rows of records according to a preset sorting condition, wherein the first K rows of records are taken as a paging result set; and sending response information to the client, wherein the response information comprises the paging result set.
In a second aspect, the present application provides a paging device across multiple databases, the device comprising: a receiving unit, configured to receive a paging request of a client to contents of M databases, where the paging request includes: the method comprises the following steps of 1, paging number N, paging record number K and query conditions, wherein M, N and K are natural numbers; the first acquisition unit is configured to acquire the number records of each database, wherein each number record is the row number of the last row record which is taken from the database corresponding to the number record in the K row records of the pagination with the page number of N-1; the second acquisition unit is configured to acquire K rows of records meeting the query condition from the next row of the number of records in the corresponding database according to each number of records; the generating unit is configured to merge the K rows of records obtained from the databases, sort the merged MxK rows of records according to a preset sorting condition, and take the first K rows of records as a paging result set; and the sending unit is configured to send response information to the client, wherein the response information comprises a paging result set.
The method and the device for crossing the multiple databases, provided by the application, are characterized in that paging requests of a client to the contents of M databases are received, wherein the paging requests comprise paging numbers, paging record numbers K and query conditions, and the number records of each database are obtained and are row numbers of the last row of records of multiple rows of records of each database taken from the previous page; then, according to each number record, starting to fetch K rows of records meeting the query condition from the next row of the number records in the corresponding database; then merging the K rows of records obtained from each database, and sorting the merged MxK rows of records according to a preset sorting condition, wherein the first K rows of records are taken as a paging result set; and finally, sending response information to the client, wherein the response information comprises a paging result set. The method and the device realize the real-time data aggregation paging display of various databases without additional storage resources.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for paging across multiple databases in accordance with the present application;
FIG. 3 is a flow diagram of an application scenario in accordance with the cross-database paging method shown in FIG. 2;
FIG. 4 is a schematic diagram of a paging device across multiple databases according to the present application;
FIG. 5 is a block diagram of a computer system suitable for use in implementing a server according to embodiments of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
FIG. 1 illustrates an exemplary system architecture 100 to which embodiments of the cross-database paging method or cross-database paging apparatus of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, networks 104, 106, a server 105, and database servers 107, 108, 109. Networks 104, 106 are used to provide a medium for communication links between terminal devices 101, 102, 103, server 105 and database servers 107, 108, 109. Networks 104 and 106 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to send data paging requests to the server 105, and to receive paging result sets and the like returned by the server 105. Various software, such as a browser, a search-type application, etc., may be installed on the terminal devices 101, 102, 103.
Among the database servers 107, 108, 109, there may be servers in which various databases are installed. The types of various databases may be, for example: oracle, MySQL Server, etc. Wherein a plurality of rows of records are stored in each database.
The server 105 may be a server that provides various services, such as receiving paging requests for data in database servers 107, 108, 109 from terminal devices 101, 102, 103 over the network 104. Server 105 interacts with database servers 107, 108, 109 over network 106 to send a paging query statement corresponding to the database type constructed from paging requests from terminal devices to each of database servers 107, 108, 109 and to receive multi-line records returned by the database in response to the paging query statement. The server 105 analyzes and processes the multiple rows of records returned by each database in the database servers 107, 108 and 109, and selects multiple rows of records meeting the predetermined conditions to send to the clients 101, 102 and 103 through the network 104.
The terminal devices 101, 102, and 103 may be various electronic devices having display screens and supporting various software, including but not limited to tablet computers, laptop portable computers, smart phones, and the like.
It should be noted that the paging method across multiple databases provided in the embodiments of the present application is generally performed by the server 105, and accordingly, the paging device across multiple databases is generally disposed in the server 105.
It should be understood that the number of terminal devices, networks and servers and database servers in fig. 1 are merely illustrative. There may be any number of terminal devices, networks, servers, and database servers, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a cross-multi-database paging method in accordance with the present application is shown. The paging method across multiple databases comprises the following steps:
step 201, a paging request of a client to the contents of M databases is received.
In this embodiment, an electronic device (e.g., the server 105 shown in fig. 1) on which the paging method across multiple databases operates may receive a paging request from a user terminal (e.g., the terminal devices 101, 102, 103 shown in fig. 1) to page M database contents installed in a database server (e.g., the database servers 107, 108, 109 shown in fig. 1) through a wired connection or a wireless connection.
In the embodiment, the client runs various Web applications through various browsers installed on the terminal device to request pages from a Web database to view a plurality of data records satisfying query conditions. The various Web applications may be, for example, browser-based Web video applications, among others. The browser-based Web application sends the user's paging request and query terms over a network (e.g., 104 shown in fig. 1) to an electronic device (e.g., server 105 shown in fig. 1) on which the paging method across multiple databases is running. For example, a user may enter query conditions on a Web video application. The query condition here may be, for example, a video of some type.
In this embodiment, the Web application database supporting the browser-based Web application to run in the background may include M databases, where M is a natural number. The types of the M databases may not be the same, for example, the M types may be one of the databases of Oracle, MySQL, Sybase, DB2, etc. The M databases may be installed in one database server or in a plurality of database servers. The M databases include at least one identical field, i.e., variable. The data structure of the data of the same field column is the same. In some optional implementations of this embodiment, the rows of data pre-stored in the M databases have the same sorting. When storing data in the M databases, the real-time data can be divided horizontally according to a certain rule and then placed in the M databases, or the real-time data can be divided vertically and placed in the M databases. Performing paging query on M databases storing vertically partitioned data is similar to performing paging query on a single database, and details are not repeated here. The paging query of the M databases in the present application refers to the paging query of the M databases storing horizontally divided data.
In this embodiment, the page request includes a query condition, a page number and a page record number. The page number and the page record number are respectively N and K, and the N and the K are natural numbers. N denotes the Nth page; the page record number K indicates that there are K rows of records on each page. And the database searches the records meeting the user conditions from the M databases according to the query conditions of the user.
After receiving the paging request of the client, the electronic device counts all databases involved in satisfying the query request of the user and confirms the types of the involved databases. For subsequent processing of the data in the respective databases.
Step 202, obtaining the number records of each database.
In this embodiment, based on the paging request received in step 201, the electronic device (e.g., the server 105 shown in fig. 1) obtains the number records of each database. Each number record is the row number of the last row record taken from the database corresponding to the number record in the K rows of the paginated record with the paging number of N-1.
In this embodiment, the number records may be stored in advance in a register of the electronic device. The electronic device reads the number of entries from the memory register upon receiving a page request from the client.
In this embodiment, when N is equal to 1, the number of records corresponding to each database is equal to zero.
In some optional implementations of this embodiment, the number records are stored in number record pointers, that is, each database corresponds to one number record pointer. The number record pointer corresponding to each database points to the row number of the last row record of the database in the N-1 th page.
In some optional implementation manners of this embodiment, when the electronic device sends the nth-1 th paging result set to the client, the number records corresponding to each database are also sent to the client at the same time. That is, the row number of the last row record corresponding to each database in the N-1 th paging is sent to the client along with the paging result set, and the client stores the number records corresponding to each database. When the client sends the page dividing request of the Nth page to the electronic equipment, the number records of the (N-1) th pages corresponding to each database are also sent back to the electronic equipment along with the page dividing request.
In some optional implementation manners of this embodiment, when the user performs the page skip query, the electronic device performs analysis in the background, sequentially counts records extracted from each skipped page in each database, and caches the number records of each database corresponding to each page in the cache. For example, if the page number of the previous query by the user is 1, that is, the page 1 is queried, and the page number of the current query is 5, that is, the page 5 is queried, the electronic device performs analysis processing in the background, sequentially counts how many records are taken from each database by the page 2, stores the number record corresponding to the page 2 in the cache, sequentially counts how many line records are taken from each page 3 and 4 in each database, and stores the number record corresponding to each page in the cache.
And step 203, extracting K rows of records which meet the query condition from the next row of the number records in the corresponding database according to each number record.
In this embodiment, the electronic device extracts K rows of records in each data starting from the next row of the corresponding number of records based on the number of records corresponding to each database obtained in step 202, that is, the row number of the last row of records obtained in each database in page N-1.
In some optional implementations of the embodiment, the electronic device constructs a structured query statement corresponding to any one of the databases based on the number of pieces of records, the number of pages of records (K rows of records), and the query condition, and according to the pre-stored structured query statements of the various types of databases. And extracting K rows of records from the database according to the constructed structured query statement corresponding to the database. That is, the electronic device stores database structured query statements corresponding to multiple types in advance. The specific structured query statement of each database is widely applied to data query of the existing database, and is not described herein again.
In this embodiment, the electronic device stores the type corresponding to each database in advance. It will be appreciated that the type of each database may be obtained when the electronic device establishes a data link with the M databases.
In the present embodiment, each database returns K rows of records to the electronic device according to the query statement sent thereto, so that there are M × K rows of records in the electronic device.
And step 204, merging the K rows of records extracted from each database, and sorting the merged M multiplied by K rows of records according to a preset sorting condition.
In this embodiment, the electronic device merges the K rows of records sent in each database in step 203. Merging here refers to vertically merging M × K rows of records from M databases, respectively. That is, the K rows of records of one database may be interfaced to the K rows of records of another database in a certain order. When the variables in each database are the same and the structures are the same, the variables recorded in the merged mxk rows are the same as the variables in any original database. When the variables in any two databases are not completely the same, the number of the variables recorded in the merged M multiplied by K rows is more than that of the variables in any one database. The specific variables of the merged mxk rows of records may be derived from the original variables of each database.
The merged mxk row records are then sorted. As indicated in step 201, the M databases include at least one identical variable, and the data structure of the identical variable column in each database is identical. Alternatively the same variable may be the merged M × K row sequence. For example, the same variable may be a time variable. The M × K rows of records are sorted according to the sorting sequence according to a predetermined sorting condition, where the predetermined sorting condition may be a sorting condition specified by a user, for example, sorting the merged M × K rows of records according to chronological order with respect to the time variable, and the like.
Step 205, the sorted front K rows of records are taken as a paging result set, and response information is sent to the client, where the response information includes the paging result set.
In this embodiment, the electronic device extracts the K rows of records to generate the paging result set of the nth page according to the order of the M × K rows of records sorted according to the predetermined condition in step 204.
And generating response information according to a preset template and the paging result set of the Nth page and sending the response information to the client. In some optional implementation manners of this embodiment, the response information may include the total number of pages, the total number of records, the current number of pages, and the number of record lines included in the current page, which satisfy the query condition.
In some optional implementations of this embodiment, after sequentially extracting K rows of records from the sorted M × K rows of records to generate the paging result set for the nth page, the electronic device counts the number of rows of records taken from each database by the nth page and the row number of the last row of records in each database, and updates the content of the number of rows of records to the row number of the last row of records in each database in the nth page. Optionally, the sum of the row number of the last row of each database corresponding to the N-1 th page and the row number of the record in the nth page taken from the database may be taken as the number of records of the nth page corresponding to the database and stored.
The paging method including multiple data provided by this embodiment obtains the number of records of each database by receiving a paging request of a client to contents of M databases, where the number of records is a row number of a last row of records of multiple rows of records of each database taken from a previous page; then, according to each number record, starting to fetch K rows of records meeting the query condition from the next row of the number records in the corresponding database; then merging the K rows of records obtained from each database, and sorting the merged MxK rows of records according to a preset sorting condition, wherein the first K rows of records are taken as a paging result set; and finally, sending the paging result set to the client. The method and the device realize the real-time data merging paging display of various databases under the condition of not needing additional storage resources.
Referring now to FIG. 3, a flow diagram is shown illustrating an application of the cross-database paging method of FIG. 2. In fig. 3, a user initiates a paging request for paging query of data contents of database a and database B through a Web application in a client browser. The database a and the database B may be the same database or different databases, for example, the database a may be MySQL database, and the database B may be ORACLE database. The data structures in the database A and the database B are the same, and at least one same variable is arranged. The data contents in the database a and the database B are sorted in the same manner, for example, the data contents are sorted according to time sequence. As shown in fig. 3, the electronic device receives a paging request from a user, where the paging request includes a page number, a page record number, and a query condition. After a paging request of a user is received, the address pointed by the number recording pointer corresponding to each database is obtained in the number recording pointer register, namely the row number of the last row record extracted by the N-1 th page from the database A and the database B. And then constructing a K-row record query statement according to the number records of the database A and the database B, respectively extracting the K-row records from the next row of the number records in the database A and the database B, merging and sequencing the 2K-row records extracted from the database A and the database B, extracting the first K-row record from the sequenced 2K-row records as a paging result set, finally sending the paging result set of the Nth page to the client, and simultaneously updating the contents of the number record pointer registers respectively corresponding to the database A and the database B according to the last row records of the database A and the database B in the K-row records of the Nth page.
Referring to fig. 4, as an implementation of the above-mentioned paging method across multiple databases shown in fig. 2, the present application provides an embodiment of a paging device across multiple databases, which corresponds to the embodiment of the method shown in fig. 2. As shown in fig. 4, the paging device 400 across multiple databases of the present embodiment includes: a receiving unit 401, a first acquiring unit 402, a second acquiring unit 403, a merging and sorting unit 404, and a generating unit 405. The receiving unit 401 is configured to receive a paging request of a client to contents of M databases, where the paging request includes: the system comprises a page number N, a page record number K and query conditions, wherein M, N and K are natural numbers. The first obtaining unit 402 is configured to obtain the number records of each database, where each number record is the row number of the last row record in the database corresponding to the number record in the K rows of the N-1 th page. The merging and sorting unit 404 is configured to merge the K rows of records obtained in each database, and sort the merged mxk rows of records according to a predetermined sorting condition, taking the previous K rows of records as a paging result set. The generating unit 405 is configured to send response information to the client, the response information including the paging result set.
In the present embodiment, the receiving unit 401 of the paging device 400 across multiple databases may receive a paging request for contents of multiple databases input by a user from a terminal with which the user performs software or application operations through a wired connection manner or a wireless connection manner. The paging request input by the user includes a page number, a page record number, and a query condition. In this embodiment, the number of the databases may be set to M, the page number may be set to N, and the page record number may be set to K, where M, N, and K are natural numbers respectively.
In some optional implementations of this embodiment, the types of the M databases may be different, for example, the types of the M databases may be one of Oracle, MySQL, Sybase, DB2, and the like. The M databases may be installed in one database server or in a plurality of database servers. M databases of different types include at least one identical variable. The data structure of the data of the same variable column is the same. And sequencing the rows of data prestored in the M databases according to the same sequencing condition.
In this embodiment, based on the page information received by the receiving unit 401 for M databases, the first obtaining unit 402 may read the number record corresponding to each database from a register in which the number records of each database are stored in advance in the first obtaining unit 402, where each number record of the database is the row number of the last row record fetched in the database by the N-1 th page.
In some optional implementations of this embodiment, the number of records is pre-stored in the number of record pointers, that is, each database corresponds to one number of record pointers. The number record pointer corresponding to each database points to the row number of the last row record of the database in the N-1 th page. The number recording pointers of the respective databases are stored in the number recording pointer register, and the first obtaining unit 402 obtains the number recording pointer corresponding to each database in the number recording pointer register, and obtains the row number of the last row record in the N-1 th page of the database corresponding to the number recording pointer pointed by each number recording pointer.
In some optional implementations of the embodiment, the first obtaining unit 402 may obtain the number records corresponding to each database from the paging request sent by the client. And when the paging device across multiple databases sends the N-1 th paging result set to the client, the number records corresponding to each database are also sent to the client. That is, the row number of the last row record corresponding to each database in the N-1 th paging is sent to the client along with the paging result set, and the client stores the number records corresponding to each database. When the client sends the paging request of the Nth page to the paging devices of the cross-multi-database, the number records of the N-1 th pages corresponding to each database are also sent back to the paging devices of the cross-multi-database along with the paging request.
In some optional implementations of this embodiment, when the user performs a page skip query, the paging devices across multiple databases perform analysis in the background, sequentially count the records extracted from each skipped page in each database, and store the number records of each database corresponding to each skipped page in the cache in the first obtaining unit 402.
In some optional implementation manners of this embodiment, the second obtaining unit 403 may store a structured query statement corresponding to each database type in advance, construct a query statement corresponding to each database according to a paging request of a user and the number of records, and extract K rows of records from any one database according to the query statement.
In some optional implementations of this embodiment, the above paging device across multiple databases further includes an updating unit, and the updating unit updates the number records of each database according to the row number of the last row record in each database in the paging result set of the nth page.
In some optional implementation manners of this embodiment, the response information sent by the generating unit 405 to the client further includes a total number of lines, a total number of pages, a current number of pages, and a number of records included in the current page, which satisfy the user query condition in the M databases.
Referring now to FIG. 5, a block diagram of a computer system 500 suitable for use in implementing a server according to embodiments of the present application is shown.
As shown in fig. 5, the computer system 500 includes a Central Processing Unit (CPU)501 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)502 or a program loaded from a storage section 508 into a Random Access Memory (RAM) 503. In the RAM503, various programs and data necessary for the operation of the system 500 are also stored. The CPU 501, ROM 502, and RAM503 are connected to each other via a bus 504. An input/output (I/O) interface 505 is also connected to bus 504.
The following components are connected to the I/O interface 505: an input portion 506 including a keyboard, a mouse, and the like; an output section 507 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), or the like; a storage portion 508 including a hard disk and the like; and a communication section 509 including a network interface card such as a LAN card, a modem, or the like. The communication section 509 performs communication processing via a network such as the internet. The driver 510 is also connected to the I/O interface 505 as necessary. A removable medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 510 as necessary, so that a computer program read out therefrom is mounted into the storage section 508 as necessary.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program tangibly embodied on a machine-readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 509, and/or installed from the removable medium 511.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present application may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor includes a receiving unit, a first obtaining unit, a second obtaining unit, a merging and sorting unit, and a generating unit. Where the names of these units do not in some cases constitute a limitation on the unit itself, for example, a receiving unit may also be described as a "unit that receives a user paging request".
As another aspect, the present application also provides a non-volatile computer storage medium, which may be the non-volatile computer storage medium included in the apparatus in the above-described embodiments; or it may be a non-volatile computer storage medium that exists separately and is not incorporated into the terminal. The non-volatile computer storage medium stores one or more programs that, when executed by a device, cause the device to: receiving a paging request of a client to the contents of M databases, wherein the paging request comprises: the method comprises the following steps of 1, paging number N, paging record number K and query conditions, wherein M, N and K are natural numbers; acquiring the number records of each database, wherein each number record is the row number of the last row record in the database corresponding to the number record in the K row records of the pagination with the paging number of N-1; taking K rows of records meeting the query condition from the next row of the number records in the corresponding database according to each number record; merging the K rows of records obtained from each database, and sorting the merged MXK rows of records according to a preset sorting condition; and taking the sorted front K rows of records as a paging result set, and sending response information to the client, wherein the response information comprises the paging result set.
The above description is only a preferred embodiment of the application and is illustrative of the principles of the technology employed. It will be appreciated by a person skilled in the art that the scope of the invention as referred to in the present application is not limited to the embodiments with a specific combination of the above-mentioned features, but also covers other embodiments with any combination of the above-mentioned features or their equivalents without departing from the inventive concept. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (10)

1. A method for paging across multiple databases, the method comprising:
receiving a paging request of a client to M database contents, wherein the paging request comprises: the system comprises a paging number N, a paging record number K and query conditions, wherein M, N and K are natural numbers, and the types of M databases are different;
acquiring the number records of each database, wherein each number record is the row number of the last row record in the database corresponding to the number record in the K row records of the paging with the paging number of N-1;
according to each number record, taking K rows of records meeting the query condition from the next row of the number records in a corresponding database, wherein the K rows of records comprise: according to the type and the number records of each database, constructing a structured paging query statement corresponding to the type of the database and sending the structured paging query statement to the corresponding database so as to obtain K rows of records from the database;
merging the K rows of records obtained from each database, and sorting the merged M multiplied by K rows of records according to a preset sorting condition;
and taking the sorted front K rows of records as a paging result set, and sending response information to the client, wherein the response information comprises the paging result set.
2. The method of claim 1, wherein said retrieving a number record for each of said databases comprises retrieving a number record for each of said databases from a number record pointer register.
3. The method of claim 1, wherein the rows of data of the M databases comprise at least the same sort criteria.
4. The method of claim 1, further comprising updating the number of records in each database according to the row number of the last record in each database in the paging result set.
5. A paging apparatus across multiple databases, the apparatus comprising:
a receiving unit, configured to receive a paging request of a client for contents of M databases, where the paging request includes: the system comprises a paging number N, a paging record number K and query conditions, wherein M, N and K are natural numbers, and the types of M databases are different;
the first obtaining unit is configured to obtain the number records of each database, wherein each number record is the row number of the last row record which is taken from the database corresponding to the number record in the K row records of the pagination with the paging number of N-1;
the second acquisition unit is configured to acquire K rows of records meeting the query condition from the next row of the number of records in a corresponding database according to each number of records;
a merging and sorting unit configured to merge the K rows of records obtained in each of the databases and sort the merged mxk rows of records according to a predetermined sorting condition;
the generating unit is configured to take the sorted front K rows of records as a paging result set, and send response information to the client, wherein the response information comprises the paging result set;
the second obtaining unit is further configured to construct a structured paging query statement corresponding to the type of each database according to the type and the number of records of each database, and send the structured paging query statement to the corresponding database to obtain K rows of records from the database.
6. The apparatus according to claim 5, wherein the second obtaining unit is further configured to obtain the number of records corresponding to each of the databases from a number of records pointer register.
7. The apparatus of claim 5, wherein the rows of data of the M databases comprise at least the same sorting condition.
8. The apparatus according to claim 5, further comprising an updating unit configured to update the number of records of each database according to the row number of the last record in each database in the paging result set.
9. A server, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-4.
10. A computer-readable storage medium, on which a computer program is stored, wherein the program, when executed by a processor, implements the method of any one of claims 1-4.
CN201610270531.1A 2016-04-27 2016-04-27 Paging method and device across multiple databases Active CN107315753B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610270531.1A CN107315753B (en) 2016-04-27 2016-04-27 Paging method and device across multiple databases

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610270531.1A CN107315753B (en) 2016-04-27 2016-04-27 Paging method and device across multiple databases

Publications (2)

Publication Number Publication Date
CN107315753A CN107315753A (en) 2017-11-03
CN107315753B true CN107315753B (en) 2020-11-03

Family

ID=60185628

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610270531.1A Active CN107315753B (en) 2016-04-27 2016-04-27 Paging method and device across multiple databases

Country Status (1)

Country Link
CN (1) CN107315753B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108848244B (en) * 2018-04-02 2020-08-21 阿里巴巴集团控股有限公司 Page display method and device
CN108647347B (en) * 2018-05-14 2023-07-11 中国平安财产保险股份有限公司 Paging display method, user equipment, storage medium and device
CN110928900B (en) * 2018-09-17 2021-02-19 马上消费金融股份有限公司 Multi-table data query method, device, terminal and computer storage medium
CN110928902A (en) * 2019-11-27 2020-03-27 杭州安恒信息技术股份有限公司 Query method and system for acquiring cloud platform terminal data aiming at paging
CN111460240B (en) * 2020-04-13 2023-08-15 吉林亿联银行股份有限公司 Cross-region multi-activity micro-service architecture page turning data query method and device

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103390007A (en) * 2012-05-11 2013-11-13 阿里巴巴集团控股有限公司 Method and device for data acquisition
CN104298788A (en) * 2014-11-13 2015-01-21 中国建设银行股份有限公司 Paging querying method and system
CN105468644A (en) * 2014-09-10 2016-04-06 阿里巴巴集团控股有限公司 Method and device for performing query in database

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103390007A (en) * 2012-05-11 2013-11-13 阿里巴巴集团控股有限公司 Method and device for data acquisition
CN105468644A (en) * 2014-09-10 2016-04-06 阿里巴巴集团控股有限公司 Method and device for performing query in database
CN104298788A (en) * 2014-11-13 2015-01-21 中国建设银行股份有限公司 Paging querying method and system

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
基于Solr的企业级检索系统的设计与实现;黄锦捷;《中国优秀硕士学位论文全文数据库 信息科技辑》;20131215;I138-1793 *

Also Published As

Publication number Publication date
CN107315753A (en) 2017-11-03

Similar Documents

Publication Publication Date Title
US11252245B2 (en) Information pushing method and device
CN107315753B (en) Paging method and device across multiple databases
US11314823B2 (en) Method and apparatus for expanding query
US11042542B2 (en) Method and apparatus for providing aggregate result of question-and-answer information
US20170139952A1 (en) System and method transforming source data into output data in big data environments
CN108984553B (en) Caching method and device
US20170235726A1 (en) Information identification and extraction
CN109918594B (en) Information display method and device
CN110020273B (en) Method, device and system for generating thermodynamic diagram
US11423096B2 (en) Method and apparatus for outputting information
CN105488205A (en) Page generation method and page generation apparatus
WO2019041500A1 (en) Pagination realization method and device, computer equipment and storage medium
CN111932308A (en) Data recommendation method, device and equipment
CN112948540A (en) Information query method and device, electronic equipment and computer readable medium
CN109409419B (en) Method and apparatus for processing data
CN110955855A (en) Information interception method, device and terminal
CN110895591A (en) Method and device for positioning self-picking point
CN105808636B (en) Hypertext link pushing system based on APP information data
CN112699149B (en) Target data acquisition method and device, storage medium and electronic device
US20040054682A1 (en) Hypertext analysis method, analysis program, and apparatus
CN112184370A (en) Method and device for pushing product
CN112016017A (en) Method and device for determining characteristic data
JP5538459B2 (en) Information processing apparatus and method
CN110598133A (en) Method, apparatus, electronic device, and computer-readable storage medium for determining an order of search items
CN107463570B (en) Document retrieval/analysis method and device

Legal Events

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