ayushjoshi2012 commited on
Commit
05338bb
·
verified ·
1 Parent(s): fdc2afc

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +78 -54
README.md CHANGED
@@ -1,22 +1,25 @@
1
- ---
2
- license: cc-by-nc-4.0
3
- task_categories:
4
- - text-generation
5
- language:
6
- - en
7
- tags:
8
- - sql
9
- - database
10
- - query-optimization
11
- - explain-analyze
12
- - postgresql
13
- - mysql
14
- - clickhouse
15
- - synthetic
16
- pretty_name: "Enterprise SQL Execution Plan & Query Optimization Traces"
17
- size_categories:
18
- - n<1K
19
- ---
 
 
 
20
 
21
  # Enterprise Database Query Plan Optimization & Remediation Traces (Community Preview)
22
 
@@ -24,62 +27,83 @@ size_categories:
24
  <img src="dataset_product_cover_1024.png" alt="Dataset Banner" width="700"/>
25
  </p>
26
 
27
- ## Executive Summary
28
- Modern relational and analytical databases stall under high-throughput concurrency due to planner misestimations, unindexed correlated lookups, merge-sort disk spills, and autovacuum debt.
29
 
30
- This dataset provides real-world query execution plan traces across **PostgreSQL 16, MySQL 8.0, ClickHouse 24, CockroachDB, MariaDB, and SQLite**. Each record captures an authentic production performance regression, the actual optimizer execution plan (`EXPLAIN ANALYZE`), diagnostic thinking identifying why the query planner degraded, concrete remediation DDL, and the rewritten performant query.
31
 
32
  ---
33
 
