The present invention relates generally to optimizer problem determination and in particular to optimization of query execution plans for relational databases.
Relational database management systems have long been central to the information economy, and the complexity of such systems has increased with the volume of data under management. At the enterprise level, major commercial relational database systems such as IBM® DB2®, Oracle® Database, and Microsoft® SQL Server® are deployed in environments where finding all available optimizations and performance enhancements becomes necessary to maintaining everyday usability of the database.
A computer-implemented method includes receiving an artefact and a problem pattern, transforming the artefact into an abstracted artefact structure, and transforming the problem pattern into a query. The query is matched against the abstracted artefact structure. Any matched portions of the abstracted artefact structure are related back to corresponding result portions of the artefact. The corresponding result portions of the artefact are returned. A corresponding computer system and computer program product are also disclosed.
Referring now to the invention in more detail,
In general, the artefact 102 may be any data to be analyzed, and the problem pattern 103 may be any pattern to be matched within the artefact 102. More particularly, the artefact 102 may be diagnostic data, for example relating to one or more computer systems. Broadly, the contemplated diagnostic data may be human-readable and intended for review by human users of the system to which the diagnostic data relates. Examples of possible artefacts 102 include log data relating to network usage, security, or software compiling, as well as software debug data or sensor data relating to some physical system external to the computer system 100. The problem pattern may correspond to any sequence of data points or interrelationships of data points that are of diagnostic interest.
In some embodiments, such as the embodiment depicted in
Time-costly review of the query plan by a human user may therefore be needed to further improve performance, for example where the human user seeks to improve, debug, or verify the optimizer itself. Machine optimization may likewise fail where a performance enhancement cannot be implemented directly by optimizing the proposed query as-coded, for example, using Structured Query Language (“SQL”). Examples of this include cases where the recommended performance enhancement is to index a particular table in a particular way or to alter the proposed query to generate the same result but with better performance. In this class of embodiments, the problem pattern 103 comprises a sequence of LOLEPOPS having particular properties that are interest to a user as indicative of one or more of the aforementioned problems.
The query plan knowledge base 205 may include one or more predetermined problem patterns related to one or more query plan solution recommendations 206. The predetermined problem patterns and related query plan solution recommendations 206 may be created by one or more experts 207. The query plan problem determination program 201 may also access the query plan knowledge base 205 and match the query plan problem pattern 203 against the one or more predetermined problem patterns in the query plan knowledge base 205. Matching the query plan problem pattern 203 against the one or more predetermined problem patterns may be accomplished by any search algorithm. Where the query plan problem determination program 201 detects a match between the query plan problem pattern 203 and the query execution plan 202, the query plan problem determination program may return the one or more query plan solution recommendations 206 for those of the one or more predetermined problem patterns that are matched. The general user 210 may apply the returned query plan solution recommendation 206, which may include one or more recommendations to engage in one or more database tuning operations, to achieve a performance enhancement 213.
In an alternative case, the query plan problem determination program 201 may, instead of taking a specific problem pattern 103 defined by the user, iterate over all of the predetermined problem patterns in the query plan knowledge base 205. Specifically, each problem pattern 103 may, in such cases, be understood as being received from the query plan knowledge base 205. In such cases, the query plan problem determination program may directly recall and return the solution recommendations for the particular problem pattern 103, if there are any results on the artefact 102. Such a technique would enable query plan checks to be routinized—a user could, with now particular knowledge or training, run a general test of all predetermined problem patterns against a given artefact 102.
Referring now to the data flow diagram of
Referring now to the flow chart diagram of
The transformations of steps 401 and 402 may be made such that the abstracted artefact structure 311 can be queried or is traversable, in particular according to the query 310. Specifically, the artefact 102 may be transformed so as to be expressed in Resource Description Framework (RDF) or other traversable structure. RDF is a standard maintained by the World Wide Web Consortium (W3C); generically, a “resource description framework” may be any data structure whose properties are similar to that of RDF. In particular, the RDF standard permits resources both to share predicates and relationships and to have their own unique ones. Using an externally imposed framework of predicates and relationships, the abstracted artefact structure 311 can represent hierarchical relationships within the artefact 102. For example RDF relationships and predicates can model the input and output streams of various LOLEPOPS where the artefact 102 is a RDBMS query plan.
Where the abstracted artefact structure 311 is expressed in a resource description framework, it may be directly queried at the application level of the problem determination program 101 via query expressed in a resource description framework query language. More specifically, the SPARQL Protocol and RDF Query Language (SPARQL) (also a standard maintained by the W3C) provides a means of directly querying RDF data. Thus, the problem determination program may accomplish step 402 by expressing the query 310 in SPARQL (directed to RDF) or a resource description framework query language directed to a different or generic resource description framework. In such embodiments, step 403 is effected by directly executing the query 310 against the abstracted artefact structure 311 using any standard-compliant implementation of RDF and SPARQL, or a generic resource description framework and a corresponding resource description framework query language.
As depicted, the computer 900 operates over a communications fabric 902, which provides communications between the computer processor(s) 904, memory 906, persistent storage 908, communications unit 912, and input/output (I/O) interface(s) 914. The communications fabric 902 may be implemented with any architecture suitable for passing data or control information between the processors 904 (e.g. microprocessors, communications processors, and network processors), the memory 906, the external devices 920, and any other hardware components within a system. For example, the communications fabric 902 may be implemented with one or more buses.
The memory 906 and persistent storage 908 are computer readable storage media. In the depicted embodiment, the memory 906 comprises a random access memory (RAM) 916 and a cache 918. In general, the memory 906 may comprise any suitable volatile or non-volatile one or more computer readable storage media.
Program instructions for the problem determination program program 101 may be stored in the persistent storage 908, or more generally, any computer readable storage media, for execution by one or more of the respective computer processors 904 via one or more memories of the memory 906. The persistent storage 908 may be a magnetic hard disk drive, a solid state disk drive, a semiconductor storage device, read-only memory (ROM), electronically erasable programmable read-only memory (EEPROM), flash memory, or any other computer readable storage media that is capable of storing program instructions or digital information.
The media used by the persistent storage 908 may also be removable. For example, a removable hard drive may be used for persistent storage 908. Other examples include optical and magnetic disks, thumb drives, and smart cards that are inserted into a drive for transfer onto another computer readable storage medium that is also part of the persistent storage 908.
The communications unit 912, in these examples, provides for communications with other data processing systems or devices. In these examples, the communications unit 912 may comprise one or more network interface cards. The communications unit 912 may provide communications through the use of either or both physical and wireless communications links. In the context of some embodiments of the present invention, the source of the various input data may be physically remote to the computer 900 such that the input data may be received and the output similarly transmitted via the communications unit 912.
The I/O interface(s) 914 allow for input and output of data with other devices that may operate in conjunction with the computer 900. For example, the I/O interface 914 may provide a connection to the external devices 920, which may be as a keyboard, keypad, a touch screen, or other suitable input devices. External devices 920 may also include portable computer readable storage media, for example thumb drives, portable optical or magnetic disks, and memory cards. Software and data used to practice embodiments of the present invention may be stored on such portable computer readable storage media and may be loaded onto the persistent storage 908 via the I/O interface(s) 914. The I/O interface(s) 914 may similarly connect to a display 922. The display 922 provides a mechanism to display data to a user and may be, for example, a computer monitor.
The present invention may be a system, a method, and/or a computer program product. The computer program product may include a computer readable storage medium (or media) having computer readable program instructions thereon for causing a processor to carry out aspects of the present invention.
The computer readable storage medium can be a tangible device that can retain and store instructions for use by an instruction execution device. The computer readable storage medium may be, for example, but is not limited to, an electronic storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the foregoing. A non-exhaustive list of more specific examples of the computer readable storage medium includes the following: a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), a static random access memory (SRAM), a portable compact disc read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanically encoded device such as punch-cards or raised structures in a groove having instructions recorded thereon, and any suitable combination of the foregoing. A computer readable storage medium, as used herein, is not to be construed as being transitory signals per se, such as radio waves or other freely propagating electromagnetic waves, electromagnetic waves propagating through a waveguide or other transmission media (e.g., light pulses passing through a fiber-optic cable), or electrical signals transmitted through a wire.
Computer readable program instructions described herein can be downloaded to respective computing/processing devices from a computer readable storage medium or to an external computer or external storage device via a network, for example, the Internet, a local area network, a wide area network and/or a wireless network. The network may comprise copper transmission cables, optical transmission fibers, wireless transmission, routers, firewalls, switches, gateway computers and/or edge servers. A network adapter card or network interface in each computing/processing device receives computer readable program instructions from the network and forwards the computer readable program instructions for storage in a computer readable storage medium within the respective computing/processing device.
Computer readable program instructions for carrying out operations of the present invention may be assembler instructions, instruction-set-architecture (ISA) instructions, machine instructions, machine dependent instructions, microcode, firmware instructions, state-setting data, or either source code or object code written in any combination of one or more programming languages, including an object oriented programming language such as Smalltalk, C++ or the like, and conventional procedural programming languages, such as the “C” programming language or similar programming languages. The computer readable program instructions may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the latter scenario, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet Service Provider). In some embodiments, electronic circuitry including, for example, programmable logic circuitry, field-programmable gate arrays (FPGA), or programmable logic arrays (PLA) may execute the computer readable program instructions by utilizing state information of the computer readable program instructions to personalize the electronic circuitry, in order to perform aspects of the present invention.
Aspects of the present invention are described herein with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and/or block diagrams, and combinations of blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer readable program instructions.
These computer readable program instructions may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions/acts specified in the flowchart and/or block diagram block or blocks. These computer readable program instructions may also be stored in a readable storage medium that can direct a computer, a programmable data processing apparatus, and/or other devices to function in a particular manner, such that the computer readable storage medium having instructions stored therein comprises an article of manufacture including instructions which implement aspects of the function/act specified in the flowchart and/or block diagram block or blocks.
The computer readable program instructions may also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process, such that the instructions which execute on the computer, other programmable apparatus, or other device implement the functions/acts specified in the flowchart and/or block diagram block or blocks.
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 invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of computer program instructions, which comprises one or more executable instructions for implementing the specified logical function(s). 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 that perform the specified functions or acts or carry out combinations of special purpose hardware and computer instructions.
The descriptions of the various embodiments of the present invention have been presented for purposes of illustration, but are not intended to be exhaustive or limited to the embodiments disclosed. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein was chosen to best explain the principles of the embodiments, the practical application or technical improvement over technologies found in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.