[go: up one dir, main page]

US20120109992A1 - Query Rewrite With Auxiliary Attributes In Query Processing Operations - Google Patents

Query Rewrite With Auxiliary Attributes In Query Processing Operations Download PDF

Info

Publication number
US20120109992A1
US20120109992A1 US13/346,366 US201213346366A US2012109992A1 US 20120109992 A1 US20120109992 A1 US 20120109992A1 US 201213346366 A US201213346366 A US 201213346366A US 2012109992 A1 US2012109992 A1 US 2012109992A1
Authority
US
United States
Prior art keywords
query
attributes
data set
auxiliary
auxiliary attributes
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Abandoned
Application number
US13/346,366
Inventor
Yuan-Chi Chang
Matthew L. Hill
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
International Business Machines Corp
Original Assignee
International Business Machines Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by International Business Machines Corp filed Critical International Business Machines Corp
Priority to US13/346,366 priority Critical patent/US20120109992A1/en
Publication of US20120109992A1 publication Critical patent/US20120109992A1/en
Abandoned legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99931Database or file accessing
    • Y10S707/99932Access augmentation or optimizing
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99931Database or file accessing
    • Y10S707/99933Query processing, i.e. searching
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99931Database or file accessing
    • Y10S707/99933Query processing, i.e. searching
    • Y10S707/99934Query formulation, input preparation, or translation
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10TECHNICAL SUBJECTS COVERED BY FORMER USPC
    • Y10STECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y10S707/00Data processing: database and file management or data structures
    • Y10S707/99931Database or file accessing
    • Y10S707/99933Query processing, i.e. searching
    • Y10S707/99935Query augmenting and refining, e.g. inexact access

