GithubHelp home page GithubHelp logo

wuchao-li / mt-join-query-optimization-with-drl Goto Github PK

View Code? Open in Web Editor NEW

This project forked from heitzjon/mt-join-query-optimization-with-drl

0.0 1.0 0.0 1.74 MB

License: Other

Makefile 0.07% Python 99.86% Shell 0.07%

mt-join-query-optimization-with-drl's Introduction

Join Query Optimization with Deep Reinforcement Learning

This repository contains the DRL-based FOOP-environment:

"Join Query Optimization with Deep Reinforcement Learning Algorithms" by Jonas Heitz and Kurt Stockinger, Zurich University of Applied Sciences, Winterthur, Switzerland

https://arxiv.org/abs/1911.11689

Basics

The source code is based on the gym from OpenAI. The code is divided in to two parts (Agent and Environment). Agent-Environment Feedback Loop

All the code was executed on Ubuntu version 18.04.1.

Environment

  • In the folder /gym/envs/database/ are the reinforcement learning environments defined to plan queries according to the template of gym.
  • In the folder /queryoptimization/ you find the files QueryGraph.py and cm1_postgres_card.py. The first takes over the parsing of simple SQL-queries and includes the logic of the query planning. Whereas cm1_postgres_card.py delivers the expected costs of a query object according to the cost model introduced in the paper โ€œHow good are query optimizers, really?โ€ by Leis et al.

Agent

We used Ray RLLib to train our deep reinforcement learning models. Therefore, in the folder agents/run/ you find the following files:

  • config.py: With the configurations of the models vanilla DQN (SIMPLE_CONFIG), DDQN (DOUBLE_PRIO) and PPO (PPO_CONFIG).
  • execute.py: Includes the code to execute a set of experiments.
  • models.py: Includes the neural nets with the action-masking layer.
  • masking_env_cros.py: Prepares the environments to deliver the information needed for the action-masking layer in models.py.

In the folder /agents/rollout/ you find the scripts to test trained models. The folder /agents/queries/ contains the queries used for the experiments.

Installation

  1. Install PostrgreSQL
  2. Load IMDb according to the guide from the JOB
  3. Install Python 3.*
  4. Clone repository
  5. Install virtual environment from requirements.txt in the project folder
  6. As a last step you need to update the DB connection details and the path of the query files in the __init__() and reset() function of the environment files at /gym/envs/database/.

Run

With the script simple_corridor.py in /agents/run/ you can check if the installation of gym and ray works. To execute the experiments you can start execute.py in /agents/run/.

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.