1. A method of optimizing database queries in a multi-tenant database system having a relational data store and a non-relational data store, the method comprising: receiving a request at a host system for the multi-tenant database system, the request specifying data to be retrieved from the multi-tenant database system; retrieving, based on the request via the host system, one or more locations of the data to be retrieved; generating, at the host system, a database query based on the request, wherein the database query specifies a plurality of data elements to be retrieved, the plurality of data elements including one or more data elements residing within the non-relational data store and one or more other data elements residing within the relational data store; optimizing the database query via a query optimizer to generate an optimized database query having an optimized query syntax that is distinct from a query syntax of the database query; executing the optimized database query against the multi-tenant database system to retrieve the data; wherein optimizing the database query comprises: (i) identifying a first sub-query to a table within relational data store, the first sub-query corresponding to the first portion of the data to be retrieved, (ii) identifying a second sub-query to the non-relational data store; the second sub-query corresponding to the second portion of the data to be retrieved, (iii) replicating the table within the relational data store to the non-relational data store, and (iv) generating the optimized database query with one or more sub-queries to fetch both the first portion of the data to be retrieved and the second portion of the data to be retrieved from the non-relational data store; and wherein the database query comprises a specified order for two or more database join operations in which at least one of the database join operations comprises joining a child table from the non-relational data store with a master table from the relational data store and wherein optimizing the database query further comprises modifying the specified order for the two or more database join operations.
9. The method of claim 1 , wherein optimizing the database query further comprises: identifying a first sub-query to the non-relational data store; identifying a second sub-query to the relational data store, wherein the second sub-query comprises a data delta query to an append log of the relational data store for new or updated data elements within the scope of the first sub-query to the non-relational data store which are not yet flushed from the append log of the relational data store to the non-relational data store; executing a flush against the relational data store to flush the new or updated data elements within the append log of the relational data store to the non-relational data store; and eliminating the second sub-query to the relational data store from the optimized database query.