Definitions

  • the field is related to query processing operations in databases and other information systems and, more particularly, to rewriting queries during database query processing operations.
  • Database query processing operations typically consist of six phases: parsing, semantic checking, query rewrite, plan optimization, plan refinement, and query evaluation.
  • the reasons for rewriting a query in query processing operations have been described in several references, see, e.g., L. M. Haas et al., “Extensible Query Processing in Starburst,” ACM SIGMOD Record, Volume 18 Issue 2, June 1989.
  • Some reasons for query rewrite include:
  • Embodiments of the invention provide techniques for rewriting queries during query processing operations.
  • a technique for rewriting a query during a database query processing operation includes the following steps. First, the query is processed in accordance with at least a portion of a data set, producing query results. Second, data attributes from the query results are analyzed. Finally, a new predicate from a data attribute is appended on the query. Thus, advantageously a new predicate relating to a data attribute not included in the original query may be appended on the query, thus improving processing efficiency.
  • principles of the invention may advocate a query rewrite strategy to append new predicates based on attributes absent from the original query; (ii) may employ a two-pass query processing operation approach as opposed to the prevalent single-pass processing; (iii) may employ statistical analysis and other data mining techniques to help identify distinguishing attributes; and (iv) may have false dismissals due to query rewrite, while traditional methodologies emphasize exact answers.
  • embodiments of the invention propose at least one additional reason for query rewrite that is distinct from traditional query normalization approaches. This distinct reason is to leverage the knowledge about auxiliary attributes in data records to append additional query predicates for more efficient processing.
  • the inventive technique may be useful for providing efficient query processing operations in large databases, while maintaining the accuracy of results. This efficiency translates a normally high processing cost query into a low cost query.
  • FIG. 1 is a table illustrating electricity usage data stored in a database, for use in explaining distinctions between embodiments of the invention and traditional methodologies;
  • FIG. 2 is a flow diagram illustrating a first pass query execution methodology, according to an embodiment of the present invention
  • FIG. 3 is a flow diagram illustrating a data sampling methodology, according to an embodiment of the present invention.
  • FIG. 4 is a flow diagram illustrating a selective attribute selection methodology, according to an embodiment of the present invention.
  • FIG. 5 is a flow diagram illustrating a query rewrite methodology, according to an embodiment of the present invention.
  • FIG. 6 is a diagram illustrating an illustrative hardware implementation of a computing system in accordance with which one or more components/methodologies of the present invention may be implemented, according to an embodiment of the present invention.
  • database is intended to include any data storage software and systems, such as, for example, a relational database like IBM DB2 and Oracle 9.
  • data record is intended to include any logical structured association of data in a database, such as, for example, a row in a table of a relational database.
  • attribute and “data attribute,” as used herein, are intended to include any element of a data record, such as, for example, a column value of a row.
  • target attribute is intended to refer to any attribute that explicitly appears in a user query.
  • auxiliary attribute is intended to refer to any attribute that is missing from a user query.
  • Principles of the invention are applicable to query processing operations on a database or other information system that stores structured data records with one or more attributes.
  • a database table For ease of illustration and description, an example based on query processing operations on a database table is used in the preferred embodiment of the present invention.
  • the present invention should not be viewed as limited or constrained to processing on database tables.
  • a table illustrates electricity usage data stored in a database, for use in explaining distinctions between the principles of the invention and traditional methodologies.
  • the table has four attribute labels in its header row; reporting date 100 , Westchester electricity usage 102 , New York City electricity usage 104 , and temperature 106 .
  • An exemplary query 108 asks for dates having a total daily electricity usage above 3000 MegaWatt for these two geographic areas. In this instance, the total daily electricity usage is computed by adding the daily electricity usage of New York City (NYC) to the daily electricity usage of Westchester County, N.Y.
  • the query statement has a single predicate regarding the sum of the values for Westchester electricity usage 102 and NYC electricity usage 104 being greater than 3000 MW for a reporting date 100 .
  • the query rewrite methodology proposed in the present invention includes two passes.
  • the first pass discovers attributes that have a high selectivity from an analysis of query results from sampled data.
  • the second pass selects top-ranked auxiliary attributes and appends new predicates relating to the selected attributes to the original query for improved query efficiency.
  • FIG. 2 a flow diagram illustrates a first pass query execution methodology, according to an embodiment of the present invention.
  • the methodology begins by inputting a user query 200 .
  • a traditional, unmodified query processing operation is first used to execute user query 200 on sampled data 204 from a dataset in step 202 .
  • Results of user query 200 are returned as selected data records 206 .
  • Statistics for each attribute value of selected data records 206 are extracted in step 208 .
  • Statistics for identical attributes are collected and extracted from sampled data 204 in step 210 .
  • the sets of statistics from steps 208 and 210 are evaluated in step 212 . This evaluation is described in further detail in FIG. 4 .
  • typical statistics extracted in steps 208 and 210 may include a maximum, a minimum, a median, an average, and a standard deviation.
  • the extracted statistics in steps 208 and 210 may include the number of distinct values and the aggregated counts for each value. Higher order statistics involving joint statistics of two or more attributes can also be extracted.
  • the present invention applies the maximum and minimum values of numerical attributes but its scope is not limited to the aforementioned statistics.
  • FIG. 3 a flow diagram illustrates a data sampling methodology, according to an embodiment of the present invention. This can be considered a detailed description of the acquisition of sampled data 204 in FIG. 2 .
  • This methodology reduces the number of data records for the first-pass query processing operation of FIG. 2 . Every Nth record of a full data set 300 is sampled in step 302 resulting in a sampled data set 304 . N is typically in the range of 10 to 100. The resulting records of sampled data set 304 are stored in a smaller temporary database.
  • each numerical attribute, input in step 400 is examined by comparing the dynamic ranges of attribute statistics from sampled data to attribute statistics from query results. Both target and auxiliary attributes are examined.
  • the dynamic range of an attribute may be defined as the difference between the maximum and minimum values.
  • Step 402 computes a ratio R for the two dynamic ranges.
  • step 404 it is determined whether R is smaller than 10%. If R is smaller than 10% the attribute is selective 408 . Otherwise, the attribute is non-selective 406 .
  • the threshold for R is preferably at or below 10%.
  • a flow diagram illustrates a query rewrite methodology and second query pass, according to an embodiment of the present invention.
  • the methodology begins at step 500 where the relative selectivity for each selective attribute is evaluated. These selective attributes 408 were discovered in step 404 of FIG. 4 .
  • the second query pass begins by selecting high selectivity attributes in step 502 . There may be multiple selective attributes, which are ranked in ascending order by the value of R. A small R value is preferred because it indicates higher selectivity and higher efficiency. Depending on specific query scenarios, one or more top-ranked attributes are selected. Range predicates are then formed in step 504 . The dynamic ranges of selected attributes from query results form new range predicates by bounding the minimum and maximum values. For example, the temperature attribute in FIG.
  • the range predicate of temperature becomes [91, 95].
  • User query 508 is then appended with new range (temperature) predicates in step 506 .
  • the newly appended query 510 is then passed to the traditional query processing operation and optimization, which will use the newly appended, highly selective predicates to reduce the processing time.
  • the appended query may not yield the same set of results as the original query. This is because the sampling step in FIG. 3 may miss outliers in the data records which are not included in the attribute selection and predicate construction.
  • an appended query and its original query yield identical results in many practical applications, such as in the electricity usage query example. The samples in those applications usually have less noise and smoother variations.
  • FIG. 6 a block diagram illustrates an illustrative hardware implementation of a computing system in accordance with which one or more components/methodologies of the invention (e.g., components/methodologies described in the context of FIGS. 1 through 5 ) may be implemented, according to an embodiment of the present invention.
  • a computing system in FIG. 6 may implement a database and process user query 204 of FIG. 2 .
  • Such individual components/methodologies may be implemented and processed on one such computer system, or on more than one such computer system.
  • user query 204 may be processed on one computer system (e.g., client device), while the database may be implemented on another computer system.
  • client device e.g., client device
  • the individual computer systems and/or devices may be connected via a suitable network, e.g., the Internet or World Wide Web.
  • the system may be realized via private or local networks. The invention is not limited to any particular network.
  • the computer system may be implemented in accordance with a processor 610 , a memory 612 , I/O devices 614 , and a network interface 616 , coupled viaa computer bus 618 or alternate connection arrangement.
  • processor as used herein is intended to include any processing device, such as, for example, one that includes a CPU (central processing unit) and/or other processing circuitry. It is also to be understood that the term “processor” may refer to more than one processing device and that various elements associated with a processing device may be shared by other processing devices.
  • memory as used herein is intended to include memory associated with a processor or CPU, such as, for example, RAM, ROM, a fixed memory device (e.g., hard drive), a removable memory device (e.g., diskette), flash memory, etc.
  • input/output devices or “I/O devices” as used herein is intended to include, for example, one or more input devices (e.g., keyboard, mouse, etc.) for entering data to the processing unit, and/or one or more output devices (e.g., speaker, display, etc.) for presenting results associated with the processing unit.
  • input devices e.g., keyboard, mouse, etc.
  • output devices e.g., speaker, display, etc.
  • network interface as used herein is intended to include, for example, one or more transceivers to permit the computer system to communicate with another computer system via an appropriate communications protocol (e.g., HTTP/S).
  • software components including instructions or code for performing the methodologies described herein may be stored in one or more of the associated memory devices (e.g., ROM, fixed or removable memory) and, when ready to be utilized, loaded in part or in whole (e.g., into RAM) and executed by a CPU.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

