|Numéro de publication||US7349925 B2|
|Type de publication||Octroi|
|Numéro de demande||US 10/763,752|
|Date de publication||25 mars 2008|
|Date de dépôt||22 janv. 2004|
|Date de priorité||22 janv. 2004|
|État de paiement des frais||Caduc|
|Autre référence de publication||US7406485, US20050165798, US20070294219|
|Numéro de publication||10763752, 763752, US 7349925 B2, US 7349925B2, US-B2-7349925, US7349925 B2, US7349925B2|
|Inventeurs||Kevin James Cherkauer, Scott David Lashley, Jason Christopher Young|
|Cessionnaire d'origine||International Business Machines Corporation|
|Exporter la citation||BiBTeX, EndNote, RefMan|
|Citations de brevets (10), Citations hors brevets (7), Référencé par (11), Classifications (11), Événements juridiques (7)|
|Liens externes: USPTO, Cession USPTO, Espacenet|
1. Field of the Invention
The present invention relates to data processing apparatus and corresponding methods for the retrieval of data stored in a database or as computer files. More particularly, the invention relates to database or file accessing.
2. Description of the Prior Art
Individuals and organizations are increasingly storing data electronically in databases, a collection of the data arranged for ease of storage, retrieval, updating, searching and sorting by computerized means. As the size, number, and complexity of such databases is growing, sophisticated Data Base Management Systems (DBMS) are continually being developed and improved to facilitate database use and management. In a modern DBMS the data may be stored at multiple, non-contiguous locations within one storage volume, or spanned across multiple volumes. Such a DBMS may also be used for multiple purposes, often by multiple users, effectively concurrently.
As the DBMS has grown in importance and use, it has become increasingly desirable to optimize performance. Many approaches have been tried, most of which are not germane here. Of present interest, however, is optimizing the processing of queries, i.e., the scanning of particular sub-sets of the stored data. For this, the data that is needed by a query, i.e., its extents, is copied into the buffer cache. Unfortunately, many factors can combine to complicate performing efficient data scans across query extents in this overall arrangement.
Even after optimization in other respects, some queries may need to access hundreds of extents, performing full data scans across those. If there are multiple queries being executed, it is quite possible that those queries will access much of the same data. However, as matters exist now, the ability to share that data is largely arbitrary. Depending on the order of the list of extents for data brought into the buffer cache for a given query and when other queries start, the ability to share the cached data for multiple scans is thus based on luck.
Some database engines today separate each extent into a separate thread, such that each thread is responsible for scanning only one extent and returns the results to a join/merge operator which aggregates the results. But in a system with limited resources where starting that many threads would consume the available resources, a thread may be given a whole list of extents to operate on. For our purposes here, we will assume that a single thread is given the list of extents to scan, and rather than speak in terms of “threads” we will herein use the word “scan” to better represent a list of extents to be operated on.
Let us consider a simple hypothetical case using a query Q1 that uses an extent E1, a Q2 that uses an E2, and a Q3 that uses an E3, wherein E3 is a subset of E1. If E2 is large enough that it “pushes” relevant parts of E1 out of the buffer cache, it follows that Q1, Q2, Q3 is not an efficient ordering of query execution. Generalizing, if two or more scans are active and share a large set of the extents required to satisfy their respective queries and have no coordination between them, buffer cache thrashing can take place where pages of one scan replace pages of the other scan within the buffer cache. This causes increased I/O as well as slowing overall query processing.
Alternately, let us consider a case with queries Q1 tthrough Q25, respectively using extents E1 through E25, wherein E1 and E25 are the same. Running Q1 and Q25 separately is not efficient. Attempting to get “multi-streaming” by utilizing very large buffer pools is an option, but not a viable one in most cases. Buffer cache has inherent “costs” that weigh against unduly increasing its amount, e.g., components cost, power usage, physical footprint, etc. It is also usually desirable for a DBMS to free up available memory resources for other operations, like sorts and hash joins.
The attempts to date to improve DBMS performance have largely involved optimizing queries for execution. For example, Pat. App. US 2002/198872-A1 by MacNicol et al. discloses a “Database System Providing Optimization Of A Group By An Operator Over A Union All.” It describes a database system providing methods for optimization and execution of queries aggregating information from multiple database tables. The method here breaks serial operations into a group of child operations that can be individually optimized and processed in parallel. A query including a grouping operator over a union node is split by pushing the grouping operation down into each input arm of the union node. Specifically, grouping operators are inserted into each child arm of qualifying union nodes, enabling separate physical database tables to be summarized in parallel. Each of the child grouping operators concurrently groups data and generates summary results in parallel, taking advantage of capabilities of available parallel processing hardware. The aggregate operators of the original master grouping operator are modified to accept and correctly synthesize sub-aggregated results generated by each of the child grouping operators. The method here also enables individual optimization of operations on each database table, including use of index-only execution plans.
As such, this reference provides background on the problem and teaches one approach that has been tried, but that approach does not include a runtime component to query execution that monitors extent scans across all queries being executed and allows the re-ordering of the extents list for each query so that queries accessing same extents will have a much higher chance of finding the data they need in the buffer cache.
U.S. Pat. Nos. 5,813,005 and 6,510,428 by Tsuchida et al. both titled “Method And System Of Database Divisional Management For Parallel Database System” and U.S. Pat. No. 5,761,696 by Giordano, et al. discloses a “Parallel Database Serving Mechanism For A Single-Level-Store Computer System” teach parallel approaches. The former references teach parallel processing on multiple platforms with just one I/O server, thus teaching a approach for use in some limited hardware configurations. However, this does not include a runtime component to ensure a much higher chance of finding needed data in buffer cache. The latter reference teaches cross-address space mapping of query results, thus addressing matters after extents are loaded into cache.
It is, therefore, an object of the present invention to provide an improved system for managing buffer cache in a DBMS. Other objects and advantages will become apparent from the following disclosure.
Briefly, a first preferred embodiment of the present invention is a system for data base management. At least one memory device is provided to hold a database having a plurality of tables of data, wherein each table can occupy at least one extent. A buffer cache is provided to store a plurality of the extents. A database engine is provided to process multiple queries with respect to particular data by reviewing each query to determine a respective extents list of the extents containing the particular data needed by that query. A database engine retrieves the extents from the memory devices as ordered in the extents lists, storing those extents that are retrieved in the buffer cache, and then executes the queries on the particular data in the respective extents stored in the buffer cache to determine respective results. A query monitor is provided to re-order the extents lists so that the extents that are retrieved and stored in the buffer cache are used more efficiently by the queries.
Briefly, a second preferred embodiment of the present invention is a method for data base management. A database having a tables of data, wherein each table occupies at least one extent is stored. Multiple queries with respect to particular data are received. Each query is reviewed to determine a respective extents list of the extents containing the particular data needed by that query. The extents lists are re-ordered based on an order calculated to be more efficient for execution of the queries. The extents are retrieved as ordered in the extents lists and stored in a buffer cache. The queries are then executed on the particular data in the respective extents stored in the buffer cache to determine respective results.
These and other features and advantages of the present invention will no doubt become apparent to those skilled in the art upon reading the following detailed description which makes reference to the several figures of the drawing.
The following drawings are not made to scale as an actual device, and are provided for illustration of the invention described herein.
The present invention provides methods and apparatus to utilize a query monitor during query execution to improve buffer cache utilization by sharing scans in multi-stream query environments. As illustrated in the various drawings herein, and particularly in the view of
Up to this point the DBMS 100 resembles the previously discussed DBMS 10 (
In one important respect, however, the simple DBMS 10 well represents the state of the art in an important respect. The database engine 14 and database engines today, generally, are suitable for little more than one-query-in begets one-result-out processing, yet still pressed to serve in complex, multi-query environments.
The second way the DBMS 100 particularly differs from the DBMS 10 of
With reference also to
Continuing, two such queries 108 for a DSS thus might be:
If table 24 (
This list is given to the query monitor 112 and a query 108 (say, Q1) is executed. As the query 108 (Q1) is executed, the progress of its scan, scan 1, is monitored to know which extent 36 is currently being scanned. When a new scan, scan 2, comes in (say, for Q2), the query monitor 112 determines if the scans overlap on the same data, and if so, it reorders the list of extents 36 such that scan 2 will start on the extent 36 currently being scanned by scan 1. This allows scan 2 to utilize the buffer cache 106 still being populated by scan 1.
For instance, for scan 1 a list of extents 36 will have been returned from the query monitor 112: Scan (T2.E1, T2.E2, T2.E3, T2.E4, T2.E5, T2.E6, T2.E7). If scan 1 is now in the middle of scanning T2.E4, for scan 2 the query monitor 112 can now return a list of extents 36: Scan (T2.E4, T2.E5, T2.E6, T2.E7, T2.E1, T2.E2, T2.E3).
At a stage 120, the buffer cache 106 has been loaded with T2.E1, T2.E2, T2.E3 and only scan 1 is progressing. At a stage 122, scan 1 has finished with T2.E1, T2.E2, T2.E3; these have been removed from the buffer cache 106 and replaced with T2.E4, T2.E5, T2.E6; scan 1 is progressing on T2.E4; and the query monitor 112 is aware of this. At a stage 124, the query monitor 112 returns the extent list above for scan 2, and scan 1 and scan 2 then progress until they are finished with T2.E4, T2.E5, T2.E6. At a stage 126, T2.E4, T2.E5, T2.E6 have been replaced in the buffer cache 106 with T2.E7, T2.E1, T2.E2, and both scan 1 and scan 2 progress until scan 1 finishes with T2.E7. At a stage 128, only scan 2 continues and progresses until it finishes with T2.E1, T2.E2. Hatching is used here to show that the leftmost block of the buffer cache 106 is available, since both scan 1 and scan 2 are finished with it. At a stage 130, one of T2.E7, T2.E1, T2.E2, say, T2.E7, has been replaced with T2.E3, and scan 2 continues and progresses until it finishes with T2.E3. Presumably a scan 3 can now also be progressing on T2.E1, T2.E2 or on other data that has replaced it (e.g., T1.E1 and T1.E2 in
The invention can be embodied as above by separating the I/O processing from the query processing. That is, by having a separate thread for I/O processing that is responsible for using the extent list to populate the buffer cache and a separate thread for the query processing that is responsible for converting pages into rows and then processing the row.
More sophisticated approaches to buffer cache replacement may also be used but then will be more complicated, although not necessarily in a manner that will affect the DBMS 100. For example, at stage 122, scan 1 can be finished with T2.E1, T2.E2, T2.E3 and be currently working on T2.E4. What is contained in the buffer cache in this approach is the already scanned T2.E2 and T2.E3 and a partial extent containing what has so far been paged in of T2.E4 by scan 1. The scan itself, as it progresses through the extents, can thus page in the new extents as read off of the disk and as needed.
In this rendering, the I/O processing would be done and waiting on the query processing to use the populated buffer cache. The present invention is particularly geared toward the I/O processing, to make sure the pages are populated in the buffer cache for the query. And if another query requiring the same extents is requested, then the I/O processing of scan 2 needs to coordinate with the I/O processing of scan 1.
In a step 154, a list of extents to be read is obtained.
In a step 156, a determination is made whether the present query is utilizing a particular access method indicating that the order of the extents is important (implying that the order of the data within the extents is important). If so, in a step 158 this process 150 is exited and the database engine processes the query and its extents in conventional manner. If this is not the case, however, the order in which the extents is read is deemed to be arbitrary, and this process 150 continues as follows.
In a step 160, a determination is made whether the present query is deemed to be “large” (i.e., having large extents; which any prior action by an optimizer, the size of the list of extents, etc., should be able to determine). If this is not the case, in a step 162 this process 150 is exited and the database engine processes the query and its extents in conventional manner. If the query is “large,” however, the list of extents is given to the query monitor and this process 150 continues. The query monitor thus receives extent lists from all queries meeting the “large” criteria.
In a step 164, the query monitor examines the scans and their extents currently executing. In
In a step 166, the query monitor re-orders the list of extents for the present query, and possibly other queries as well, to cause the different queries at hand to be executed across the same extents at relatively the same time.
In a step 168, this process 150 is done with respect to changes initiated by the present query. Of course, in a complex DBMS many queries are present and this process 150 can be followed for each.
Recapping, consider a query one (Q1) that scans extends E1 through E100 and starts at time T1 and a query two (Q2) scans extends E1 through E100 and starts at time T2. Between T1 and T2, Q1 completes the scans of E1-E10 and let us accept that it is currently working on E11. The query monitor should then order the extends of Q2 to start with extent E11-E100 and then E1-E10.
It should be noted that exact timing is not necessary. Because pages live in the buffer cache for some amount of time, it is not necessary to have scans be in lockstep with each other. They should be able to take advantage of the fact that pages exists in the buffer cache for a short duration before being chosen as a victim for replacement. This can allow status information that flows between the scan and the query monitor to occur in a lazy, non-intrusive manner.
It can now be appreciated that this approach provides two notable advantages. It improves multi-stream query performance through better utilization of the buffer cache, and it permits the use of smaller buffer cache to free up memory for other operations.
The inventive approach does, however, have a key assumption associated with it. The extents to be read need to be ones that can be scanned in any order. This is true of many decision support queries that access large portions of a database. In fact, the TPC Benchmark (TM) H (TPC-H (TM)) performs many queries of this sort. TPC-H is one of a group of decision support benchmarks provided by the Transaction Processing Performance Council (TPC). In particular, TPC-H is currently the industry standard decision support benchmark for ad hoc queries. It well represents decision support environments where users do not know which particular queries will be executed against a database system; hence, the “ad-hoc” label. Without pre-knowledge of queries to optimize the DBMS system, execution times can be very long. TPC-H consists of a suite of business oriented ad-hoc queries and concurrent data modifications. The queries and the data populating the database have been chosen to have broad industry-wide relevance. This benchmark illustrates DSSs that examine large volumes of data, execute queries with a high degree of complexity, and give answers to critical business questions, i.e. sophisticated DBMSs suffering from the problems the present invention particularly addresses.
The inventors first identified the problem during TPC-H multi-stream testing of a major database engine. While this DB engine has superior single stream technology to other DB engines, it was observed to struggle with multi-stream queries. Other solutions were proposed. For example, to allow queries to snoop around searching for active scans and join to a scan that was accessing an extent that was common to both scans. But this approach was found wanting. Scans in the particular DB engine do not utilize the buffer pool. Therefore, in order to share scans between queries, a far greater amount of coordination is required, which raises the complexity of this solution to a cost prohibitive level. Also, nothing was done to order the extents of the scans to guarantee that the scans would be accessing the same extents at the same time. The ability to actually share a scan thus was still arbitrary.
Although this invention has been described with respect to specific embodiments, the details thereof are not to be construed as limitations, for it will be apparent that various embodiments, changes and modifications may be resorted to without departing from the spirit and scope thereof; and it is understood that such equivalent embodiments are intended to be included within the scope of this invention.
|Brevet cité||Date de dépôt||Date de publication||Déposant||Titre|
|US5758146 *||12 mai 1995||26 mai 1998||International Business Machines Corporation||Method and apparatus for optimizing data retrieval using index scanning|
|US5761696||2 avr. 1996||2 juin 1998||International Business Machines Corporation||Parallel database serving mechanism for a single-level-store computer system|
|US5794229 *||11 déc. 1995||11 août 1998||Sybase, Inc.||Database system with methodology for storing a database table by vertically partitioning all columns of the table|
|US5813005||16 nov. 1994||22 sept. 1998||Hitachi, Ltd.||Method and system of database divisional management for parallel database system|
|US5884299||6 févr. 1997||16 mars 1999||Ncr Corporation||Optimization of SQL queries involving aggregate expressions using a plurality of local and global aggregation operations|
|US6470330 *||2 nov. 1999||22 oct. 2002||Sybase, Inc.||Database system with methods for estimation and usage of index page cluster ratio (IPCR) and data page cluster ratio (DPCR)|
|US20010011268||14 mars 2001||2 août 2001||Masashi Tsuchida||Method and system of database divisional management for parallel database system|
|US20020169658||6 mars 2002||14 nov. 2002||Adler Richard M.||System and method for modeling and analyzing strategic business decisions|
|US20020198872||4 févr. 2002||26 déc. 2002||Sybase, Inc.||Database system providing optimization of group by operator over a union all|
|JPH02205970A||Titre non disponible|
|1||13<SUP>th </SUP>International Conference on Data Engineering, Apr. 7-11, 1997, University of Bermingham, Sponsored by IEEE Computer Society, entitled: Teaching an OLTP Database Kernel Advanced Datawarehousing Techniques by Clark D. French.|
|2||Architectural Support for Scalable Speculative Parellelization in Shared-Memory Multiprocessors by M. Cintra et al.; 2000.|
|3||Barkovski et al., "Data Storage and Retrieval Method and Scanner," Bibliographic information and Abstract translation of JP 2205970 A2, Sep. 24, 2003, Thompson Delphion.|
|4||Euro-Par '95, Parallel Processing, Aug. 29-31, 1995, entitled: Analysis of Parallel Scan Processing in shared Disk Database Systems by Erhard Rahm and Thomas Stohr.|
|5||Experiences Building the Open OODB Query Optimizer by Blakeley et al., 1993.|
|6||Inspec: Sarker, S. et al., French, CD., Sundaresan, P.; Xuemin, L. et al, 1997.|
|7||Parle '93, Parallel Architectures and Languages Europe, 5<SUP>th </SUP>International Parle Conference, Munich, Germany, Jun. 14-17, 1993 Proceedings.|
|Brevet citant||Date de dépôt||Date de publication||Déposant||Titre|
|US8315990||8 nov. 2007||20 nov. 2012||Microsoft Corporation||Consistency sensitive streaming operators|
|US8352945 *||11 août 2009||8 janv. 2013||International Business Machines Corporation||System, method, and apparatus for scan-sharing for business intelligence queries in an in-memory database|
|US8413169||21 oct. 2009||2 avr. 2013||Microsoft Corporation||Time-based event processing using punctuation events|
|US9158816||21 oct. 2009||13 oct. 2015||Microsoft Technology Licensing, Llc||Event processing with XML query based on reusable XML query template|
|US9229986||16 nov. 2011||5 janv. 2016||Microsoft Technology Licensing, Llc||Recursive processing in streaming queries|
|US9348868||22 janv. 2015||24 mai 2016||Microsoft Technology Licensing, Llc||Event processing with XML query based on reusable XML query template|
|US20090125635 *||8 nov. 2007||14 mai 2009||Microsoft Corporation||Consistency sensitive streaming operators|
|US20100088325 *||7 oct. 2008||8 avr. 2010||Microsoft Corporation||Streaming Queries|
|US20110040744 *||11 août 2009||17 févr. 2011||International Business Machines Corporation||System, method, and apparatus for scan-sharing for business intelligence queries in an in-memory database|
|US20110093866 *||21 oct. 2009||21 avr. 2011||Microsoft Corporation||Time-based event processing using punctuation events|
|US20120078878 *||28 sept. 2010||29 mars 2012||Microsoft Corporation||Optimized lazy query operators|
|Classification aux États-Unis||1/1, 707/999.2, 707/999.003, 707/999.1|
|Classification internationale||G06F17/30, G06F7/00|
|Classification coopérative||G06F17/3046, G06F17/30457, Y10S707/99933|
|Classification européenne||G06F17/30S4P3T4, G06F17/30S4P3T3|
|22 janv. 2004||AS||Assignment|
Owner name: INTERNATIONAL BUSINESS MACHINES CORPORATION, NEW Y
Free format text: ASSIGNMENT OF ASSIGNORS INTEREST;ASSIGNORS:CHERKAUER, KEVIN JAMES;LASHLEY, SCOTT DAVID;YOUNG, JASONCHRISTOPHER;REEL/FRAME:014928/0973;SIGNING DATES FROM 20040112 TO 20040120
|7 nov. 2011||REMI||Maintenance fee reminder mailed|
|13 janv. 2012||SULP||Surcharge for late payment|
|13 janv. 2012||FPAY||Fee payment|
Year of fee payment: 4
|6 nov. 2015||REMI||Maintenance fee reminder mailed|
|25 mars 2016||LAPS||Lapse for failure to pay maintenance fees|
|17 mai 2016||FP||Expired due to failure to pay maintenance fee|
Effective date: 20160325