Translating Imperative Code into SQL

Slides:



Advertisements
Similar presentations
Synopsys University Courseware Copyright © 2012 Synopsys, Inc. All rights reserved. Compiler Optimization and Code Generation Lecture - 3 Developed By:
Advertisements

1 Optimization Optimization = transformation that improves the performance of the target code Optimization must not change the output must not cause errors.
Optimizing Join Enumeration in Transformation-based Query Optimizers ANIL SHANBHAG, S. SUDARSHAN IIT BOMBAY VLDB 2014
8. Code Generation. Generate executable code for a target machine that is a faithful representation of the semantics of the source code Depends not only.
Course Outline Traditional Static Program Analysis –Theory Compiler Optimizations; Control Flow Graphs Data-flow Analysis – today’s class –Classic analyses.
Control-Flow Graphs & Dataflow Analysis CS153: Compilers Greg Morrisett.
CS412/413 Introduction to Compilers Radu Rugina Lecture 37: DU Chains and SSA Form 29 Apr 02.
Chapter 10 Code Optimization. A main goal is to achieve a better performance Front End Code Gen Intermediate Code source Code target Code user Machine-
Loop invariant code removal CS 480. Our sample calculation for i := 1 to n for j := 1 to m c [i, j] := 0 for k := 1 to p c[i, j] := c[i, j] + a[i, k]
1 Code Optimization Code produced by compilation algorithms can often be improved (ideally optimized) in terms of run-time speed and the amount of memory.
Optimization Compiler Baojian Hua
UNIT-III By Mr. M. V. Nikum (B.E.I.T). Programming Language Lexical and Syntactic features of a programming Language are specified by its grammar Language:-
CMPT 354, Simon Fraser University, Fall 2008, Martin Ester 52 Database Systems I Relational Algebra.
Paper by: A. Balmin, T. Eliaz, J. Hornibrook, L. Lim, G. M. Lohman, D. Simmen, M. Wang, C. Zhang Slides and Presentation By: Justin Weaver.
Introduction to Code Optimization Comp 412 Copyright 2010, Keith D. Cooper & Linda Torczon, all rights reserved. Students enrolled in Comp 412 at Rice.
Cpeg421-08S/final-review1 Course Review Tom St. John.
CS 536 Spring Intermediate Code. Local Optimizations. Lecture 22.
Administrative info Subscribe to the class mailing list –instructions are on the class web page, click on “Course Syllabus” –if you don’t subscribe by.
1 Intermediate representation Goals: –encode knowledge about the program –facilitate analysis –facilitate retargeting –facilitate optimization scanning.
Intermediate Code. Local Optimizations
Introduction to Optimization Copyright 2003, Keith D. Cooper, Ken Kennedy & Linda Torczon, all rights reserved.
Machine-Independent Optimizations Ⅰ CS308 Compiler Theory1.
Recap from last time We saw various different issues related to program analysis and program transformations You were not expected to know all of these.
T HE Q UERY C OMPILER Prepared by : Ankit Patel (226)
Session-01. Hibernate Framework ? Why we use Hibernate ?
Making Database Applications Perform Using Program Analysis Alvin Cheung Samuel Madden Armando Solar-Lezama MIT Owen Arden Andrew C. Myers Cornell.
Query Processing Presented by Aung S. Win.
Topic #10: Optimization EE 456 – Compiling Techniques Prof. Carl Sable Fall 2003.
Efficient Evaluation of XQuery over Streaming Data Xiaogang Li Gagan Agrawal The Ohio State University.
Introduction For some compiler, the intermediate code is a pseudo code of a virtual machine. Interpreter of the virtual machine is invoked to execute the.
G-SPARQL: A Hybrid Engine for Querying Large Attributed Graphs Sherif SakrSameh ElniketyYuxiong He NICTA & UNSW Sydney, Australia Microsoft Research Redmond,
Access Path Selection in a Relational Database Management System Selinger et al.
1 Advance Computer Architecture CSE 8383 Ranya Alawadhi.
RELATIONAL FAULT TOLERANT INTERFACE TO HETEROGENEOUS DISTRIBUTED DATABASES Prof. Osama Abulnaja Afraa Khalifah
Copyright © 2004 Pearson Education, Inc.. Chapter 15 Algorithms for Query Processing and Optimization.
1 Code optimization “Code optimization refers to the techniques used by the compiler to improve the execution efficiency of the generated object code”
CSCI Query Processing1 QUERY PROCESSING & OPTIMIZATION Dr. Awad Khalil Computer Science Department AUC.
Query Optimization CMPE 226 Database Systems By, Arjun Gangisetty
CS412/413 Introduction to Compilers Radu Rugina Lecture 18: Control Flow Graphs 29 Feb 02.
Region Streams Functional Macroprogramming for Sensor Networks Ryan Newton MIT CSAIL Matt Welsh Harvard University
Lecture 15: Query Optimization. Very Big Picture Usually, there are many possible query execution plans. The optimizer is trying to chose a good one.
Chapter 13: Query Processing
Review 1.Structure of the course Lexical Analysis Syntax Analysis Grammar & Language RG & DFA Top-down LL(1) Parsing Bottom-Up LR Layered Automation Semantic.
Credible Compilation With Pointers Martin Rinard and Darko Marinov Laboratory for Computer Science Massachusetts Institute of Technology.
More Code Generation and Optimization Pat Morin COMP 3002.
Code Optimization Code produced by compilation algorithms can often be improved (ideally optimized) in terms of run-time speed and the amount of memory.
Introduction to Optimization
High-level optimization Jakub Yaghob
Efficient Evaluation of XQuery over Streaming Data
Code Optimization.
Query Optimization Heuristic Optimization
UNIT 11 Query Optimization
Database Management System
Static Single Assignment
Prepared by : Ankit Patel (226)
New applications of program synthesis
课程名 编译原理 Compiling Techniques
Optimization Code Optimization ©SoftMoore Consulting.
Do Now: Determine the value of x in the expression.
Eugene Gavrin – MSc student
Introduction to Optimization
Exam Topics Hal Perkins Autumn 2009
Intermediate Representations Hal Perkins Autumn 2005
Interval Partitioning of a Flow Graph
Introduction to Optimization
Optimization 薛智文 (textbook ch# 9) 薛智文 96 Spring.
Query Optimization.
Intermediate Code Generation
Programming Languages and Compilers (CS 421)
Exam Topics Hal Perkins Winter 2008
Presentation transcript:

Translating Imperative Code into SQL Horses for Courses Translating Imperative Code into SQL K. Venkatesh Emani Advisor: S. Sudarshan IIT Bombay

Transfer of unused data Can we reduce amount of data fetched? Network round trips Transfer of unused data Can we reduce amount of data fetched? Can we reduce number of queries? Time taken for one query APP What translations do we do? Selections Projections Joins Aggregations Exists Others All blocks transferred but only two used DB Time taken by rewritten query Only required data is fetched Time taken for all queries Time Time

Example BEFORE AFTER

Intermediate Representation DAG Relational expressions Source language expressions fold for loops

Techniques Involved Challenges Program regions Built from Control Flow Graph Rule based transformations on algebraic IR Program rewriting Dead code removal Challenges Preserving program semantics – real world programs are complex Rewriting to SQL not always possible Preconditions on the Data Dependence Graph

Evaluation Significant improvements after rewriting – both data and time > 80% applicability on samples from real world open source application using Hibernate Comparable to other approaches with similar goals Resource utilization much lesser

Going forward … Use these ideas to optimize web services and mobile applications? A step towards allowing database application developers to express functionality, and let the compiler worry about optimizations