Techniques are provided for rewriting queries during a database query processing operation to include auxiliary attributes not included in the original query, thus improving processing efficiency. For example, a technique for rewriting a query in a query processing operation includes the following steps. The query is processed in accordance with at least a portion of a data set, producing query results. Data attributes from the query results are analyzed. At least one new predicate from at least one auxiliary data attribute is appended on the query.

Description

    CROSS-REFERENCE TO RELATED APPLICATION(S)
  • This application is a continuation of U.S. application Ser. No. 11/852,705, filed on Sep. 10, 2007, which is a continuation of U.S. application Ser. No. 10/668,549, filed on Sep. 23, 2003 now issued as U.S. Pat. No. 7,587,394, the disclosures of which are incorporated herein by reference.
  • FIELD
  • The field is related to query processing operations in databases and other information systems and, more particularly, to rewriting queries during database query processing operations.
  • BACKGROUND
  • Due to an increase in the amount of online business transactions, efficiency in the query processing of large amounts of data stored in databases, data warehouses, and other information systems, has become increasingly important. Since the late 1970s, research and development activities have persisted throughout academia and industry in studying efficient query processing operations in standalone databases, distributed databases, hierarchical databases, spatial databases, and databases on the World Wide Web. Comprehensive reviews of reported query processing techniques have been provided in several sources, see, e.g., G. Graefe, “Query Evaluation Techniques for Large Databases,” ACM Computing Surveys, Volume 25 Issue 2, June 1993; and D. Kossmann, “The State of the Art in Distributed Query Processing,” ACM Computing Surveys, Volume 32 Issue 4, December 2000.
  • Database query processing operations typically consist of six phases: parsing, semantic checking, query rewrite, plan optimization, plan refinement, and query evaluation. The reasons for rewriting a query in query processing operations have been described in several references, see, e.g., L. M. Haas et al., “Extensible Query Processing in Starburst,” ACM SIGMOD Record, Volume 18 Issue 2, June 1989. Some reasons for query rewrite include:
  • 1. Alternative phrasing of a query: Since relational query languages are nonprocedural, the alternatives perform equivalently; and
  • 2. Involvement of view abstractions in a query: Since view definitions are hidden from the query writer, a query involving views can only be expanded by the database.
  • Traditional query rewrite strategies focus on rewrite and optimization for attributes that appear in query predicates, see, e.g., G. Graefe et al., “Dynamic Query Evaluation Plans,” ACM SIGMOD Record, Volume 18 Issue 2, June 1989; and D. Kossmann et al., “Iterative Dynamic Programming: A New Class of Query Optimization Algorithms,” ACM Transactions on Database Systems, Volume 25 Issue 1, March 2000.
  • SUMMARY
  • Embodiments of the invention provide techniques for rewriting queries during query processing operations.
  • For example, in one embodiment of the invention, a technique for rewriting a query during a database query processing operation includes the following steps. First, the query is processed in accordance with at least a portion of a data set, producing query results. Second, data attributes from the query results are analyzed. Finally, a new predicate from a data attribute is appended on the query. Thus, advantageously a new predicate relating to a data attribute not included in the original query may be appended on the query, thus improving processing efficiency.
  • Several major differences exist between the principles of the invention and traditional methodologies. For example, principles of the invention: (i) may advocate a query rewrite strategy to append new predicates based on attributes absent from the original query; (ii) may employ a two-pass query processing operation approach as opposed to the prevalent single-pass processing; (iii) may employ statistical analysis and other data mining techniques to help identify distinguishing attributes; and (iv) may have false dismissals due to query rewrite, while traditional methodologies emphasize exact answers.
  • Thus, embodiments of the invention propose at least one additional reason for query rewrite that is distinct from traditional query normalization approaches. This distinct reason is to leverage the knowledge about auxiliary attributes in data records to append additional query predicates for more efficient processing. Advantageously, the inventive technique may be useful for providing efficient query processing operations in large databases, while maintaining the accuracy of results. This efficiency translates a normally high processing cost query into a low cost query.
  • These and other objects, features, and advantages will become apparent from the following detailed description of illustrative embodiments thereof, which is to be read in connection with the accompanying drawings.
  • BRIEF DESCRIPTION OF THE DRAWINGS
  • FIG. 1 is a table illustrating electricity usage data stored in a database, for use in explaining distinctions between embodiments of the invention and traditional methodologies;
  • FIG. 2 is a flow diagram illustrating a first pass query execution methodology, according to an embodiment of the present invention;
  • FIG. 3 is a flow diagram illustrating a data sampling methodology, according to an embodiment of the present invention;
  • FIG. 4 is a flow diagram illustrating a selective attribute selection methodology, according to an embodiment of the present invention;
  • FIG. 5 is a flow diagram illustrating a query rewrite methodology, according to an embodiment of the present invention; and
  • FIG. 6 is a diagram illustrating an illustrative hardware implementation of a computing system in accordance with which one or more components/methodologies of the present invention may be implemented, according to an embodiment of the present invention.
  • DETAILED DESCRIPTION
  • The following description will illustrate principles of the invention using an exemplary data processing system architecture. Principles of the invention are not limited to use with any particular system architecture. Instead it is more generally applicable to any data processing system in which it is desirable to perform efficient and effective query processing operations.
  • The term “database,” as used herein, is intended to include any data storage software and systems, such as, for example, a relational database like IBM DB2 and Oracle 9. The term “data record,” as used herein, is intended to include any logical structured association of data in a database, such as, for example, a row in a table of a relational database. The terms “attribute” and “data attribute,” as used herein, are intended to include any element of a data record, such as, for example, a column value of a row. The term “target attribute,” as used herein, is intended to refer to any attribute that explicitly appears in a user query. The term “auxiliary attribute,” as used herein, is intended to refer to any attribute that is missing from a user query.
  • Principles of the invention are applicable to query processing operations on a database or other information system that stores structured data records with one or more attributes. For ease of illustration and description, an example based on query processing operations on a database table is used in the preferred embodiment of the present invention. The present invention should not be viewed as limited or constrained to processing on database tables.
  • Referring initially to FIG. 1, a table illustrates electricity usage data stored in a database, for use in explaining distinctions between the principles of the invention and traditional methodologies. The table has four attribute labels in its header row; reporting date 100, Westchester electricity usage 102, New York City electricity usage 104, and temperature 106. An exemplary query 108 asks for dates having a total daily electricity usage above 3000 MegaWatt for these two geographic areas. In this instance, the total daily electricity usage is computed by adding the daily electricity usage of New York City (NYC) to the daily electricity usage of Westchester County, N.Y. Thus, the query statement has a single predicate regarding the sum of the values for Westchester electricity usage 102 and NYC electricity usage 104 being greater than 3000 MW for a reporting date 100.
  • Traditional query rewrite focuses on attribute columns, such as reporting date 100, Westchester electricity usage 102, and NYC electricity usage 104. However, through the analysis of attribute value distributions, it may be discovered that the total electricity usage is above 3000 MW only when the outdoor temperature is above 90 EF. The temperature attribute, which is not specified in the original query, is auxiliary, but can significantly reduce query processing time by adding an additional predicate to the query. It would thus be beneficial to include the temperature predicate at the query rewrite phase. However, traditional query rewrite strategies have not included predicates on auxiliary attributes as proposed by principles of the invention.
  • The query rewrite methodology proposed in the present invention includes two passes. The first pass discovers attributes that have a high selectivity from an analysis of query results from sampled data. The second pass selects top-ranked auxiliary attributes and appends new predicates relating to the selected attributes to the original query for improved query efficiency.
  • Referring now to FIG. 2, a flow diagram illustrates a first pass query execution methodology, according to an embodiment of the present invention. The methodology begins by inputting a user query 200. A traditional, unmodified query processing operation is first used to execute user query 200 on sampled data 204 from a dataset in step 202. Results of user query 200 are returned as selected data records 206. Statistics for each attribute value of selected data records 206 are extracted in step 208. Separately, statistics for identical attributes are collected and extracted from sampled data 204 in step 210. The sets of statistics from steps 208 and 210, are evaluated in step 212. This evaluation is described in further detail in FIG. 4.
  • In accordance with principles of the invention, for numerical attributes, typical statistics extracted in steps 208 and 210 may include a maximum, a minimum, a median, an average, and a standard deviation. For categorical attributes, the extracted statistics in steps 208 and 210 may include the number of distinct values and the aggregated counts for each value. Higher order statistics involving joint statistics of two or more attributes can also be extracted. In this embodiment, the present invention applies the maximum and minimum values of numerical attributes but its scope is not limited to the aforementioned statistics.
  • Referring now to FIG. 3, a flow diagram illustrates a data sampling methodology, according to an embodiment of the present invention. This can be considered a detailed description of the acquisition of sampled data 204 in FIG. 2. This methodology reduces the number of data records for the first-pass query processing operation of FIG. 2. Every Nth record of a full data set 300 is sampled in step 302 resulting in a sampled data set 304. N is typically in the range of 10 to 100. The resulting records of sampled data set 304 are stored in a smaller temporary database.
  • Referring now to FIG. 4, a flow diagram illustrates a selective attribute selection methodology, according to an embodiment of the present invention. This methodology may be considered a detailed description of step 212 in FIG. 2. The methodology illustrates a preferred evaluation method to identify selective attributes. However, principles of the invention are not limited to this particular evaluation and is applicable to other evaluation criteria. In FIG. 4, each numerical attribute, input in step 400, is examined by comparing the dynamic ranges of attribute statistics from sampled data to attribute statistics from query results. Both target and auxiliary attributes are examined. The dynamic range of an attribute may be defined as the difference between the maximum and minimum values. Step 402 computes a ratio R for the two dynamic ranges. In step 404, it is determined whether R is smaller than 10%. If R is smaller than 10% the attribute is selective 408. Otherwise, the attribute is non-selective 406. The threshold for R is preferably at or below 10%.
  • Referring now to FIG. 5, a flow diagram illustrates a query rewrite methodology and second query pass, according to an embodiment of the present invention. The methodology begins at step 500 where the relative selectivity for each selective attribute is evaluated. These selective attributes 408 were discovered in step 404 of FIG. 4. The second query pass begins by selecting high selectivity attributes in step 502. There may be multiple selective attributes, which are ranked in ascending order by the value of R. A small R value is preferred because it indicates higher selectivity and higher efficiency. Depending on specific query scenarios, one or more top-ranked attributes are selected. Range predicates are then formed in step 504. The dynamic ranges of selected attributes from query results form new range predicates by bounding the minimum and maximum values. For example, the temperature attribute in FIG. 1 has a maximum value 95 and a minimum value 91 for dates whose total electric usage is above 3000 MW. The range predicate of temperature becomes [91, 95]. User query 508 is then appended with new range (temperature) predicates in step 506. The methodology terminates with the resulting modified query 510, such as, for example, “Select date from table where Westchester+NewYorkCity >3000 AND temperature <=95 and temperature >=91.” The newly appended query 510 is then passed to the traditional query processing operation and optimization, which will use the newly appended, highly selective predicates to reduce the processing time.
  • In accordance with the present invention, the appended query may not yield the same set of results as the original query. This is because the sampling step in FIG. 3 may miss outliers in the data records which are not included in the attribute selection and predicate construction. However, an appended query and its original query yield identical results in many practical applications, such as in the electricity usage query example. The samples in those applications usually have less noise and smoother variations.
  • Referring now to FIG. 6, a block diagram illustrates an illustrative hardware implementation of a computing system in accordance with which one or more components/methodologies of the invention (e.g., components/methodologies described in the context of FIGS. 1 through 5) may be implemented, according to an embodiment of the present invention. For instance, such a computing system in FIG. 6 may implement a database and process user query 204 of FIG. 2.
  • It is to be understood that such individual components/methodologies may be implemented and processed on one such computer system, or on more than one such computer system. For instance, user query 204 may be processed on one computer system (e.g., client device), while the database may be implemented on another computer system. In the case of an implementation in a distributed computing system, the individual computer systems and/or devices may be connected via a suitable network, e.g., the Internet or World Wide Web. However, the system may be realized via private or local networks. The invention is not limited to any particular network.
  • As shown, the computer system may be implemented in accordance with a processor 610, a memory 612, I/O devices 614, and a network interface 616, coupled viaa computer bus 618 or alternate connection arrangement.
  • It is to be appreciated that the term “processor” as used herein is intended to include any processing device, such as, for example, one that includes a CPU (central processing unit) and/or other processing circuitry. It is also to be understood that the term “processor” may refer to more than one processing device and that various elements associated with a processing device may be shared by other processing devices.
  • The term “memory” as used herein is intended to include memory associated with a processor or CPU, such as, for example, RAM, ROM, a fixed memory device (e.g., hard drive), a removable memory device (e.g., diskette), flash memory, etc.
  • In addition, the phrase “input/output devices” or “I/O devices” as used herein is intended to include, for example, one or more input devices (e.g., keyboard, mouse, etc.) for entering data to the processing unit, and/or one or more output devices (e.g., speaker, display, etc.) for presenting results associated with the processing unit.
  • Still further, the phrase “network interface” as used herein is intended to include, for example, one or more transceivers to permit the computer system to communicate with another computer system via an appropriate communications protocol (e.g., HTTP/S). Accordingly, software components including instructions or code for performing the methodologies described herein may be stored in one or more of the associated memory devices (e.g., ROM, fixed or removable memory) and, when ready to be utilized, loaded in part or in whole (e.g., into RAM) and executed by a CPU.
  • Although illustrative embodiments of the present invention have been described herein with reference to the accompanying drawings, the invention is not limited to those precise embodiments, and that various other changes and modifications may be made by one skilled in the art without departing from the scope or spirit of the invention.

