A distributed database system includes two or more database nodes. Each node executes one or more database processes and is associated with respective data storage. To retrieve data from a distributed database, a client application transmits a query to a database node which is designated to receive such queries. The designated database node determines whether it should execute the query or route the query to another database node for execution, and then executes or routes the query based on the determination.
The following description is provided to enable any person in the art to make and use the described embodiments and sets forth the best mode contemplated for carrying out some embodiments. Various modifications, however, will remain readily apparent to those in the art.
Generally, each logical element described herein may be implemented by any number of devices coupled via any number of public and/or private networks. Two or more of such devices may be located remote from one another and may communicate with one another via any known manner of network(s) and/or via a dedicated connection.
System 100 includes database instance 110, which is a distributed database including database nodes 112, 114 and 116. Each of database nodes 112, 114 and 116 includes at least one processor and a memory device. The memory devices of database nodes 112, 114 and 116 need not be physically segregated as illustrated in
In some embodiments, the memory of database nodes 112, 114 and 116 is implemented in Random Access Memory (e.g., cache memory for storing recently-used data) and one or more fixed disks (e.g., persistent memory for storing their respective portions of the full database). Alternatively, one or more of nodes 112, 114 and 116 may implement an “in-memory” database, in which volatile (e.g., non-disk-based) memory (e.g., Random Access Memory) is used both for cache memory and for storing its entire respective portion of the full database. In some embodiments, the data of the full database may comprise one or more of conventional tabular data, row-based data, column-based data, and object-based data. A single database table may be “partitioned” among two or more of database nodes 112, 114 and 116, as defined by metadata associated with the table. Database instance 100 may also or alternatively support multi-tenancy by providing multiple logical database systems which are programmatically isolated from one another.
According to some embodiments, database nodes 112, 114 and 116 each execute a database server process to provide the data of the full database to database applications. More specifically, database instance 110 may communicate with one or more database applications executed by client 120 over one or more interfaces (e.g., a Structured Query Language (SQL)-based interface) in order to provide data thereto. Client 120 may comprise one or more processors and memory storing program code which is executable by the one or more processors to cause client 120 to perform the actions attributed thereto herein.
Client 120 may thereby comprise an application server executing database applications to provide, for example, business reporting, inventory control, online shopping, and/or any other suitable functions. The database applications may, in turn, support presentation applications executed by end-user devices (e.g., desktop computers, laptop computers, tablet computers, smartphones, etc.). Such a presentation application may simply comprise a Web browser to access and display reports generated by a database application.
The data of database instance 110 may be received from disparate hardware and software systems, some of which are not interoperational with one another. The systems may comprise a back-end data environment employed in a business or industrial context. The data may be pushed to database instance 110 and/or provided in response to queries received therefrom.
Database instance 110 and each element thereof may also include other unshown elements that may be used during operation thereof, such as any suitable program code, scripts, or other functional data that is executable to interface with other elements, other applications, other data files, operating system files, and device drivers. These elements are known to those in the art, and are therefore not described in detail herein.
Initially, at S210, a query is received from a client. For example, database node 112 of instance 110 may receive a database query from client 120 at S210. The query may conform to any suitable compilable query language that is or becomes known, such as, for example, SQL.
Next, the receiving database node compiles the query at S220. According to some embodiments of S220, the database node executes a compiler associated with the language of the query, and compilation of the query results in compiled code. The compiled code is executable by any database node to execute the query on the data managed by the database node.
In this regard, partitioning metadata of a database table specified in the query is determined at S230. The partitioning metadata may be used to identify a partition of the database table to which particular table key values belong. The partitioning metadata may also specify database nodes to which each partition of the database table belongs. Accordingly, as will be described with respect to process 300, the partitioning metadata may be used to identify a database node based on table key values.
According to some embodiments, the partitioning metadata includes, but is not limited to, a partitioning criteria function having input parameters associated with table keys, and, for each partition of the database table specified in the query, an identifier of a database node storing the partition. Usage of this partitioning metadata according to some embodiments will be described in detail below.
The compiled query and the partitioning metadata are transmitted to the client at S240. As will be described below with respect to process 300, the partitioning metadata may allow the client to route subsequent executions of the query to an appropriate database node (i.e., to the database node which owns the desired portion of the database table).
Flow initially cycles at S310 until an instruction to execute a query is received. The instruction may be generated by internal processes of an application executing on an application server and/or received from a user device at S310.
Once a query is received, it is determined at S320 whether the client possesses compiled code corresponding to the query, as discussed above with respect to process 200. In one example of S320, a client checks a locally-stored library (e.g., an SQLDBC client library) to determine whether the compiled code resides in the library.
In the
As described with respect to S210 through S240 of process 200, database node 412 may proceed to compile the query, determine partitioning metadata associated with a table specified by the query, and transmit the compiled code and the partitioning metadata to the client. Returning to process 300, compiled code corresponding to the query and the partitioning metadata are received at S340.
The compiled code is stored in association with the partitioning metadata at S350.
Next, at S360, partitioning metadata associated with the compiled query is identified. A database node is then determined based on the partitioning metadata and on key values of the query at S370. According to some embodiments, a partitioning criteria function of the partitioning metadata is evaluated at S370 using key values of the query as input parameters. The function outputs an indication of a partition of Table T which includes the data sought by the query. The partitioning metadata also includes information indicating the database node which stores the partition. Accordingly, this database node is determined at S370.
The compiled code corresponding to the query is transmitted to the determined database node at S380. According to some embodiments, client 420 transmits the compiled query to the identified database node by calling an “Execute Query” API exposed by database node 414, as shown in
According to
The compiled code corresponding to the query, and the partitioning metadata, are received at S340 are received as also shown in
Next, at S360, partitioning metadata associated with the compiled query is identified. A database node is then determined based on the partitioning metadata and on key values of the query at S370. As previously described, a partitioning criteria function of the partitioning metadata may be evaluated at S370 using key values of the query as input parameters. The function outputs an indication of a partition of Table V which includes the data sought by the query. The partitioning metadata also includes information indicating the database node which stores the partition. Accordingly, this database node is determined at S370.
The compiled code corresponding to the query is transmitted to the determined database node at S380, as shown in
It will now be assumed that an instruction to execute query Q1 is received at S310. Referring to
Therefore, according to some embodiments, second and subsequent executions of a query may avoid S330, S340 and S350 of process 300, since the client will already possess both the compiled query and an identifier of a database node which is suitable for executing the query.
Database master 910 and each of database slaves 912, 914 and 916 may comprise a multi-processor “blade” server. Each of database master 910 and database slaves 912, 914 and 916 may operate as described herein with respect to database nodes, and database master 910 may perform additional transaction management functions and other master server functions which are not performed by database slaves 912, 914 and 916 as is known in the art.
Database master 910 and database slaves 912, 914 and 916 are connected via network switch 920, and are thereby also connected to shared storage 930. Shared storage 930 and all other memory mentioned herein may comprise any appropriate non-transitory storage device, including combinations of magnetic storage devices (e.g., magnetic tape, hard disk drives and flash memory), optical storage devices, Read Only Memory (ROM) devices, etc.
Shared storage 930 may comprise the persistent storage of a database instance distributed among database master 910 and database slaves 912, 914 and 916. As such, various portions of the data within shared storage 930 may be allotted (i.e., managed by) one of database master 910 and database slaves 912, 914 and 916.
Application server 940 may also comprise a multi-processor blade server. Application server 940, as described above, may execute database applications to provide functionality to end users operating user devices. Application server 940 may also execute process 300 to store compiled query code and associated node identifiers in local memory (not shown) for use in routing and executing database queries.
Embodiments described herein are solely for the purpose of illustration. Those in the art will recognize other embodiments may be practiced with modifications and alterations to that described above.
Number | Name | Date | Kind |
---|---|---|---|
6457060 | Martin et al. | Sep 2002 | B1 |
7123613 | Chawla et al. | Oct 2006 | B1 |
7606792 | Cunningham et al. | Oct 2009 | B2 |
7720813 | Ellsworth et al. | May 2010 | B2 |
7917502 | Cheng et al. | Mar 2011 | B2 |
8140493 | Waddington et al. | Mar 2012 | B2 |
8365153 | Chen et al. | Jan 2013 | B2 |
20120290582 | Oikarinen | Nov 2012 | A1 |
Number | Date | Country |
---|---|---|
WO2012022751 | Feb 2012 | EP |
Number | Date | Country | |
---|---|---|---|
20130275457 A1 | Oct 2013 | US |