11 releases

0.0.1-alpha.15 Apr 5, 2024
0.0.1-alpha.14 Mar 19, 2024
0.0.1-alpha.10 Feb 2, 2024
0.0.1-alpha.9 Jan 28, 2024

#767 in Database interfaces

Download history 5/week @ 2024-02-02 13/week @ 2024-02-16 15/week @ 2024-02-23 465/week @ 2024-03-01 369/week @ 2024-03-08 188/week @ 2024-03-15 20/week @ 2024-03-22 27/week @ 2024-03-29 106/week @ 2024-04-05 3/week @ 2024-04-12

163 downloads per month

Apache-2.0

2MB
22K SLoC

Built by @KipData


███████╗███╗   ██╗ ██████╗██╗  ██╗    ███████╗ ██████╗ ██╗     
██╔════╝████╗  ██║██╔════╝██║ ██╔╝    ██╔════╝██╔═══██╗██║     
█████╗  ██╔██╗ ██║██║     █████╔╝     ███████╗██║   ██║██║     
██╔══╝  ██║╚██╗██║██║     ██╔═██╗     ╚════██║██║▄▄ ██║██║     
██║     ██║ ╚████║╚██████╗██║  ██╗    ███████║╚██████╔╝███████╗
╚═╝     ╚═╝  ╚═══╝ ╚═════╝╚═╝  ╚═╝    ╚══════╝ ╚══▀▀═╝ ╚══════╝

-----------------------------------
🖕

Lightweight DBMS

 

CI

github star github fork

What is FnckSQL

FnckSQL individual developers independently implemented LSM KV-based SQL DBMS out of hobby. This SQL database will prove to you that anyone can write a database (even the core author cannot find a job). If you are also a database-related Enthusiastic, let us give this "beautiful" industry a middle finger🖕.

Welcome to our WebSite, Power By FnckSQL: http://www.kipdata.site/

Quick Started

Tips: Install rust toolchain first.

Clone the repository

git clone https://github.com/KipData/FnckSQL.git

start then use psql to enter sql pg Using FnckSQL in code

let fnck_sql = DataBaseBuilder::path("./data")
    .build()
    .await?;
let tuples = fnck_sql.run("select * from t1").await?;

Storage Support:

  • KipDB

Docker

Pull Image

docker pull kould23333/fncksql:latest

Build From Source

git clone https://github.com/KipData/FnckSQL.git
cd FnckSQL
docker build -t kould23333/fncksql:latest .

Run

We installed the psql tool in the image for easy debug.

You can use psql -h 127.0.0.1 -p 5432 to do this.

docker run -d \
--name=fncksql \
-p 5432:5432 \
--restart=always \
-v fncksql-data:/fnck_sql/fncksql_data \
-v /etc/localtime:/etc/localtime:ro \
kould23333/fncksql:latest

Features

  • ORM Mapping: features = ["marcos"]
#[derive(Default, Debug, PartialEq)]
struct MyStruct {
  c1: i32,
  c2: String,
}

implement_from_tuple!(
    MyStruct, (
        c1: i32 => |inner: &mut MyStruct, value| {
            if let DataValue::Int32(Some(val)) = value {
                inner.c1 = val;
            }
        },
        c2: String => |inner: &mut MyStruct, value| {
            if let DataValue::Utf8(Some(val)) = value {
                inner.c2 = val;
            }
        }
    )
);
  • User-Defined Function: features = ["marcos"]
function!(TestFunction::test(LogicalType::Integer, LogicalType::Integer) -> LogicalType::Integer => |v1: ValueRef, v2: ValueRef| {
    let value = DataValue::binary_op(&v1, &v2, &BinaryOperator::Plus)?;
    DataValue::unary_op(&value, &UnaryOperator::Minus)
});

let fnck_sql = DataBaseBuilder::path("./data")
    .register_function(TestFunction::new())
    .build()
    .await?;
  • Optimizer
    • RBO
    • CBO based on RBO(Physical Selection)
  • Execute
    • Volcano
    • Codegen on LuaJIT: features = ["codegen_execute"]
  • MVCC Transaction
    • Optimistic
  • Field options
    • [not] null
    • unique
    • primary key
  • SQL where options
    • is [not] null
    • [not] like
    • [not] in
  • Supports index type
    • PrimaryKey
    • Unique
    • Normal
    • Composite
  • Supports multiple primary key types
    • Tinyint
    • UTinyint
    • Smallint
    • USmallint
    • Integer
    • UInteger
    • Bigint
    • UBigint
    • Char
    • Varchar
  • DDL
    • Begin (Server only)
    • Commit (Server only)
    • Rollback (Server only)
    • Create
      • Table
      • Index: Unique\Normal\Composite
    • Drop
      • Table
      • Index
    • Alert
      • Add Column
      • Drop Column
    • Truncate
  • DQL
    • Select
      • SeqScan
      • IndexScan
    • Where
    • Distinct
    • Alias
    • Aggregation: count()/sum()/avg()/min()/max()
    • SubQueryselect/from/where
    • Join: Inner/Left/Right/Full/Cross
    • Group By
    • Having
    • Order By
    • Limit
    • Show Tables
    • Explain
    • Describe
    • Union
  • DML
    • Insert
    • Insert Overwrite
    • Update
    • Delete
    • Analyze
  • DataTypes
    • Invalid
    • SqlNull
    • Boolean
    • Tinyint
    • UTinyint
    • Smallint
    • USmallint
    • Integer
    • UInteger
    • Bigint
    • UBigint
    • Float
    • Double
    • Char
    • Varchar
    • Date
    • DateTime
    • Time
    • Tuple

Roadmap

  • SQL 2016

License

FnckSQL uses the Apache 2.0 license to strike a balance between open contributions and allowing you to use the software however you want.

Contributors

Thanks For

Dependencies

~18–33MB
~503K SLoC