34
- ## Complete Enterprise Fine-Tuning Corpus (2,500 Verified Traces)
35
-
36
- > **Evaluation Notice:** This Hugging Face edition is a **Community Preview (250 verified traces)** licensed strictly under **CC BY-NC 4.0** for non-commercial research and evaluation.
37
-
38
- To acquire the **Full Commercial Training Corpus (2,500 Records in JSONL + Parquet)** with an unrestricted commercial license for fine-tuning private models, agent tool-use, or RAG pipelines:
39
-
40
- 👉 **[Purchase Enterprise Commercial License via Dodo Payments](https://checkout.dodopayments.com/buy/pdt_sql_2500_xxxx)**
41
-
42
- ### Enterprise Distribution Splits
43
 
44
  | Split | Records | Format | Primary Use Case | License |
45
  | :--- | :--- | :--- | :--- | :--- |
46
- | **Community Evaluation** | 250 | Parquet | Benchmarking, zero-shot evaluation, academic research | CC BY-NC 4.0 |
47
- | **Enterprise Commercial** | 2,500 | Parquet + JSONL | Supervised Fine-Tuning (SFT), DPO alignment, production DBA copilots | Commercial Grant |
48
 
49
- ---
 
 
 
50
 
51
- ## Dataset Architecture & Taxonomy
52
 
53
- Every trace is synthesized through multi-variable schema taxonomy seeds ensuring zero query duplication and wide domain coverage:
54
 
55
- * **Fintech & Ledger Systems:** Ledger entry scans, implicit UUID-to-text coercion, statement aggregation scans.
56
- * **IoT & Telematics:** Timeseries partition decompression mismatches, broad skip-index granules, high-cardinality group-by memory spills.
57
- * **Multi-Tenant SaaS & RBAC:** Historical audit log deep-OFFSET pagination, unindexed soft-deletion booleans, sub-optimal hash joins.
58
- * **Healthcare EHR Records:** Unindexed foreign key nested loop joins, leading wildcard ILIKE scans, outdated planner statistics.
59
- * **Global Logistics & Freight:** Memory sort merge joins on unindexed timestamps, Cartesian row multiplication, undersized `work_mem` spills.
60
- * **AdTech & Gaming Telemetry:** Late-arriving unindexed stream joins, disk window function partitions, concurrent leaderboard deadlocks.
 
 
 
 
61
 
62
  ### Field Definitions
63
 
64
  | Field | Data Type | Description |
65
  | :--- | :--- | :--- |
66
- | `database_engine` | `string` | Target engine and version (e.g., `PostgreSQL 16.2`, `ClickHouse 24.3`, `MySQL 8.0`). |
67
  | `slow_query` | `string` | Realistic unoptimized SQL query triggering runtime performance degradation. |
68
  | `execution_plan` | `string` | Raw optimizer output (`EXPLAIN (ANALYZE, BUFFERS)` or JSON plan) exposing node bottlenecks. |
69
  | `diagnostic_thought` | `string` | Step-by-step reasoning diagnosing node cost, row estimate deltas, and I/O buffer behavior. |
70
- | `remediation_ddl` | `string` | Plain executable DDL statements (`CREATE INDEX CONCURRENTLY`, table parameter tuning). |
71
  | `optimized_query` | `string` | Performant rewritten query strictly adhering to engine dialect grammar. |
72
 
73
  ---
74
 
75
- ## Schema Example
76
 
77
- ```json
78
- {
79
- "database_engine": "PostgreSQL 16.2",
80
- "slow_query": "SELECT order_id, customer_id, total_amount FROM orders WHERE DATE(created_at) = '2026-03-15';",
81
- "execution_plan": "Seq Scan on orders (cost=0.00..45230.10 rows=482 width=24) (actual time=0.042..112.431 rows=512 loops=1)\n Filter: (date(created_at) = '2026-03-15'::date)\n Rows Removed by Filter: 1999488\n Buffers: shared hit=28410",
82
- "diagnostic_thought": "The query wraps 'created_at' in the DATE() function inside the WHERE predicate. Even if a standard B-Tree index exists on 'created_at', this function call renders the predicate non-sargable, forcing the PostgreSQL planner to execute a sequential scan across 2 million pages.",
83
- "remediation_ddl": "CREATE INDEX CONCURRENTLY idx_orders_created_at_date ON orders ((created_at::date));",
84
- "optimized_query": "SELECT order_id, customer_id, total_amount FROM orders WHERE created_at >= '2026-03-15 00:00:00' AND created_at < '2026-03-16 00:00:00';"
85
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ task_categories:
4
+ - text-generation
5
+ - question-answering
6
+ language:
7
+ - en
8
+ tags:
9
+ - sql
10
+ - database
11
+ - query-optimization
12
+ - explain-analyze
13
+ - postgresql
14
+ - mysql
15
+ - clickhouse
16
+ - cockroachdb
17
+ - dba
18
+ - fine-tuning
19
+ pretty_name: Enterprise Database Query Plan Optimization & Remediation Traces
20
+ size_categories:
21
+ - 100<n<1K
22
+ ---
23
 
24
  # Enterprise Database Query Plan Optimization & Remediation Traces (Community Preview)
25
 
 
27
  <img src="dataset_product_cover_1024.png" alt="Dataset Banner" width="700"/>
28
  </p>
29
 
30
+ ## Overview
31
+ High-concurrency database workloads frequently degrade due to optimizer plan misestimations, unindexed correlated joins, merge-sort memory spills, and non-sargable expressions.
32
 
33
+ This repository hosts the **Community Preview (250 verified traces)** of an architectural fine-tuning dataset spanning **PostgreSQL 16, MySQL 8.0, ClickHouse 24, CockroachDB, MariaDB, and SQLite**. Each record pairs an authentic production query regression and raw execution plan (`EXPLAIN ANALYZE`) with chain-of-thought architectural diagnosis, actionable remediation DDL, and dialect-compliant optimized queries.
34
 
35
  ---
36
 
37
+ ## Dataset Splits & Commercial Licensing
 
 
 
 
 
 
 
 
38
 
39
  | Split | Records | Format | Primary Use Case | License |
40
  | :--- | :--- | :--- | :--- | :--- |
41
+ | **Community Evaluation** (This Repo) | 250 | Parquet | Benchmarking, zero-shot eval, research | **CC BY-NC 4.0** |
42
+ | **Enterprise Commercial Corpus** | 2,500 | Parquet + JSONL | Production fine-tuning (SFT/DPO), commercial DBA agents | **Commercial Enterprise License** |
43
 
44
+ ### Complete Enterprise Corpus (2,500 Records)
45
+ For production model deployment, proprietary agent training, or private RAG pipelines without non-commercial restrictions:
46
+
47
+ 👉 **[Acquire Enterprise Commercial License & Dataset via Dodo Payments](https://checkout.dodopayments.com/buy/pdt_sql_2500_xxxx)**
48
 
49
+ ---
50
 
51
+ ## Data Structure & Schema
52
 
53
+ ```json
54
+ {
55
+ "database_engine": "string",
56
+ "slow_query": "string",
57
+ "execution_plan": "string",
58
+ "diagnostic_thought": "string",
59
+ "remediation_ddl": "string",
60
+ "optimized_query": "string"
61
+ }
62
+ ```
63
 
64
  ### Field Definitions
65
 
66
  | Field | Data Type | Description |
67
  | :--- | :--- | :--- |
68
+ | `database_engine` | `string` | Target engine dialect & exact version (e.g., `PostgreSQL 16.2`, `ClickHouse 24.3`). |
69
  | `slow_query` | `string` | Realistic unoptimized SQL query triggering runtime performance degradation. |
70
  | `execution_plan` | `string` | Raw optimizer output (`EXPLAIN (ANALYZE, BUFFERS)` or JSON plan) exposing node bottlenecks. |
71
  | `diagnostic_thought` | `string` | Step-by-step reasoning diagnosing node cost, row estimate deltas, and I/O buffer behavior. |
72
+ | `remediation_ddl` | `string` | Executable DDL statements (`CREATE INDEX CONCURRENTLY`, table parameter tuning). |
73
  | `optimized_query` | `string` | Performant rewritten query strictly adhering to engine dialect grammar. |
74
 
75
  ---
76
 
77
+ ## Quickstart (Hugging Face Datasets)
78
 
79
+ ```python
80
+ from datasets import load_dataset
81
+
82
+ # Load Community Preview
83
+ dataset = load_dataset("ayushjoshi2012/sql-optimization-diagnostic-traces", split="train")
84
+
85
+ # Inspect a single diagnostic trace
86
+ sample = dataset[0]
87
+ print(f"Engine: {sample['database_engine']}")
88
+ print(f"Slow Query:\n{sample['slow_query']}")
89
+ print(f"Diagnosis:\n{sample['diagnostic_thought']}")
90
+ print(f"Remediation DDL:\n{sample['remediation_ddl']}")
91
+ print(f"Rewritten Query:\n{sample['optimized_query']}")
92
+ ```
93
+
94
+ ---
95
+
96
+ ## Core Domain Taxonomy
97
+
98
+ Traces are generated across representative enterprise schema designs:
99
+ * **Fintech & Ledger Core:** Double-entry ledger scans, implicit UUID-to-integer type coercion, balance aggregations.
100
+ * **IoT & Telematics:** Granule skip-index mismatches, partition decompression stalls, time-bucket groupings.
101
+ * **B2B SaaS & Security:** High-offset tenant audit logs, soft-delete booleans, unindexed RBAC joins.
102
+ * **Healthcare & EHR:** Unindexed composite foreign keys, leading-wildcard text filters, outdated optimizer statistics.
103
+ * **Freight & Global Logistics:** Disk-spilling merge joins on departure timestamps, Cartesian row multiplication.
104
+ * **AdTech & Gaming Telemetry:** Unindexed streaming click joins, unbounded window function sorts, leaderboard lock contention.
105
+
106
+ ---
107
+
108
+ ## Citation & Contact
109
+ For inquiries regarding custom synthetic domain generation, enterprise site licenses, or data additions, please commentinitiate a new discussion.