Claims (20)

1. Apparatus for rewriting a query during a database query processing operation, comprising:
a memory; and
at least one processor coupled to the memory and operative to: (i) produce query results comprising one or more target attributes and one or more auxiliary attributes by executing the query on at least a portion of a data set, wherein the one or more target attributes are included in the query and the one or more auxiliary attributes are not included in the query; (ii) determine a relative selectivity for the one or more auxiliary attributes by comparing the query results to at least the portion of the data set from which the query results were produced; and (iii) append the query with at least one new predicate corresponding to at least one of the one or more auxiliary attributes having a high relative selectivity to form a rewritten query.
2. The apparatus of claim 1, wherein the query results are produced by executing the query on records sampled from the data set.
3. The apparatus of claim 2, wherein the processor is further operative to sample the records from the data set.
4. The apparatus of claim 3, wherein the operation of sampling the records comprises sampling every Nth record from the data set, wherein N is a positive integer greater than or equal to two.
5. The apparatus of claim 2, wherein the at least one processor is further operative to execute the rewritten query on the data set from which the records were sampled.
6. The apparatus of claim 1, wherein the operation of comparing the query results to at least the portion of the data set comprises:
extracting statistics for the one or more auxiliary attributes from the query results;
extracting statistics for the one or more auxiliary attributes from at least the portion of the data set; and
evaluating the relative selectivity for the one or more auxiliary attributes by comparing the extracted statistics from the query results to the extracted statistics from at least the portion of the data set.
7. The apparatus of claim 1, wherein the operation of determining the relative selectivity comprises:
comparing a range of values in the query results for a given one of the one or more auxiliary attributes to a range of values in at least the portion of the data set for the given one of the one or more auxiliary attributes.
8. The apparatus of claim 7, wherein the operation of determining the relative selectivity further comprises comparing a ratio of the ranges to a predetermined value.
9. The apparatus of claim 1, wherein the operation of appending the query with at least one new predicate comprises:
selecting at least one auxiliary data attribute with a high relative selectivity;
forming at least one new predicate corresponding to the selected at least one auxiliary attribute; and
appending the query with the at least one new predicate.
10. The apparatus of claim 1, wherein the at least one processor is further operative to execute the rewritten query on the data set.
11. The apparatus of claim 1, wherein the operation of appending the query with at least one new predicate comprises:
selecting the at least one of the one or more auxiliary attributes based at least in part on a ranking of the determined relative selectivity for the one or more auxiliary attributes; and
appending the query with at least one new predicate corresponding to the selected at least one of the one or more auxiliary attributes to form the rewritten query.
12. A method for rewriting a query during a database query processing operation, comprising the steps of:
producing query results comprising one or more target attributes and one or more auxiliary attributes by executing the query on at least a portion of a data set, wherein the one or more target attributes are included in the query and the one or more auxiliary attributes are not included in the query;
determining a relative selectivity for the one or more attributes by comparing the query results to at least the portion of the data set from which the query results were produced; and
appending the query with at least one new predicate corresponding to at least one of the one or more auxiliary attributes having a high relative selectivity to form a rewritten query.
13. The method of claim 12, wherein the query results are produced by executing the query on records sampled from the data set.
14. The method of claim 13, further comprising the step of sampling the records from the data set.
15. The method of claim 14, wherein the step of sampling the records comprises sampling every Nth record from the data set, wherein N is a positive integer greater than or equal to two.
16. The method of claim 12, wherein the step of comparing the query results to at least the portion of the data set comprises:
extracting statistics for the one or more auxiliary attributes from the query results;
extracting statistics for the one or more auxiliary attributes from at least the portion of the data set; and
evaluating the relative selectivity for the one or more auxiliary attributes by comparing the extracted statistics from the query results to the extracted statistics from at least the portion of the data set.
17. The method of claim 12, wherein the step of determining the relative selectivity comprises:
comparing a range of values in the query results for a given one of the one or more auxiliary attributes to a range of values in at least the portion of the data set for the given one of the one or more auxiliary attributes; and
comparing a ratio of the ranges to a predetermined value.
18. The method of claim 12, further comprising the step of executing the rewritten query on the data set.
19. The method of claim 12, wherein the step of appending the query with at least one new predicate comprises:
selecting at least one of the one or more auxiliary attributes based at least in part on a ranking of the determined relative selectivity for the one or more auxiliary attributes; and
appending the query with at least one new predicate corresponding to the selected at least one of the one or more auxiliary attributes to form the rewritten query.
20. An article of manufacture for rewriting a query during a database query processing operation; comprising a machine readable storage medium containing one or more programs which when executed implement the steps of:
producing query results comprising one or more target attributes and one or more auxiliary attributes by executing the query on at least a portion of the data set, wherein the one or more target attributes are included in the query and the one or more auxiliary attributes are not included in the query;
determining a relative selectivity for the one or more auxiliary attributes by comparing the query results to at least the portion of the data set from which the query results were produced; and
appending the query with at least one new predicate corresponding to at least one of the one or more auxiliary attributes having a high relative selectivity to form a rewritten query.
US13/346,366 2003-09-23 2012-01-09 Query Rewrite With Auxiliary Attributes In Query Processing Operations Abandoned US20120109992A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
US13/346,366 US20120109992A1 (en) 2003-09-23 2012-01-09 Query Rewrite With Auxiliary Attributes In Query Processing Operations

