Skip to content

Instantly share code, notes, and snippets.

@startuml
title Activity Diagram — SQLancer Test Execution
start
:Parse CLI arguments;
:Select target DBMS;
:Connect to database;
:Generate random schema and data;
@startuml
title Sequence Diagram — TLP Oracle Bug Detection
participant "SQL Generator" as sqlgen
participant "TLP Oracle" as tlp
database "Target DBMS" as dbms
sqlgen -> dbms: CREATE TABLE t (x INT)
sqlgen -> dbms: INSERT random data
@startuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Component.puml
title Component Diagram — Test Oracle Engine
Container_Boundary(oracle, "Test Oracle Engine") {
Component(tlp, "TLP Oracle", "Java", "Partitions query into P, NOT P, P IS NULL — compares combined results to original")
Component(pqs, "PQS Oracle", "Java", "Selects a pivot row, generates query guaranteed to fetch it — flags bug if row missing")
Component(norec, "NoREC Oracle", "Java", "Compares optimized query results against unoptimized version to find optimizer bugs")
Component(base, "Oracle Base Interface", "Java", "Common interface for all oracle implementations — defines check() contract")
@startuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Container.puml
title Container Diagram — SQLancer
Person(dev, "DBMS Developer / Researcher", "Configures and runs SQLancer to find bugs")
System_Boundary(sqlancer, "SQLancer") {
Container(main, "Main Orchestrator", "Java", "Entry point, CLI parsing, thread management, progress monitoring")
Container(provider, "Database Provider Layer", "Java", "Pluggable DBMS-specific implementations (PostgreSQL, MySQL, SQLite, etc.)")
@startuml
!include https://raw.githubusercontent.com/plantuml-stdlib/C4-PlantUML/master/C4_Context.puml
title System Context Diagram — SQLancer
Person(dev, "DBMS Developer / Researcher", "Wants to find bugs in database implementations")
System(sqlancer, "SQLancer", "Automated testing tool that generates random SQL statements and uses test oracles to detect logic bugs in DBMSs")
System_Ext(dbms, "Target DBMS", "e.g., PostgreSQL, MySQL, SQLite, CockroachDB, DuckDB, TiDB, etc.")

filter

NUM_DOMAINS=2 RUNS=10 bash bench_runner.sh filter.exe 1000 100000 "i*10" 1
+ dune exec --release -- test/filter.exe -r 10 -n 1000 -c 10 -d 2
# Filtering list of size: 1000 | 10 elements changed in propagation | Domains spawned: 2
## Initial computation
Name                          Avg                Median             Runs     Max time           Min time
static-filter                 0.01261 ms         0.01144 ms         10       0.02598 ms         0.007152 ms
incr-seq-filter-initial-cons  0.2218 ms          0.2089 ms          10       0.3130 ms          0.1950 ms