×

Method and system for optimizing queries in a multi-tenant database environment

  • US 8,655,867 B2
  • Filed: 01/26/2011
  • Issued: 02/18/2014
  • Est. Priority Date: 05/13/2010
  • Status: Active Grant
First Claim
Patent Images

1. A machine-implemented method comprising:

  • a computer system including one or more computers, which includes at least a processor system having at least one processor, receiving a user query;

    the processor system parsing the user query and automatically generating a set of parallel subqueries that in combination are equivalent to the user query in results that are expected to be returned, where the parsing of the user query determines one or more OR clauses to be within the user query;

    the computer system forming a query that is applied to multiple database tables, if a cost of the user query is expected to be more than the query formed, the forming of the query being by at least forming a clause that combines the set of parallel subqueries into a query equivalent to the user query;

    the method also including at leastgenerating, by the computer system, prequeries the prequeries being a series of queries that are run to determine an estimate of a cost of each of the parallel subqueries;

    optimizing, by the computer system, individual subqueries of the parallel subqueries with a query optimizer by, for each of the individual subqueries, the query optimizer determining which of a plurality of methods of performing a query has a lowest calculated cost;

    calculating, by the computer system, computational costs of the filters in the subqueries by at least;

    determining, by the computer system, for each of the subqueries, selectivities of the filters, each selectivity of a filter being determined by counting, by the computer system, how many records are selected by applying the filter, orby determining, by the computer system, what fraction of the records of a total number of records in a table match each filter;

    summing, by the computer system, the selectivities of the filters;

    determining, by the computer system, whether the cost of the user query is expected to be more than the query formed with the clause that combines the set of parallel subqueries where the combining of the set of parallel subqueries is performed by at least comparing the computational costs of the filters in the subqueries to the user query;

    where the prequeries include at least range scans against an index, and there is at least a row limit to stop the range scan when it is determined that a particular filter is not selective;

    where the index includes at least a custom index, where the custom index accesses data belonging to a specified user from the database network that contains data belonging to a series of separate users, or the index includes at least an accelerator table that is an indexed table that is added to the user query to give the user query a driving index;

    where the computer system includes a database network system that is a multi-tenant database system.

View all claims
  • 1 Assignment
Timeline View
Assignment View
    ×
    ×