×

Join type for optimizing database queries

  • US 10,102,248 B2
  • Filed: 01/27/2015
  • Issued: 10/16/2018
  • Est. Priority Date: 10/10/2012
  • Status: Active Grant
First Claim
Patent Images

1. A method for optimizing database queries in a query compiler, comprising:

  • searching a subquery within a query;

    analyzing the searched subquery to identify a candidate of a scalar subquery;

    analyzing the candidate scalar subquery to identify a candidate of a correlated scalar subquery; and

    transforming the query having the candidate correlated scalar subquery into a query of a quasi-JOIN depending on a result type of the candidate correlated scalar subquery,wherein the quasi-JOIN is a join to process grouping and aggregation, in which Group by Aggregation and Join that is a lower node of the Group by Aggregation are merged together and the quasi-JOIN includes a first aggregation join in which join keys and group keys do not match each other and a second aggregation join in which join keys and group keys match each other;

    wherein the first aggregation join creates a result in which the group keys are partially grouped and subjected to Aggregation when the join keys and the groups have a matching condition, wherein the results for the rows with the group keys that are duplicated are grouped at a Group by Aggregation that is an upper node;

    wherein the second aggregation join returns a result in which the group keys are grouped and subjected to Aggregation when the join keys and the groups have a matching condition;

    wherein a table to which the group keys belong is a group table and a table to which the columns used in performing the aggregation belong is an aggregation table;

    wherein the first aggregation join is created under a situation that when both the tables are joined, the columns belonging to any one of the tables are selected as the group keys, and the group keys and the join keys do not match each other when the aggregation is performed with the columns belonging to the other table; and

    wherein the first aggregation join is configured to;

    designate the rows having the same join key as one group to produce each structure to store the aggregation for each designated group; and

    calculate an aggregation value for the aggregation structure of the join key group relevant to the join key while searching the aggregation table in a way of calculating each join key group once only even though each join key group has several rows.

View all claims
  • 3 Assignments
Timeline View
Assignment View
    ×
    ×