METHOD FOR MONITORING AND DEBUGGING QUERY EXECUTION OBJECTS
Nodes in a query execution data structure have monitor and dump methods defined. The monitor method enables the collection of information from the node. The dump method outputs the monitored information from each node. A monitor and debug mechanism of the preferred embodiments includes a graphical user interface that allows a user to graphically examine a query execution tree, to enable monitoring of the nodes on a node-by-node basis, and to view information dumped from the query execution data structure as the query is executed or after the query is executed. The result is a powerful tool that allows efficiently monitoring and debugging a query implemented in an object oriented query execution data structure.
Latest IBM Patents:
This patent application is a continuation of an application entitled “Apparatus and Method for Monitoring and Debugging Query Execution Objects”, U.S. Ser. No. 11/282,030, filed on Nov. 12, 2005, which is incorporated herein by reference.
BACKGROUND OF THE INVENTION1. Technical Field
This invention generally relates to computer systems, and more specifically relates to database apparatus and methods.
2. Background Art
Database systems have been developed that allow a computer to store a large amount of information in a way that allows a user to search for and retrieve specific information in the database. For example, an insurance company may have a database that includes all of its policy holders and their current account information, including payment history, premium amount, policy number, policy type, exclusions to coverage, etc. A database system allows the insurance company to retrieve the account information for a single policy holder among the thousands and perhaps millions of policy holders in its database.
Retrieval of information from a database is typically done using queries. A query usually specifies conditions that apply to one or more columns of the database, and may specify relatively complex logical operations on multiple columns. The database is searched for records that satisfy the query, and those records are returned as the query result. Structured Query Language (SQL) is one specific query language that may be used to query a database.
U.S. Pat. No. 6,915,291 entitled “Object-Oriented Query Execution Data Structure”, issued on Jul. 5, 2005, discloses an object oriented data structure that includes a plurality of node objects arranged in a tree relationship to define a query. The nodes include both data and code that allow the query to be executed. The result is a query architecture that is significantly extendible and adaptable.
One potential problem with the query execution data structure in U.S. Pat. No. 6,915,291 is the complexity of the data structure for complicated queries. The resulting data structure can have hundreds or even thousands of nodes. A query of this complexity becomes very difficult to debug. Debugging queries is important for two primary reasons. The first is to check the logic of the query itself, to make sure the query is properly defined. The second is to check the run-time performance of the query.
Statement level debuggers are known in the art, and have been used to debug queries. The problem with a statement level debugger is that a breakpoint is typically set when a particular object is executed. Note, however, that a given object type may appear in a query execution data structure at a number of different locations, each executing the same implementation methods, but potentially only one of these objects is actually contributing to the problem being debugged. For example, if a query execution data structure has ten instances of an object, and a breakpoint is set to break execution when that object type is executed, the debugger will break execution each time any of the ten instances of the object are executed, even though most of the instances may not contribute to the problem. The result is a debugger that breaks an excessive number of times.
Current debuggers do not have the capability of executing a query execution object to the point of failure, and halting execution at the proper place and time in the code, even using elaborate debugger macros. As a result, it is very difficult, if not impossible, to debug a complex query execution data structure that includes many query execution objects using known statement level debuggers. Without a way to debug query execution data structures, the prior art will continue to suffer from inefficient ways of debugging queries.
DISCLOSURE OF INVENTIONAccording to the preferred embodiments, nodes in a query execution data structure have monitor and dump methods defined. The monitor method enables the collection of information from the node. The dump method outputs the monitored information from each node. A monitor and debug mechanism of the preferred embodiments includes a graphical user interface that allows a user to graphically examine a query execution tree, to enable monitoring of the nodes on a node-by-node basis, and to view information dumped from the query execution data structure as the query is executed or after the query is executed. The result is a powerful tool that allows efficiently monitoring and debugging a query implemented in an object oriented query execution data structure.
The foregoing and other features and advantages of the invention will be apparent from the following more particular description of preferred embodiments of the invention, as illustrated in the accompanying drawings.
The preferred embodiments of the present invention will hereinafter be described in conjunction with the appended drawings, where like designations denote like elements, and:
The preferred embodiments provide an efficient way to monitor a query execution data structure as it executes, which allows for debugging a query corresponding to the query execution data structure. Each node in the query execution data structure includes a monitor( ) method that enables collection of monitored data, and a dump( ) method that outputs the monitored data. A debug and monitor mechanism receives the monitored data, and displays information corresponding to the monitored data in a graphical user interface. The debug and monitor mechanism allows monitoring and debugging a query as the query executes, thereby allowing a powerful tool for real-time monitoring and debugging.
Referring to
Main memory 120 in accordance with the preferred embodiments contains data 121, an operating system 122, a database 123, a query engine 124, a query execution data structure 125, and a monitor and debug mechanism 126. Data 121 represents any data that serves as input to or output from any program in computer system 100. Operating system 122 is a multitasking operating system known in the industry as i5/OS; however, those skilled in the art will appreciate that the spirit and scope of the present invention is not limited to any one operating system. Database 123 is any suitable database, whether currently known or developed in the future. Database 123 preferably includes one or more tables. Query engine 124 processes queries to database 123 in the form of query execution data structure 125. The query execution data structure 125 is an object oriented data structure representative of a database query. The query execution data structure 125 has the basic form shown in U.S. Pat. No. 6,915,291, but with additional methods shown in
Computer system 100 utilizes well known virtual addressing mechanisms that allow the programs of computer system 100 to behave as if they only have access to a large, single storage entity instead of access to multiple, smaller storage entities such as main memory 120 and DASD device 155. Therefore, while data 121, operating system 122, database 123, query engine 124, query execution data structure 125, and monitor and debug mechanism 126 are shown to reside in main memory 120, those skilled in the art will recognize that these items are not necessarily all completely contained in main memory 120 at the same time. It should also be noted that the term “memory” is used herein to generically refer to the entire virtual memory of computer system 100, and may include the virtual memory of other computer systems coupled to computer system 100.
Processor 110 may be constructed from one or more microprocessors and/or integrated circuits. Processor 110 executes program instructions stored in main memory 120. Main memory 120 stores programs and data that processor 110 may access. When computer system 100 starts up, processor 110 initially executes the program instructions that make up operating system 122. Operating system 122 is a sophisticated program that manages the resources of computer system 100. Some of these resources are processor 110, main memory 120, mass storage interface 130, display interface 140, network interface 150, and system bus 160.
Although computer system 100 is shown to contain only a single processor and a single system bus, those skilled in the art will appreciate that the present invention may be practiced using a computer system that has multiple processors and/or multiple buses. In addition, the interfaces that are used in the preferred embodiments each include separate, fully programmed microprocessors that are used to off-load compute-intensive processing from processor 110. However, those skilled in the art will appreciate that the present invention applies equally to computer systems that simply use I/O adapters to perform similar functions.
Display interface 140 is used to directly connect one or more displays 165 to computer system 100. These displays 165, which may be non-intelligent (i.e., dumb) terminals or fully programmable workstations, are used to allow system administrators and users to communicate with computer system 100. Note, however, that while display interface 140 is provided to support communication with one or more displays 165, computer system 100 does not necessarily require a display 165, because all needed interaction with users and other processes may occur via network interface 150.
Network interface 150 is used to connect other computer systems and/or workstations (e.g., 175 in
At this point, it is important to note that while the present invention has been and will continue to be described in the context of a fully functional computer system, those skilled in the art will appreciate that the present invention is capable of being distributed as a program product in a variety of forms, and that the present invention applies equally regardless of the particular type of computer-readable signal bearing media used to actually carry out the distribution. Examples of suitable computer-readable signal bearing media include: recordable type media such as floppy disks and CD RW (e.g., 195 of
Referring to
Referring to
Referring to
The dump( ) method is invoked to read the monitored data from a node. If monitoring is disabled for a particular node, the dump( ) method will cause the minimal set of monitored data to be read. If monitoring is enabled for a particular node, the dump( ) method will cause the more extensive set of monitored data to be read. In short, the dump( ) method dumps out all of the monitored data, whether it be minimal (if monitoring is disabled) or more extensive (if monitoring is enabled). As shown in
We now show several sample windows that could be displayed by the graphical user interface 127 in
The query tree display window 700 shows the query tree in a graphical format similar to that shown in
We now assume the user double-clicks or otherwise selects the scan node 720 in
Referring back to
We now assume a user clicks on the display resource button 950 in
We now assume the user is again viewing the display 600 in
Referring to
Referring to
The preferred embodiments significantly improve the power of the query execution data structure disclosed in U.S. Pat. No. 6,915,291 by adding monitor and dump methods on one or more nodes in the query execution data structure. The monitor and dump methods enable the gathering and output of monitored data to a monitor and debug mechanism, which can then display corresponding information in a GUI to a user. The result is a powerful tool for monitoring and debugging even complex queries that may have hundreds or thousands of nodes in their corresponding query execution data structures.
While the tool may be used to perform real-time monitoring of queries as they execute, many queries will not take enough time to execute for a user to monitor the query in real-time as it executes. In such a case, the debug and monitor mechanism is useful as a post-processing tool to examine the state of the query objects after query execution is complete. In addition, the monitor and debug mechanism of the preferred embodiments may specify a breakpoint for a particular node that allows running the query to the point where the breakpoint is encountered, then halting execution of the query for analysis using the monitor and debug mechanism.
One skilled in the art will appreciate that many variations are possible within the scope of the present invention. Thus, while the invention has been particularly shown and described with reference to preferred embodiments thereof, it will be understood by those skilled in the art that these and other changes in form and details may be made therein without departing from the spirit and scope of the invention.
Claims
1. A computer-implemented method for displaying information regarding a query to a user in a graphical user interface, the method comprising the steps of:
- executing the query, wherein the query comprises an object oriented query execution data structure that comprises a plurality of object oriented nodes, wherein each node includes a monitor method that enables collection of monitored data from the node and a dump method that outputs the monitored data;
- receiving the monitored data from the object oriented query execution data structure; and
- displaying information corresponding to the monitored data to the user in the graphical user interface.
2. The method of claim 1 wherein each node in the object oriented query execution data structure includes a monitor method that enables collection of monitored data from the node and a dump method that outputs the monitored data.
3. The method of claim 1 wherein the monitored data is written to a file, and the step of receiving the monitored data comprises the step of reading the file.
4. The method of claim 1 wherein the step of receiving the monitored data comprises the step of receiving the monitored data in a data stream from the query execution data structure.
5. The method of claim 1 further comprising the step of examining the monitored data as the query executes.
Type: Application
Filed: Feb 27, 2008
Publication Date: Jul 3, 2008
Applicant: INTERNATIONAL BUSINESS MACHINES CORPORATION (Armonk, NY)
Inventors: David Glenn Carlson (Rochester, MN), Steven Virgil Hoeschen (Rochester, MN), Kevin James Kathmann (Rochester, MN)
Application Number: 12/038,462
International Classification: G06F 17/30 (20060101);