The present disclosure relates generally to distributed database systems. A distributed database is a database in which portions of the database is distributed among multiple database nodes.
In one aspect, the disclosed embodiments include a computer-implemented method performed by a system for balancing storage utilization and query processing in a distributed database. In one embodiment, the computer-implemented method receives a set of queries to perform on a database that is distributed among a plurality of nodes. The database includes a plurality of data tables each having a plurality of columns and a plurality of rows. The computer-implemented method determines a uniqueness score for each column of each data table in the database. The computer-implemented method determines a join score for each column of each data table in the database based on the set of queries. The computer-implemented method determines a new distribution key based on the uniqueness score and the join score for each column of each data table in the database. The computer-implemented method recreates the plurality of data tables of the database on the plurality of nodes using the new distribution key for execution of the set of queries.
In another aspect, the disclosed embodiments include a system configured to balancing storage utilization and query processing in a distributed database. The system includes memory for storing instructions, and a processor configured to execute the instructions to receive a set of queries to perform on a database that is distributed among a plurality of nodes, the database comprising a plurality of data tables, where each data table comprises a plurality of columns and a plurality of rows; determine a uniqueness score for each column of each data table in the database; determine a join score for each column of each data table in the database based on the set of queries; determine a new distribution key based on the uniqueness score and the join score for each column of each data table in the database; recreate the plurality of data tables of the database on the plurality of nodes using the new distribution key; execute the set of queries using the recreated database; and display information requested by a user using the results of the set of queries.
In another aspect, the disclosed embodiments include a computer program product comprising a computer readable storage medium having program instructions embodied therewith, the program instructions executable by a processor. Executing the program instructions causes the processor to receive a set of queries to perform on a database that is distributed among a plurality of nodes, the database comprising a plurality of data tables, where each data table comprises a plurality of columns and a plurality of rows; determine a uniqueness score for each column of each data table in the database; determine a join score for each column of each data table in the database based on the set of queries; determine a new distribution key based on the uniqueness score and the join score for each column of each data table in the database; recreate the plurality of data tables of the database on the plurality of nodes using the new distribution key; execute the set of queries using the recreated database; and display information requested by a user using the results of the set of queries.
Other embodiments and advantages of the disclosed embodiments are further described in the detailed description.
For a more complete understanding of this disclosure, reference is now made to the following brief description, taken in connection with the accompanying drawings and detailed description, wherein like reference numerals represent like parts.
The illustrated figures are only exemplary and are not intended to assert or imply any limitation with regard to the environment, architecture, design, or process in which different embodiments may be implemented.
It should be understood at the outset that, although an illustrative implementation of one or more embodiments are provided below, the disclosed systems, computer program product, and/or methods may be implemented using any number of techniques, whether currently known or in existence. The disclosure should in no way be limited to the illustrative implementations, drawings, and techniques illustrated below, including the exemplary designs and implementations illustrated and described herein, but may be modified within the scope of the appended claims along with their full scope of equivalents.
As used within the written disclosure and in the claims, the terms “including” and “comprising” are used in an open-ended fashion, and thus should be interpreted to mean “including, but not limited to”. Unless otherwise indicated, as used throughout this document, “or” does not require mutual exclusivity, and the singular forms “a”, “an” and “the” are intended to include the plural forms as well, unless the context clearly indicates otherwise.
A module or unit as referenced herein may comprise one or more hardware or electrical components such as electrical circuitry, processors, and memory that may be specially configured to perform a particular function. The memory may be volatile memory or non-volatile memory that stores data such as, but not limited to, computer executable instructions, machine code, and other various forms of data. The module or unit may be configured to use the data to execute one or more instructions to perform one or more tasks. In certain instances, a module may also refer to a particular set of functions, software instructions, or circuitry that is configured to perform a specific task. For example, a module may comprise of software components such as, but not limited to, data access objects, service components, user interface components, application programming interface (API) components; hardware components such as electrical circuitry, processors, and memory; and/or a combination thereof. As referenced herein, computer executable instructions may be in any form including, but not limited to, machine code, assembly code, and high-level programming code written in any programming language.
Also, as used herein, the term “communicatively coupled” means capable of sending and/or receiving data over a communication link. The communication link may include both wired and wireless links, and may be a direct link or may comprise of multiple links passing through one or more communication network devices such as, but not limited to, routers, firewalls, servers, and switches. The network device may be located on various types of networks such as local-area networks (LANs), wide-area networks (WANs), and metropolitan-area networks (MANs). The networks may include private networks and/or public networks such as the Internet. Additionally, in certain embodiments, communication links may also encompass internal communication between various components of a system and/or with an external input/output device such as a keyboard or display device.
In one embodiment, the coordinator node 110 is configured to act as a master node that interacts with the worker nodes 120 to fulfill a request from the client system 102. In an alternative embodiment, the coordinator node 110 may be excluded from the parallel database system 100. In these embodiments, the role of the coordinator node 110 may be assigned to one of the plurality of worker nodes 120. Additionally, in certain embodiments, the plurality of worker nodes 120 may be communicatively coupled to each other. Although only three worker nodes 120 are illustrated, the parallel database system 100 may include any number of worker nodes 120 that form the distributed database 130.
In a parallel computing database environment such as that illustrated in
Distributing the data in the manner as illustrated in
In one embodiment, the client application module 304 includes software code, data parameters, user profiles, and configuration settings of a client application. The client application may be any type of application such as, but not limited to, accounting applications, a sales/commission tracking applications, a work document management applications, analytics software, reporting applications, and inventory applications. The client application is configured to enable a user to specify the conditions or parameters of a search that is performed on the data stored in a distributed database such as distributed database 130. As a non-limiting example, the application may enable a user to select or specify via a user interface the names of employees, date ranges, a list of products, salary or commissions amounts related to each product, or other parameters for performing a search on the data stored in a distributed database to determine a bonus amount to be paid to each of the employees.
In one embodiment, the query generator module 306 is configured to generate a set of queries based on the parameters selected or entered by a user. The set of queries may be generated using any type of querying language such as, but not limited to, Structured Query Language (SQL). SQL is a standard computer language for relational database management and data manipulation. SQL is used to query, insert, update, and modify data. For example, the query generator module 306 may generate the SQL query: SELECT * FROM A JOIN B ON A.COL1=B.COL2 to perform a select operation. Most relational databases support SQL. In various embodiments, the set of queries may comprise of hundreds, thousands, or any number of queries to be executed.
In one embodiment, the predictive data distribution module 308 includes computer-executable code configured to identify the optimal distribution key for optimizing both storage and query performance. One method for identifying the optimal distribution key for optimizing both storage and query performance is described below in
The query execution module 312 then executes the set of queries using the redistributed database. The results of the queries are passed to the client reporting module 314, which is configured to present the information requested by the user using the results of the set of queries. For example, the client reporting module 314 may be configured to perform certain calculations using the results of the set of queries and present the requested information in the form of a spreadsheet.
In accordance with one embodiment, the process 400 is configured to normalize the uniqueness score, at step 406, for each column to obtain a value between 0 and 1. For example, in one embodiment, a normalized uniqueness score may be generated by using the equation 1-(1/uniqueness score) to generate a value between 0 and 1, where a value closer to 1 indicates that the column contains more unique elements. Similarly, in one embodiment, the process 400 is configured to normalize the join score, at step 406, for each column using the equation 1-(1/join score) to generate a value between 0 and 1. A value closer to 1 indicates that the column is used in a higher number of join operations. By having normalized uniqueness and join scores, the significance of a join score of five would not be lost when added or compared to a uniqueness score of a one million.
Additionally, in some embodiments, the process 400, at step 408, may apply a weight factor to the normalized uniqueness score. The process 400, at step 414, may also apply a weight factor to the normalized join score. For example, in one embodiment, both the normalized uniqueness score and the normalized join score are multiplied by a one-half (0.5) weight factor. In other embodiments, a different weight factor may be applied to each of the normalized uniqueness score and the normalized join score. For example, in one embodiment, a 0.6 weight factor may be applied to the normalized uniqueness score and a 0.4 weight factor may be applied to the normalized join score in the case that the predictive data distribution is configured to favor less data distribution skew over processing skew. Likewise, a larger weight factor may be applied to the normalized join score than the weight factor of the normalized uniqueness score if the predictive data distribution is configured to favor less processing skew over data distribution skew.
At step 410, the process 400 is configured to combine the normalized uniqueness score and the normalized join score for each column together. In the embodiment where both the normalized uniqueness score and the normalized join score are multiplied by a one-half (0.5) weight factor, the combined score will be a value between 0 and 1. A column with a combined score closest to 1 indicates that the column provides the best balance between distribution skew and processing skew and is configured, at step 418, as the new distribution key. The process 400, at step 420, re-distributes or recreates the data tables in the database using the new distribution key. At step 422, the process 400 executes the set of queries on the redistributed database. The process 400 terminates thereafter.
In the depicted example, network adapter 616 connects to SB/ICH 610. Audio adapter 630, keyboard and mouse adapter 622, modem 624, read-only memory (ROM) 626, hard disk drive (HDD) 612, compact disk read-only memory (CD-ROM) drive 614, universal serial bus (USB) ports and other communication ports 618, and peripheral component interconnect/peripheral component interconnect express (PCI/PCIe) devices 620 connect to SB/ICH 610 through bus 632 and bus 634. PCI/PCIe devices may include, for example, Ethernet adapters, add-in cards, and personal computing (PC) cards for notebook computers. PCI uses a card bus controller, while PCIe does not. ROM 626 may be, for example, a flash basic input/output system (BIOS). Modem 624 or network adapter 616 may be used to transmit and receive data over a network.
HDD 612 and CD-ROM drive 614 connect to SB/ICH 610 through bus 634. HDD 612 and CD-ROM drive 614 may use, for example, an integrated drive electronics (IDE) or serial advanced technology attachment (SATA) interface. In some embodiments, HDD 612 may be replaced by other forms of data storage devices including, but not limited to, solid-state drives (SSDs). A super I/O (SIO) device 628 may be connected to SB/ICH 610. SIO device 628 may be a chip on the motherboard that is configured to assist in performing less demanding controller functions for the SB/ICH 610 such as controlling a printer port, controlling a fan, and/or controlling the small light emitting diodes (LEDS) of the data processing system 600.
The data processing system 600 may include a single processor 602 or may include a plurality of processors 602. Additionally, processor(s) 602 may have multiple cores. For example, in one embodiment, data processing system 600 may employ a large number of processors 602 that include hundreds or thousands of processor cores. In some embodiments, the processors 602 may be configured to perform a set of coordinated computations in parallel.
An operating system is executed on the data processing system 600 using the processor(s) 602. The operating system coordinates and provides control of various components within the data processing system 600 in
The present invention may be a system, a method, and/or a computer program product at any possible technical detail level of integration. 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, configuration data for integrated circuitry, 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 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 computer 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 method, 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 instructions, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the blocks 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. Further, the steps of the methods described herein may be carried out in any suitable order, or simultaneously where appropriate. 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.