Applications Claiming Priority (3)

Application Number Priority Date Filing Date Title
US10/668,549 US7587394B2 (en) 2003-09-23 2003-09-23 Methods and apparatus for query rewrite with auxiliary attributes in query processing operations
US11/852,705 US8122046B2 (en) 2003-09-23 2007-09-10 Method and apparatus for query rewrite with auxiliary attributes in query processing operations
US13/346,366 US20120109992A1 (en) 2003-09-23 2012-01-09 Query Rewrite With Auxiliary Attributes In Query Processing Operations

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
US11/852,705 Continuation US8122046B2 (en) 2003-09-23 2007-09-10 Method and apparatus for query rewrite with auxiliary attributes in query processing operations

Publications (1)

Publication Number Publication Date
US20120109992A1 true US20120109992A1 (en) 2012-05-03

Family

ID=34313512

Family Applications (3)

Application Number Title Priority Date Filing Date
US10/668,549 Expired - Fee Related US7587394B2 (en) 2003-09-23 2003-09-23 Methods and apparatus for query rewrite with auxiliary attributes in query processing operations
US11/852,705 Expired - Fee Related US8122046B2 (en) 2003-09-23 2007-09-10 Method and apparatus for query rewrite with auxiliary attributes in query processing operations
US13/346,366 Abandoned US20120109992A1 (en) 2003-09-23 2012-01-09 Query Rewrite With Auxiliary Attributes In Query Processing Operations

