Optimisation of language-integrated queries by query unnesting (original) (raw)

A step towards genuine declarative language-integrated queries

Proceedings of the 2015 Federated Conference on Computer Science and Information Systems, 2015

Native functional-style querying extensions for programming languages (e.g., LINQ or Java 8 streams) are widely considered as declarative. However, their very limited degree of optimisation when dealing with local collection processing contradicts this statement. We show that developers constructing complex LINQ queries or combining queries expose themselves to the risk of severe performance deterioration. For an inexperienced programmer, a way of getting an appropriate query form can be too complicated. Also, a manual query transformation is justified by the need of improving performance, but achieved at the expense of reflecting an actual business goal. As a result, benefits from a declarative form and an increased level of abstraction are lost. In this paper, we claim that moving of selected methods for automated optimisation elaborated for declarative query languages to the level of imperative programming languages is possible and desired. We propose an optimisation method for collection-processing constructs based on higher-order functions through factoring out of free expressions in order to avoid unnecessary multiple calculations. We have implemented and verified this idea as a simple proof-of-concept LINQ optimiser library.

11.Query Optimization to Improve Performance of the Code Execution

Object-Oriented Programming (OOP) is one of the most successful techniques for abstraction. Bundling together objects into collections of objects, and then operating on these collections, is a fundamental part of main stream object-oriented programming languages. Object querying is an abstraction of operations over collections, whereas manual implementations are performed at low level which forces the developers to specify how a task must be done. Some object-oriented languages allow the programmers to express queries explicitly in the code, which are optimized using the query optimization techniques from the database domain. In this regard, we have developed a technique that performs query optimization at compile-time to reduce the burden of optimization at run-time to improve the performance of the code execution.

Query Optimization to Improve Performance of the Code Execution

Object-Oriented Programming (OOP) is one of the most successful techniques for abstraction. Bundling together objects into collections of objects, and then operating on these collections, is a fundamental part of main stream object-oriented programming languages. Object querying is an abstraction of operations over collections, whereas manual implementations are performed at low level which forces the developers to specify how a task must be done. Some object-oriented languages allow the programmers to express queries explicitly in the code, which are optimized using the query optimization techniques from the database domain. In this regard, we have developed a technique that performs query optimization at compile-time to reduce the burden of optimization at run-time to improve the performance of the code execution.

Patterns for Program Query Optimisation

Operations on data can be classified as either queries or updates. Modern object-oriented programming languages require classes/interfaces to support a predefined set of queries. This presents a challenge for software designers, since a fixed interface can severely restrict the opportunities for optimisation. In this paper, we present two common patterns for optimising queries. The first requires specific knowledge of which query to optimise beforehand, whilst the latter provides more leeway in this regard. These patterns are commonly occurring in software, and we find numerous instances of them within the Java standard libraries.

Optimization of object-oriented queries addressing large and small collections

2009 International Multiconference on Computer Science and Information Technology, 2009

When a query jointly addresses very large and very small collections it may happen that an iteration caused by a query operator is driven by a large collection and in each cycle it evaluates a subquery that depends on an element of a small collection. For each such element the result returned by the subquery is the same. In effect, such a subquery is unnecessarily evaluated many times. The optimization rewrites such a query to reverse the situation: the loop is to be performed on a small collection and inside each its cycle a subquery addressing a large collection is evaluated. We illustrate the method on comprehensive examples and then present the general rewriting rule. The research follows the Stack-Based Approach to query languages having roots in the semantics of programming languages. The optimization method consists in analyzing of scoping and binding rules for names occurring in queries.

An extensible query optimizer for an objectbase management system

Proceedings of the fourth international conference on Information and knowledge management - CIKM '95, 1995

We describe an extensible query optimizer for objectbase management systems. Since these systems are expected to serve data management needs of a wide range of application domains with possibly different query optimization requirements, extensibtity is essential. Our work is conducted within the context of TIGUKAT, which is a uniform behavioral system that models every system component as a first-class object. Consistent with this philosophy, we model ever y component of the optimizer M a first-class object, providing ultimate extensibfity. We describe the optimizer architecture and how the optimizer components are modeled as extensions of a uniform type system. " This research m supported by the Natural Sc\ences and Engmeermg Research Councd of Canada under grant OGP0951 1TIGUKAT (tee-goc-kat) N a term m the language of the Canadian Inult people meamng "objects " The Canachan Imuts, commonly known as Eskimos, are native to Canada with an ancestry ortgmatmg m the Arctic regions of the country Permiwion to make digifaUttard copies of all or psrt of tiia material for personal or classroom use iri granted without fee provided that the copies are not made or distributed for profit or commercial advantage, the copyright notice, the title of the publication and its date appear, and notice is given that copyright is by permission of the ACM, Inc. To copy otherwise, to repubIisJt, to post on sewers or to nxfistribute to lists, requirw specific perrnisaion andlor fee. CIKM '

Towards Algebraic Query Optimisation for XQuery

Lecture Notes in Computer Science, 2006

XML-based databases have become a major area of interest in database research. Abstractly speaking they can be considered as a resurrection of complex-value databases using constructors for records, lists, unions plus optionality and references. XQuery has become the standard query language for XML. As XQuery is a declarative query language, the problem of query optimisation arises. In this paper an algebraic approach to query optimisation is introduced. This is based on a translation of XQuery into a query algebra for rational tree types. The algebra uses simple operations on types and structural recursion for lists. The translation exploits linguistic reflection for the type-safe expansion of path expressions. The availability of an algebraic representation of queries permits query rewriting, which in combination with cost heuristics permits queries to be rewritten and thus optimised.

Reducing Run-time Execution in Query Optimization

International Journal of Computer Applications, 2014

The main objective of query processor is to generate the most efficient query results. Using an apt execution plan, query minimizes cost of execution for results. The order of accessing a source table is very important during query execution. The best execution plan from possible ones is presented by Query optimizer. The paper discusses various stages of query optimization using execution plan. It gives the analysis of indexes, type of expressions & joins used in the execution plan of the query. The approach gets the estimate of the cost of query joins in a query at compile time. These estimates help in the construction of a query plan at compile time and then executed at run-time.

Static analysis of queries as a tool for static optimization

Proceedings 2001 International Database Engineering and Applications Symposium, 2001

The paper discusses, a special phase, called static analysis, which we use for static query optimization. Static analysis, as a compile-time simulation of run-time query evaluation, enables us to gather all the information that we need to optimize a query. We present in detail all the major data structures used by static analysis and discuss how they emulate their run-time equivalents. The paper includes also the algorithm of static analysis in pseudocode.