Code Monkey home page Code Monkey logo

ispras / postgres Goto Github PK

View Code? Open in Web Editor NEW

This project forked from postgres/postgres

56.0 25.0 11.0 309.28 MB

This is a modified version of PostgreSQL with just-in-time compiler for expressions. Current base version is 9.6.1.

License: Other

Emacs Lisp 0.01% Makefile 0.83% M4 0.20% Shell 0.26% SQLPL 0.59% C 85.91% Perl 1.46% PLpgSQL 5.36% C++ 2.61% Yacc 1.48% Lex 0.53% PLSQL 0.31% Ruby 0.22% Python 0.03% Assembly 0.01% Groff 0.09% DTrace 0.01% Objective-C 0.05% XS 0.02% Batchfile 0.02%
postgresql jit llvm

postgres's Introduction

PostgreSQL with JIT compiler for expressions

This is a modified version of PostgreSQL with just-in-time compiler for expressions. Current base version is 9.6.1. Just-in-time compiler (JIT for short) improves database performance significantly on OLAP queries. This version uses LLVM JIT for query compilation and shows up to 20% improvement on TPC-H tests.

Dependencies

  • LLVM version 3.7

Building

The easiest way is to follow the process of building vanilla PostgreSQL. LLVM JIT compiler for expressions is enabled by default.

The most basic procedure is as follows:

$ git clone https://github.com/ispras/postgres
$ cd postgres
$ ./configure [configure options]
$ make [make options] -jN

Configure options

option description
--disable-llvm-jit Disables expression compilation with LLVM JIT.
--with-llvm-config=<llvm_config> Specify your own llvm-config, version 3.7.0 or 3.7.1 required for build.

Make options

option description
LLVM_BACKEND_FILE_LIMIT=<N> Parallelize compilation by splitting LLVM backend file, N — number of functions in each file (50 by default).

PostgreSQL GUC settings

setting description
enable_llvm_jit Enable LLVM JIT of expressions (enabled by default).
enable_llvm_dump Dump compiled LLVM IR (developer option, disabled by default).
debug_llvm_jit Disable optimization of generated LLVM modules (developer option, disabled by default).

Internals

Internally, evaluation of each individual expression in PostgreSQL happens by means of calling a function pointer which is stored in the expression object and initialized during expression initialization phase with the address of the corresponding execution function.

Expression JIT presented here works by hooking into expression initialization phase and replacing this pointer with address of a function generated for the expression at run time.

Advice for developers

  • Enabling assertions (configure with --enable-cassert option) also turns on LLVM module verification.
  • Set enable_llvm_dump and debug_llvm_jit to on to explore compiled code.

LLVM dumps are stored in the llvm_dump subdirectory in the database directory. Each compiled expression is written into three files (substitute ### with expression number):

  • expr.### — expression tree, in the “pretty-print” format.
  • dump.###.ll, dump.###.opt.llLLVM assembly files generated for expression.

Resources

License

PostgreSQL License

postgres's People

Contributors

adunstan avatar alvherre avatar anarazel avatar bmomjian avatar darcyjcain avatar dbdbdb avatar deanrasheed avatar eush77 avatar feodor avatar grunthos avatar gsstark avatar hlinnaka avatar itgacky avatar jconway avatar jeff-davis avatar kgrittn avatar masaofujii avatar mhagander avatar nmisch avatar petere avatar robertmhaas avatar rubenbuchatskiy avatar scrappy avatar sfrost avatar simonat2ndquadrant avatar tatsuo-ishii avatar tglsfdc avatar vadim4o avatar xitesdf avatar zhroma avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

postgres's Issues

Upgrade LLVM to 4.0

I'm assuming this isn't an easy process but it will make sure we can merge this fork with the latest LLVM release at the time.
Is there anything I can do to help?

Update fork to 9.6.2

9.6.2 was released a while ago. It'd be nice to have this fork with an upgraded version.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.