Git Product home page Git Product logo

ganziheng / databend Goto Github PK

View Code? Open in Web Editor NEW

This project forked from datafuselabs/databend

0.0 0.0 0.0 36.78 MB

An elastic and reliable Serverless Data Warehouse, offers Blazing Fast Query and combines Elasticity, Simplicity, Low cost of the Cloud, built to make the Data Cloud easy

Home Page: https://databend.rs

License: Apache License 2.0

Makefile 0.07% Rust 98.04% Dockerfile 0.14% Shell 0.65% Python 0.57% TypeScript 0.03% JavaScript 0.25% SCSS 0.24% CSS 0.01%

databend's Introduction

Databend Logo

A Modern Cloud Data Warehouse with the Elasticity and Performance both on Object Storage


What is Databend?

Databend is an open source Elastic and Scalable Modern Cloud Data Warehouse.

Databend uses the latest techniques in vectorized query processing to allow you to do blazing-fast data analytics on Object Storage.

  • Instant Elasticity

    Databend separates the storage and compute, which allows you easily scale up or scale down based on your application's needs.

  • Blazing Performance

    Databend leverages data-level parallelism(Vectorized Query Execution) and instruction-level parallelism(SIMD) technology, offers blazing performance data analytics.

  • Support for Semi-Structured Data

    Databend supports ingestion of semi-structured data in various formats like CSV, JSON and Parquet which located in cloud or your local file system.

  • MySQL/ClickHouse Compatible

    Databend is ANSI SQL compliant and MySQL/ClickHouse wire protocol compatible, making it easy to connect with existing tools.

  • Easy to Use

    Databend has no indexes to build, no manual tuning required, no manual figuring out partitions or shard data, it’s all done for you as data is loaded into table.

Design Overview

This is the high-level architecture of Databend, it consists of three components:

  • meta service layer
  • compute layer
  • storage layer

Databend Architecture

Meta Service Layer

The meta service is a layer to service multiple tenants. This layer implements a persistent key-value store to store each tenant's state. In current implementation, the meta service has many components:

  • Metadata, which manages all metadata of databases, tables, clusters, the transaction, etc.
  • Administration, which stores user info, user management, access control information, usage statistics, etc.
  • Security, which performs authorization and authentication to protect the privacy of users' data.

The code of Meta Service Layer mainly resides in the metasrv directory of the repository.

Compute Layer

The compute layer is the layer to carry out computation for query processing. This layer may consist of many clusters, and each cluster may consist of many nodes. Each node is a compute unit, and is a collection of components:

  • Planner

    The query planner builds an execution plan from the user's SQL statement and represents the query with different types of relational operators (such as Projection, Filter, Limit, etc.).

    For example:

    databend :) EXPLAIN SELECT avg(number) FROM numbers(100000) GROUP BY number % 3
    ┌─explain─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐
    │ Projection: avg(number):Float64                                                                                                                                                         │
    │   AggregatorFinal: groupBy=[[(number % 3)]], aggr=[[avg(number)]]                                                                                                                       │
    │     AggregatorPartial: groupBy=[[(number % 3)]], aggr=[[avg(number)]]                                                                                                                   │
    │       Expression: (number % 3):UInt8, number:UInt64 (Before GroupBy)                                                                                                                    │
    │         ReadDataSource: scan schema: [number:UInt64], statistics: [read_rows: 100000, read_bytes: 800000, partitions_scanned: 11, partitions_total: 11], push_downs: [projections: [0]] │
    └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
    
  • Optimizer

    A rule based optimizer, some rules like predicate push down or pruning of unused columns.

  • Processors

    A Pull&Push-Based query execution pipeline, which is built by planner instructions. Each pipeline executor is a processor(such as SourceTransform, FilterTransform, etc.), it has zero or more inputs and zero or more outputs, and connected as a pipeline, it also can be distributed on multiple nodes judged by your query workload.

    For example:

    databend :) EXPLAIN PIPELINE SELECT avg(number) FROM numbers(100000) GROUP BY number % 3
    ┌─explain────────────────────────────────────────────────────────────────────────────────┐
    │ ProjectionTransform × 16 processors                                                    │
    │   Mixed (GroupByFinalTransform × 1 processor) to (ProjectionTransform × 16 processors) │
    │     GroupByFinalTransform × 1 processor                                                │
    │       Merge (GroupByPartialTransform × 16 processors) to (GroupByFinalTransform × 1)   │
    │         GroupByPartialTransform × 16 processors                                        │
    │           ExpressionTransform × 16 processors                                          │
    │             SourceTransform × 16 processors                                            │
    └────────────────────────────────────────────────────────────────────────────────────────┘
    

Node is the smallest unit of the compute layer. A set of nodes can be registered as one cluster via namespace. Many clusters can attach the same database, so they can serve the query in parallel by different users. When you add new nodes to a cluster, the currently running computational tasks can be scaled(known as work-stealing) guarantee.

The Compute Layer codes mainly in the query directory.

Storage Layer

Databend stores data in an efficient, columnar format as Parquet files. Each Parquet file is sorted by the primary key before being written to the underlying shared storage. For efficient pruning, Databend also creates indexes for each Parquet file:

  • min_max.idx The index file stores the minimum and maximum value of this Parquet file. -sparse.idx The index file store the <key, parquet-page> mapping for every [N] records granularity.

With the indexes, we can speed up the queries by reducing the I/O and CPU cost. Imagine that Parquet file f1 has min_max.idx of [3, 5) and Parquet file f2 has min_max.idx of [4, 6) in column x, if the query predicate is WHERE x < 4, only f1 needs to be accessed and processed.

Getting Started

Roadmap

Community

License

Databend is licensed under Apache 2.0.

Acknowledgement

databend's People

Contributors

bohutang avatar sundy-li avatar databend-bot avatar zhang2014 avatar drmingdrmer avatar dantengsky avatar psiace avatar zhihanz avatar mergify[bot] avatar dependabot[bot] avatar jyizheng avatar xuanwo avatar flaneur2020 avatar zhyass avatar veeupup avatar ariesdevil avatar youngsofun avatar mshauneu avatar lianghanzhen avatar lichuang avatar junnplus avatar junli1026 avatar wangzhen11aaa avatar dust1 avatar everpcpc avatar ygf11 avatar dependabot-preview[bot] avatar grapebaba avatar leiysky avatar andylokandy avatar

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.