Family Applications Before (2)

Application Number Title Priority Date Filing Date
US10/668,549 Expired - Fee Related US7587394B2 (en) 2003-09-23 2003-09-23 Methods and apparatus for query rewrite with auxiliary attributes in query processing operations
US11/852,705 Expired - Fee Related US8122046B2 (en) 2003-09-23 2007-09-10 Method and apparatus for query rewrite with auxiliary attributes in query processing operations

Country Status (4)

Country Link
US (3) US7587394B2 (en)
JP (1) JP4114653B2 (en)
CN (2) CN1601529A (en)
TW (1) TWI351618B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8965915B2 (en) * 2013-03-17 2015-02-24 Alation, Inc. Assisted query formation, validation, and result previewing in a database having a complex schema

Families Citing this family (21)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
AU2004275334B9 (en) 2003-09-15 2011-06-16 Ab Initio Technology Llc. Data Profiling
US20060235819A1 (en) * 2005-04-14 2006-10-19 International Business Machines Corporation Apparatus and method for reducing data returned for a database query using select list processing
CN100397396C (en) * 2005-10-31 2008-06-25 北京神舟航天软件技术有限公司 Query plan caching method and system based on predicate key analysis
US8694527B2 (en) * 2010-06-30 2014-04-08 International Business Machines Corporation Simplified query generation from prior query results
CN103348598B (en) 2011-01-28 2017-07-14 起元科技有限公司 Generate data pattern information
JP5844824B2 (en) * 2012-01-25 2016-01-20 株式会社日立製作所 SPARQL query optimization method
WO2014065917A1 (en) 2012-10-22 2014-05-01 Ab Initio Technology Llc Profiling data with source tracking
US9892026B2 (en) 2013-02-01 2018-02-13 Ab Initio Technology Llc Data records selection
US10255318B2 (en) * 2013-02-25 2019-04-09 Facebook, Inc. Sampling a set of data
US8751486B1 (en) 2013-07-31 2014-06-10 Splunk Inc. Executing structured queries on unstructured data
US11487732B2 (en) 2014-01-16 2022-11-01 Ab Initio Technology Llc Database key identification
EP3594821B1 (en) 2014-03-07 2023-08-16 AB Initio Technology LLC Managing data profiling operations related to data type
CN106462583B (en) 2014-03-10 2020-03-24 因特拉纳公司 System and method for rapid data analysis
US20160019316A1 (en) * 2014-07-21 2016-01-21 Splunk Inc. Wizard for creating a correlation search
US10452721B2 (en) 2014-08-22 2019-10-22 Hitachi, Ltd. Autopoietic information processing system and method
US10296507B2 (en) 2015-02-12 2019-05-21 Interana, Inc. Methods for enhancing rapid data analysis
US10423387B2 (en) 2016-08-23 2019-09-24 Interana, Inc. Methods for highly efficient data sharding
US10146835B2 (en) * 2016-08-23 2018-12-04 Interana, Inc. Methods for stratified sampling-based query execution
US9996293B1 (en) 2016-12-12 2018-06-12 International Business Machines Corporation Dynamic management of memory allocation in a database
US11068540B2 (en) 2018-01-25 2021-07-20 Ab Initio Technology Llc Techniques for integrating validation results in data profiling and related systems and methods
CN118260395A (en) * 2024-03-27 2024-06-28 维沃移动通信有限公司 Model adjustment method and device

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3408291A (en) * 1960-10-21 1968-10-29 Phrix Werke Ag Method of separating cations from solutions containing the same
US6338055B1 (en) * 1998-12-07 2002-01-08 Vitria Technology, Inc. Real-time query optimization in a decision support system
US20020078025A1 (en) * 2000-10-31 2002-06-20 Seiko Epson Corporation Systems and methods for information searching
US6931392B1 (en) * 1998-12-07 2005-08-16 Vitria Technology, Inc. Real-time decision support system

Family Cites Families (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6581056B1 (en) * 1996-06-27 2003-06-17 Xerox Corporation Information retrieval system providing secondary content analysis on collections of information objects
US5842202A (en) * 1996-11-27 1998-11-24 Massachusetts Institute Of Technology Systems and methods for data quality management
US5890150A (en) * 1997-01-24 1999-03-30 Hitachi, Ltd. Random sampling method for use in a database processing system and a database processing system based thereon
JPH10269248A (en) 1997-01-24 1998-10-09 Hitachi Ltd Method for randomly extracting data in database processing system and database processing system based on the method
US6006225A (en) * 1998-06-15 1999-12-21 Amazon.Com Refining search queries by the suggestion of correlated terms from prior searches
US6446061B1 (en) * 1998-07-31 2002-09-03 International Business Machines Corporation Taxonomy generation for document collections
US6560593B1 (en) * 1999-07-20 2003-05-06 Computer Associates Think, Inc. Method and apparatus for viewing the effect of changes to an index for a database table on an optimization plan for a database query
US20030167259A1 (en) * 2000-05-01 2003-09-04 Mike Casson Interactive sales and marketing network system
KR20030047889A (en) * 2000-05-26 2003-06-18 컴퓨터 어소시에이츠 싱크, 인코포레이티드 System and method for automatically generating database queries
US7003513B2 (en) * 2000-07-04 2006-02-21 International Business Machines Corporation Method and system of weighted context feedback for result improvement in information retrieval
US6519604B1 (en) * 2000-07-19 2003-02-11 Lucent Technologies Inc. Approximate querying method for databases with multiple grouping attributes
US6701311B2 (en) * 2001-02-07 2004-03-02 International Business Machines Corporation Customer self service system for resource search and selection
US6884946B2 (en) * 2002-03-05 2005-04-26 Premark Feg L.L.C. Scale for weighing and determining a price of an item
US6941297B2 (en) * 2002-07-31 2005-09-06 International Business Machines Corporation Automatic query refinement

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US3408291A (en) * 1960-10-21 1968-10-29 Phrix Werke Ag Method of separating cations from solutions containing the same
US6338055B1 (en) * 1998-12-07 2002-01-08 Vitria Technology, Inc. Real-time query optimization in a decision support system
US6931392B1 (en) * 1998-12-07 2005-08-16 Vitria Technology, Inc. Real-time decision support system
US20020078025A1 (en) * 2000-10-31 2002-06-20 Seiko Epson Corporation Systems and methods for information searching

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
Qingchun Ren; "A Quality-Guanranteed and Energy-Efficient Query Processing Algorithm for Sensor Networks"; 2006, IEEE; 6 pages. *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8965915B2 (en) * 2013-03-17 2015-02-24 Alation, Inc. Assisted query formation, validation, and result previewing in a database having a complex schema
US8996559B2 (en) * 2013-03-17 2015-03-31 Alation, Inc. Assisted query formation, validation, and result previewing in a database having a complex schema
US9244952B2 (en) 2013-03-17 2016-01-26 Alation, Inc. Editable and searchable markup pages automatically populated through user query monitoring

Also Published As

Publication number Publication date
US20070299832A1 (en) 2007-12-27
TWI351618B (en) 2011-11-01
US20050065914A1 (en) 2005-03-24
TW200517887A (en) 2005-06-01
CN1323366C (en) 2007-06-27
US7587394B2 (en) 2009-09-08
JP4114653B2 (en) 2008-07-09
JP2005100392A (en) 2005-04-14
CN1601530A (en) 2005-03-30
US8122046B2 (en) 2012-02-21
CN1601529A (en) 2005-03-30

Similar Documents

Publication Publication Date Title
US8122046B2 (en) Method and apparatus for query rewrite with auxiliary attributes in query processing operations
US6032146A (en) Dimension reduction for data mining application
US6134555A (en) Dimension reduction using association rules for data mining application
US7530012B2 (en) Incorporation of spreadsheet formulas of multi-dimensional cube data into a multi-dimensional cube
US7647293B2 (en) Detecting correlation from data
US6996554B2 (en) Database processor
US6965891B1 (en) Method and mechanism for partition pruning
US7930296B2 (en) Building database statistics across a join network using skew values
US7610264B2 (en) Method and system for providing a learning optimizer for federated database systems
US6931390B1 (en) Method and mechanism for database partitioning
US7987178B2 (en) Automatically determining optimization frequencies of queries with parameter markers
US8886617B2 (en) Query-based searching using a virtual table
US20040249810A1 (en) Small group sampling of data for use in query processing
US8688682B2 (en) Query expression evaluation using sample based projected selectivity
US20070061287A1 (en) Method, apparatus and program storage device for optimizing a data warehouse model and operation
US20030055813A1 (en) Query optimization by sub-plan memoization
US20040225639A1 (en) Optimizer dynamic sampling
US20030135485A1 (en) Method and system for rowcount estimation with multi-column statistics and histograms
JP2002510088A (en) Processing precomputed views
US7243100B2 (en) Methods and apparatus for mining attribute associations
US20030078686A1 (en) Systems and methods for discovering fully dependent patterns
US20030167275A1 (en) Computation of frequent data values
US20050108204A1 (en) System and method for managing OLAP summary tables
US20030126127A1 (en) Estimation of join fanout using augmented histogram
Mittra Database performance tuning and optimization: using Oracle

Legal Events

Date Code Title Description
STCB Information on status: application discontinuation

Free format text: ABANDONED -- FAILURE TO PAY ISSUE FEE