Dataset Viewer
Auto-converted to Parquet Duplicate
id
stringlengths
8
8
original_sql
stringlengths
206
666
optimized_sql
stringlengths
206
666
speedup_ratio
float64
0.16
57.7
bottleneck_diagnosis
stringclasses
7 values
optimization_reasoning
stringlengths
171
173
faster_engine
stringclasses
2 values
messages
listlengths
3
3
qp_00000
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey JOIN supplier ON l_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey JOIN region ON n_regionkey = r_reg...
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey JOIN supplier ON l_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey JOIN region ON n_regionkey = r_reg...
12.94
Complex multi-table join structure with 5 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 12.94x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00001
SELECT ps_partkey, SUM(ps_supplycost * ps_availqty) AS value FROM partsupp JOIN supplier ON ps_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey WHERE n_name = 'EGYPT' GROUP BY ps_partkey HAVING SUM(ps_supplycost * ps_availqty) > 287316 ORDER BY value D...
SELECT ps_partkey, SUM(ps_supplycost * ps_availqty) AS value FROM partsupp JOIN supplier ON ps_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey WHERE n_name = 'EGYPT' GROUP BY ps_partkey HAVING SUM(ps_supplycost * ps_availqty) > 287316 ORDER BY value D...
6.44
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 6.44x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00002
SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM supplier JOIN lineitem ON s_suppkey = l_suppkey JOIN orders ON l_orderkey = o_orderkey JOIN customer ON o_custkey = c_custkey JOIN nation n1 ON s_nati...
SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM supplier JOIN lineitem ON s_suppkey = l_suppkey JOIN orders ON l_orderkey = o_orderkey JOIN customer ON o_custkey = c_custkey JOIN nation n1 ON s_nati...
4.17
Complex multi-table join structure with 5 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 4.17x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00003
SELECT l_shipmode, SUM(CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END) AS high_line_count, SUM(CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END) AS low_line_coun...
SELECT l_shipmode, SUM(CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END) AS high_line_count, SUM(CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END) AS low_line_coun...
8.35
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 8.35x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00004
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM lineitem JOIN part ON l_partkey = p_partkey WHERE p_brand = 'Brand#31' AND l_quantity >= 7 AND l_quantity <= 24 AND p_size BETWEEN 3 AND 21;
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM lineitem JOIN part ON l_partkey = p_partkey WHERE p_brand = 'Brand#31' AND l_quantity >= 7 AND l_quantity <= 24 AND p_size BETWEEN 3 AND 21;
1.88
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 1.88x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00005
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey JOIN supplier ON l_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey JOIN region ON n_regionkey = r_reg...
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey JOIN supplier ON l_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey JOIN region ON n_regionkey = r_reg...
10.91
Complex multi-table join structure with 5 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 10.91x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00006
SELECT l_returnflag, l_linestatus, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity...
SELECT l_returnflag, l_linestatus, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity...
50.13
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 50.13x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00007
SELECT SUM(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem JOIN part ON l_partkey = p_partkey WHERE p_brand = 'Brand#15' AND p_container = 'LG CASE' AND l_quantity < 19;
SELECT SUM(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem JOIN part ON l_partkey = p_partkey WHERE p_brand = 'Brand#15' AND p_container = 'LG CASE' AND l_quantity < 19;
0.65
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 0.65x when evaluated on column-store execution.
sqlite
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00008
SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier JOIN ( SELECT l_suppkey, SUM(l_extendedprice * (1 - l_discount)) AS total_revenue FROM lineitem WHERE l_shipdate >= '1993-03-11' AND l_shipdate < '1993-06-11' GROUP BY ...
SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier JOIN ( SELECT l_suppkey, SUM(l_extendedprice * (1 - l_discount)) AS total_revenue FROM lineitem WHERE l_shipdate >= '1993-03-11' AND l_shipdate < '1993-06-11' GROUP BY ...
6.64
Nested subqueries present, creating potential correlated loop overhead.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 6.64x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00009
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM lineitem JOIN part ON l_partkey = p_partkey WHERE p_brand = 'Brand#31' AND l_quantity >= 10 AND l_quantity <= 35 AND p_size BETWEEN 4 AND 39;
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM lineitem JOIN part ON l_partkey = p_partkey WHERE p_brand = 'Brand#31' AND l_quantity >= 10 AND l_quantity <= 35 AND p_size BETWEEN 4 AND 39;
3.07
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 3.07x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00010
SELECT l_shipmode, SUM(CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END) AS high_line_count, SUM(CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END) AS low_line_coun...
SELECT l_shipmode, SUM(CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END) AS high_line_count, SUM(CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END) AS low_line_coun...
8.14
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 8.14x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00011
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey JOIN supplier ON l_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey JOIN region ON n_regionkey = r_reg...
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey JOIN supplier ON l_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey JOIN region ON n_regionkey = r_reg...
11.92
Complex multi-table join structure with 5 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 11.92x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00012
SELECT substr(c_phone, 1, 2) AS cntrycode, COUNT(*) AS numcust, SUM(c_acctbal) AS totacctbal FROM customer WHERE substr(c_phone, 1, 2) IN ('28', '13', '18') AND c_acctbal > 525.68 GROUP BY cntrycode ORDER BY cntrycode;
SELECT substr(c_phone, 1, 2) AS cntrycode, COUNT(*) AS numcust, SUM(c_acctbal) AS totacctbal FROM customer WHERE substr(c_phone, 1, 2) IN ('28', '13', '18') AND c_acctbal > 525.68 GROUP BY cntrycode ORDER BY cntrycode;
2.98
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 2.98x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00013
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp JOIN part ON p_partkey = ps_partkey WHERE p_brand <> 'Brand#12' AND p_type NOT LIKE 'STANDARD%' AND p_size IN (2, 29, 38, 16, 13, 19, 37, 26) GROUP BY p_brand, p_type, p_size ...
SELECT p_brand, p_type, p_size, COUNT(DISTINCT ps_suppkey) AS supplier_cnt FROM partsupp JOIN part ON p_partkey = ps_partkey WHERE p_brand <> 'Brand#12' AND p_type NOT LIKE 'STANDARD%' AND p_size IN (2, 29, 38, 16, 13, 19, 37, 26) GROUP BY p_brand, p_type, p_size ...
3.18
DISTINCT operation incurs sorting and hashing memory allocation. Pattern matching using LIKE may inhibit standard B-Tree index lookups.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 3.18x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00014
SELECT c_count, COUNT(*) AS custdist FROM ( SELECT c_custkey, COUNT(o_orderkey) AS c_count FROM customer LEFT JOIN orders ON c_custkey = o_custkey AND o_comment NOT LIKE '%special%requests%' GROUP BY c_custkey ) AS c_orders GROUP BY...
SELECT c_count, COUNT(*) AS custdist FROM ( SELECT c_custkey, COUNT(o_orderkey) AS c_count FROM customer LEFT JOIN orders ON c_custkey = o_custkey AND o_comment NOT LIKE '%special%requests%' GROUP BY c_custkey ) AS c_orders GROUP BY...
7.28
Nested subqueries present, creating potential correlated loop overhead. Pattern matching using LIKE may inhibit standard B-Tree index lookups.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 7.28x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00015
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey JOIN supplier ON l_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey JOIN region ON n_regionkey = r_reg...
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey JOIN supplier ON l_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey JOIN region ON n_regionkey = r_reg...
11.83
Complex multi-table join structure with 5 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 11.83x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00016
SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier JOIN ( SELECT l_suppkey, SUM(l_extendedprice * (1 - l_discount)) AS total_revenue FROM lineitem WHERE l_shipdate >= '1996-08-08' AND l_shipdate < '1996-11-08' GROUP BY ...
SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier JOIN ( SELECT l_suppkey, SUM(l_extendedprice * (1 - l_discount)) AS total_revenue FROM lineitem WHERE l_shipdate >= '1996-08-08' AND l_shipdate < '1996-11-08' GROUP BY ...
5.78
Nested subqueries present, creating potential correlated loop overhead.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 5.78x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00017
SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_shipdate >= '1996-04-12' AND l_shipdate < '1997-04-12' AND l_discount BETWEEN 0.05 AND 0.07 AND l_quantity < 25;
SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_shipdate >= '1996-04-12' AND l_shipdate < '1997-04-12' AND l_discount BETWEEN 0.05 AND 0.07 AND l_quantity < 25;
17.57
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 17.57x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00018
SELECT c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, SUM(l_quantity) AS total_qty FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice HAVING SUM(l_...
SELECT c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, SUM(l_quantity) AS total_qty FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice HAVING SUM(l_...
6.89
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 6.89x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00019
SELECT s_name, COUNT(*) AS numwait FROM supplier JOIN lineitem l1 ON s_suppkey = l1.l_suppkey JOIN orders ON l1.l_orderkey = o_orderkey JOIN nation ON s_nationkey = n_nationkey WHERE o_orderstatus = 'F' AND n_name = 'RUSSIA' AND l1.l_receiptdate > l1.l_commitd...
SELECT s_name, COUNT(*) AS numwait FROM supplier JOIN lineitem l1 ON s_suppkey = l1.l_suppkey JOIN orders ON l1.l_orderkey = o_orderkey JOIN nation ON s_nationkey = n_nationkey WHERE o_orderstatus = 'F' AND n_name = 'RUSSIA' AND l1.l_receiptdate > l1.l_commitd...
14.17
Complex multi-table join structure with 3 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 14.17x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00020
SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier JOIN ( SELECT l_suppkey, SUM(l_extendedprice * (1 - l_discount)) AS total_revenue FROM lineitem WHERE l_shipdate >= '1997-12-15' AND l_shipdate < '1998-03-15' GROUP BY ...
SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier JOIN ( SELECT l_suppkey, SUM(l_extendedprice * (1 - l_discount)) AS total_revenue FROM lineitem WHERE l_shipdate >= '1997-12-15' AND l_shipdate < '1998-03-15' GROUP BY ...
7.95
Nested subqueries present, creating potential correlated loop overhead.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 7.95x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00021
SELECT l_returnflag, l_linestatus, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity...
SELECT l_returnflag, l_linestatus, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity...
44.56
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 44.56x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00022
SELECT SUM(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem JOIN part ON l_partkey = p_partkey WHERE p_brand = 'Brand#44' AND p_container = 'SM BOX' AND l_quantity < 38;
SELECT SUM(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem JOIN part ON l_partkey = p_partkey WHERE p_brand = 'Brand#44' AND p_container = 'SM BOX' AND l_quantity < 38;
0.55
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 0.55x when evaluated on column-store execution.
sqlite
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00023
SELECT SUM(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem JOIN part ON l_partkey = p_partkey WHERE p_brand = 'Brand#22' AND p_container = 'WRAP PKG' AND l_quantity < 37;
SELECT SUM(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem JOIN part ON l_partkey = p_partkey WHERE p_brand = 'Brand#22' AND p_container = 'WRAP PKG' AND l_quantity < 37;
0.6
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 0.6x when evaluated on column-store execution.
sqlite
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00024
SELECT s_name, s_address FROM supplier JOIN nation ON s_nationkey = n_nationkey WHERE n_name = 'VIETNAM' AND s_suppkey IN ( SELECT ps_suppkey FROM partsupp WHERE ps_availqty > 464 AND ps_partkey IN ( SELECT p...
SELECT s_name, s_address FROM supplier JOIN nation ON s_nationkey = n_nationkey WHERE n_name = 'VIETNAM' AND s_suppkey IN ( SELECT ps_suppkey FROM partsupp WHERE ps_availqty > 464 AND ps_partkey IN ( SELECT p...
1.12
Nested subqueries present, creating potential correlated loop overhead. Pattern matching using LIKE may inhibit standard B-Tree index lookups.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 1.12x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00025
SELECT c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, SUM(l_quantity) AS total_qty FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice HAVING SUM(l_...
SELECT c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, SUM(l_quantity) AS total_qty FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice HAVING SUM(l_...
10.35
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 10.35x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00026
SELECT o_orderpriority, COUNT(*) AS order_count FROM orders WHERE o_orderdate >= '1993-01-05' AND o_orderdate < '1993-04-05' AND EXISTS ( SELECT 1 FROM lineitem WHERE l_orderkey = o_orderkey AND l_commitdate < l_receiptdate ) ...
SELECT o_orderpriority, COUNT(*) AS order_count FROM orders WHERE o_orderdate >= '1993-01-05' AND o_orderdate < '1993-04-05' AND EXISTS ( SELECT 1 FROM lineitem WHERE l_orderkey = o_orderkey AND l_commitdate < l_receiptdate ) ...
2.33
Nested subqueries present, creating potential correlated loop overhead.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 2.33x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00027
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey JOIN supplier ON l_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey JOIN region ON n_regionkey = r_reg...
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey JOIN supplier ON l_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey JOIN region ON n_regionkey = r_reg...
10.92
Complex multi-table join structure with 5 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 10.92x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00028
SELECT s_name, COUNT(*) AS numwait FROM supplier JOIN lineitem l1 ON s_suppkey = l1.l_suppkey JOIN orders ON l1.l_orderkey = o_orderkey JOIN nation ON s_nationkey = n_nationkey WHERE o_orderstatus = 'F' AND n_name = 'GERMANY' AND l1.l_receiptdate > l1.l_commit...
SELECT s_name, COUNT(*) AS numwait FROM supplier JOIN lineitem l1 ON s_suppkey = l1.l_suppkey JOIN orders ON l1.l_orderkey = o_orderkey JOIN nation ON s_nationkey = n_nationkey WHERE o_orderstatus = 'F' AND n_name = 'GERMANY' AND l1.l_receiptdate > l1.l_commit...
16.59
Complex multi-table join structure with 3 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 16.59x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00029
SELECT s_name, s_address, s_phone, s_acctbal, n_name FROM supplier JOIN nation ON s_nationkey = n_nationkey WHERE s_acctbal > 5284.34 ORDER BY s_acctbal DESC LIMIT 20;
SELECT s_name, s_address, s_phone, s_acctbal, n_name FROM supplier JOIN nation ON s_nationkey = n_nationkey WHERE s_acctbal > 5284.34 ORDER BY s_acctbal DESC LIMIT 20;
0.33
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 0.33x when evaluated on column-store execution.
sqlite
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00030
SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_shipdate >= '1996-03-22' AND l_shipdate < '1997-03-22' AND l_discount BETWEEN 0.05 AND 0.07 AND l_quantity < 25;
SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_shipdate >= '1996-03-22' AND l_shipdate < '1997-03-22' AND l_discount BETWEEN 0.05 AND 0.07 AND l_quantity < 25;
18.23
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 18.23x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00031
SELECT c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, SUM(l_quantity) AS total_qty FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice HAVING SUM(l_...
SELECT c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, SUM(l_quantity) AS total_qty FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice HAVING SUM(l_...
6.57
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 6.57x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00032
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM lineitem JOIN part ON l_partkey = p_partkey WHERE p_brand = 'Brand#32' AND l_quantity >= 6 AND l_quantity <= 25 AND p_size BETWEEN 1 AND 35;
SELECT SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM lineitem JOIN part ON l_partkey = p_partkey WHERE p_brand = 'Brand#32' AND l_quantity >= 6 AND l_quantity <= 25 AND p_size BETWEEN 1 AND 35;
2.91
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 2.91x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00033
SELECT o_orderdate, SUM(CASE WHEN n_name = 'CANADA' THEN l_extendedprice * (1 - l_discount) ELSE 0 END) AS nation_rev, SUM(l_extendedprice * (1 - l_discount)) AS total_rev FROM lineitem JOIN orders ON l_orderkey = o_orderkey JOIN customer ON o_custkey = c_custkey ...
SELECT o_orderdate, SUM(CASE WHEN n_name = 'CANADA' THEN l_extendedprice * (1 - l_discount) ELSE 0 END) AS nation_rev, SUM(l_extendedprice * (1 - l_discount)) AS total_rev FROM lineitem JOIN orders ON l_orderkey = o_orderkey JOIN customer ON o_custkey = c_custkey ...
20.74
Complex multi-table join structure with 3 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 20.74x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00034
SELECT s_name, s_address, s_phone, s_acctbal, n_name FROM supplier JOIN nation ON s_nationkey = n_nationkey WHERE s_acctbal > 7286.72 ORDER BY s_acctbal DESC LIMIT 20;
SELECT s_name, s_address, s_phone, s_acctbal, n_name FROM supplier JOIN nation ON s_nationkey = n_nationkey WHERE s_acctbal > 7286.72 ORDER BY s_acctbal DESC LIMIT 20;
0.34
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 0.34x when evaluated on column-store execution.
sqlite
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00035
SELECT l_returnflag, l_linestatus, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity...
SELECT l_returnflag, l_linestatus, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity...
50.65
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 50.65x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00036
SELECT c_custkey, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, n_name, c_address, c_phone FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey JOIN nation ON c_nationkey = n_nationkey W...
SELECT c_custkey, c_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue, c_acctbal, n_name, c_address, c_phone FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey JOIN nation ON c_nationkey = n_nationkey W...
1.87
Complex multi-table join structure with 3 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 1.87x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00037
SELECT substr(c_phone, 1, 2) AS cntrycode, COUNT(*) AS numcust, SUM(c_acctbal) AS totacctbal FROM customer WHERE substr(c_phone, 1, 2) IN ('10', '15', '13', '31', '29') AND c_acctbal > 3482.28 GROUP BY cntrycode ORDER BY cntrycode;
SELECT substr(c_phone, 1, 2) AS cntrycode, COUNT(*) AS numcust, SUM(c_acctbal) AS totacctbal FROM customer WHERE substr(c_phone, 1, 2) IN ('10', '15', '13', '31', '29') AND c_acctbal > 3482.28 GROUP BY cntrycode ORDER BY cntrycode;
2.26
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 2.26x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00038
SELECT 100.00 * SUM(CASE WHEN p_type LIKE 'PROMO%' THEN l_extendedprice * (1 - l_discount) ELSE 0 END) / SUM(l_extendedprice * (1 - l_discount)) AS promo_revenue FROM lineitem JOIN part ON l_partkey = p_partkey WHER...
SELECT 100.00 * SUM(CASE WHEN p_type LIKE 'PROMO%' THEN l_extendedprice * (1 - l_discount) ELSE 0 END) / SUM(l_extendedprice * (1 - l_discount)) AS promo_revenue FROM lineitem JOIN part ON l_partkey = p_partkey WHER...
2.79
Pattern matching using LIKE may inhibit standard B-Tree index lookups.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 2.79x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00039
SELECT SUM(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem JOIN part ON l_partkey = p_partkey WHERE p_brand = 'Brand#33' AND p_container = 'LG PKG' AND l_quantity < 29;
SELECT SUM(l_extendedprice) / 7.0 AS avg_yearly FROM lineitem JOIN part ON l_partkey = p_partkey WHERE p_brand = 'Brand#33' AND p_container = 'LG PKG' AND l_quantity < 29;
0.62
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 0.62x when evaluated on column-store execution.
sqlite
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00040
SELECT l_shipmode, SUM(CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END) AS high_line_count, SUM(CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END) AS low_line_coun...
SELECT l_shipmode, SUM(CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END) AS high_line_count, SUM(CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END) AS low_line_coun...
8.14
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 8.14x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00041
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey JOIN supplier ON l_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey JOIN region ON n_regionkey = r_reg...
SELECT n_name, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey JOIN supplier ON l_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey JOIN region ON n_regionkey = r_reg...
11.49
Complex multi-table join structure with 5 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 11.49x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00042
SELECT o_orderdate, SUM(CASE WHEN n_name = 'CANADA' THEN l_extendedprice * (1 - l_discount) ELSE 0 END) AS nation_rev, SUM(l_extendedprice * (1 - l_discount)) AS total_rev FROM lineitem JOIN orders ON l_orderkey = o_orderkey JOIN customer ON o_custkey = c_custkey ...
SELECT o_orderdate, SUM(CASE WHEN n_name = 'CANADA' THEN l_extendedprice * (1 - l_discount) ELSE 0 END) AS nation_rev, SUM(l_extendedprice * (1 - l_discount)) AS total_rev FROM lineitem JOIN orders ON l_orderkey = o_orderkey JOIN customer ON o_custkey = c_custkey ...
11.34
Complex multi-table join structure with 3 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 11.34x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00043
SELECT l_shipmode, SUM(CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END) AS high_line_count, SUM(CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END) AS low_line_coun...
SELECT l_shipmode, SUM(CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END) AS high_line_count, SUM(CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END) AS low_line_coun...
8.19
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 8.19x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00044
SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM supplier JOIN lineitem ON s_suppkey = l_suppkey JOIN orders ON l_orderkey = o_orderkey JOIN customer ON o_custkey = c_custkey JOIN nation n1 ON s_nati...
SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM supplier JOIN lineitem ON s_suppkey = l_suppkey JOIN orders ON l_orderkey = o_orderkey JOIN customer ON o_custkey = c_custkey JOIN nation n1 ON s_nati...
4.49
Complex multi-table join structure with 5 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 4.49x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00045
SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_shipdate >= '1995-07-15' AND l_shipdate < '1996-07-15' AND l_discount BETWEEN 0.07 AND 0.09 AND l_quantity < 25;
SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_shipdate >= '1995-07-15' AND l_shipdate < '1996-07-15' AND l_discount BETWEEN 0.07 AND 0.09 AND l_quantity < 25;
14.95
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 14.95x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00046
SELECT l_shipmode, SUM(CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END) AS high_line_count, SUM(CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END) AS low_line_coun...
SELECT l_shipmode, SUM(CASE WHEN o_orderpriority = '1-URGENT' OR o_orderpriority = '2-HIGH' THEN 1 ELSE 0 END) AS high_line_count, SUM(CASE WHEN o_orderpriority <> '1-URGENT' AND o_orderpriority <> '2-HIGH' THEN 1 ELSE 0 END) AS low_line_coun...
6.68
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 6.68x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00047
SELECT o_orderpriority, COUNT(*) AS order_count FROM orders WHERE o_orderdate >= '1993-03-01' AND o_orderdate < '1993-06-01' AND EXISTS ( SELECT 1 FROM lineitem WHERE l_orderkey = o_orderkey AND l_commitdate < l_receiptdate ) ...
SELECT o_orderpriority, COUNT(*) AS order_count FROM orders WHERE o_orderdate >= '1993-03-01' AND o_orderdate < '1993-06-01' AND EXISTS ( SELECT 1 FROM lineitem WHERE l_orderkey = o_orderkey AND l_commitdate < l_receiptdate ) ...
2.03
Nested subqueries present, creating potential correlated loop overhead.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 2.03x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00048
SELECT c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, SUM(l_quantity) AS total_qty FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice HAVING SUM(l_...
SELECT c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice, SUM(l_quantity) AS total_qty FROM customer JOIN orders ON c_custkey = o_custkey JOIN lineitem ON l_orderkey = o_orderkey GROUP BY c_name, c_custkey, o_orderkey, o_orderdate, o_totalprice HAVING SUM(l_...
12.1
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 12.1x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00049
SELECT 100.00 * SUM(CASE WHEN p_type LIKE 'PROMO%' THEN l_extendedprice * (1 - l_discount) ELSE 0 END) / SUM(l_extendedprice * (1 - l_discount)) AS promo_revenue FROM lineitem JOIN part ON l_partkey = p_partkey WHER...
SELECT 100.00 * SUM(CASE WHEN p_type LIKE 'PROMO%' THEN l_extendedprice * (1 - l_discount) ELSE 0 END) / SUM(l_extendedprice * (1 - l_discount)) AS promo_revenue FROM lineitem JOIN part ON l_partkey = p_partkey WHER...
2.79
Pattern matching using LIKE may inhibit standard B-Tree index lookups.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 2.79x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00050
SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier JOIN ( SELECT l_suppkey, SUM(l_extendedprice * (1 - l_discount)) AS total_revenue FROM lineitem WHERE l_shipdate >= '1997-05-14' AND l_shipdate < '1997-08-14' GROUP BY ...
SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier JOIN ( SELECT l_suppkey, SUM(l_extendedprice * (1 - l_discount)) AS total_revenue FROM lineitem WHERE l_shipdate >= '1997-05-14' AND l_shipdate < '1997-08-14' GROUP BY ...
5.79
Nested subqueries present, creating potential correlated loop overhead.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 5.79x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00051
SELECT 100.00 * SUM(CASE WHEN p_type LIKE 'PROMO%' THEN l_extendedprice * (1 - l_discount) ELSE 0 END) / SUM(l_extendedprice * (1 - l_discount)) AS promo_revenue FROM lineitem JOIN part ON l_partkey = p_partkey WHER...
SELECT 100.00 * SUM(CASE WHEN p_type LIKE 'PROMO%' THEN l_extendedprice * (1 - l_discount) ELSE 0 END) / SUM(l_extendedprice * (1 - l_discount)) AS promo_revenue FROM lineitem JOIN part ON l_partkey = p_partkey WHER...
2.5
Pattern matching using LIKE may inhibit standard B-Tree index lookups.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 2.5x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00052
SELECT o_orderpriority, COUNT(*) AS order_count FROM orders WHERE o_orderdate >= '1993-01-16' AND o_orderdate < '1993-04-16' AND EXISTS ( SELECT 1 FROM lineitem WHERE l_orderkey = o_orderkey AND l_commitdate < l_receiptdate ) ...
SELECT o_orderpriority, COUNT(*) AS order_count FROM orders WHERE o_orderdate >= '1993-01-16' AND o_orderdate < '1993-04-16' AND EXISTS ( SELECT 1 FROM lineitem WHERE l_orderkey = o_orderkey AND l_commitdate < l_receiptdate ) ...
2.37
Nested subqueries present, creating potential correlated loop overhead.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 2.37x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00053
SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier JOIN ( SELECT l_suppkey, SUM(l_extendedprice * (1 - l_discount)) AS total_revenue FROM lineitem WHERE l_shipdate >= '1996-03-10' AND l_shipdate < '1996-06-10' GROUP BY ...
SELECT s_suppkey, s_name, s_address, s_phone, total_revenue FROM supplier JOIN ( SELECT l_suppkey, SUM(l_extendedprice * (1 - l_discount)) AS total_revenue FROM lineitem WHERE l_shipdate >= '1996-03-10' AND l_shipdate < '1996-06-10' GROUP BY ...
6.93
Nested subqueries present, creating potential correlated loop overhead.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 6.93x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00054
SELECT c_count, COUNT(*) AS custdist FROM ( SELECT c_custkey, COUNT(o_orderkey) AS c_count FROM customer LEFT JOIN orders ON c_custkey = o_custkey AND o_comment NOT LIKE '%unusual%packages%' GROUP BY c_custkey ) AS c_orders GROUP BY...
SELECT c_count, COUNT(*) AS custdist FROM ( SELECT c_custkey, COUNT(o_orderkey) AS c_count FROM customer LEFT JOIN orders ON c_custkey = o_custkey AND o_comment NOT LIKE '%unusual%packages%' GROUP BY c_custkey ) AS c_orders GROUP BY...
6.74
Nested subqueries present, creating potential correlated loop overhead. Pattern matching using LIKE may inhibit standard B-Tree index lookups.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 6.74x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00055
SELECT s_name, COUNT(*) AS numwait FROM supplier JOIN lineitem l1 ON s_suppkey = l1.l_suppkey JOIN orders ON l1.l_orderkey = o_orderkey JOIN nation ON s_nationkey = n_nationkey WHERE o_orderstatus = 'F' AND n_name = 'UNITED KINGDOM' AND l1.l_receiptdate > l1.l...
SELECT s_name, COUNT(*) AS numwait FROM supplier JOIN lineitem l1 ON s_suppkey = l1.l_suppkey JOIN orders ON l1.l_orderkey = o_orderkey JOIN nation ON s_nationkey = n_nationkey WHERE o_orderstatus = 'F' AND n_name = 'UNITED KINGDOM' AND l1.l_receiptdate > l1.l...
17.84
Complex multi-table join structure with 3 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 17.84x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00056
SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_shipdate >= '1994-07-27' AND l_shipdate < '1995-07-27' AND l_discount BETWEEN 0.02 AND 0.04 AND l_quantity < 24;
SELECT SUM(l_extendedprice * l_discount) AS revenue FROM lineitem WHERE l_shipdate >= '1994-07-27' AND l_shipdate < '1995-07-27' AND l_discount BETWEEN 0.02 AND 0.04 AND l_quantity < 24;
15.73
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 15.73x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00057
SELECT l_returnflag, l_linestatus, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity...
SELECT l_returnflag, l_linestatus, SUM(l_quantity) AS sum_qty, SUM(l_extendedprice) AS sum_base_price, SUM(l_extendedprice * (1 - l_discount)) AS sum_disc_price, SUM(l_extendedprice * (1 - l_discount) * (1 + l_tax)) AS sum_charge, AVG(l_quantity...
55.35
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 55.35x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00058
SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM supplier JOIN lineitem ON s_suppkey = l_suppkey JOIN orders ON l_orderkey = o_orderkey JOIN customer ON o_custkey = c_custkey JOIN nation n1 ON s_nati...
SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM supplier JOIN lineitem ON s_suppkey = l_suppkey JOIN orders ON l_orderkey = o_orderkey JOIN customer ON o_custkey = c_custkey JOIN nation n1 ON s_nati...
4.55
Complex multi-table join structure with 5 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 4.55x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00059
SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM supplier JOIN lineitem ON s_suppkey = l_suppkey JOIN orders ON l_orderkey = o_orderkey JOIN customer ON o_custkey = c_custkey JOIN nation n1 ON s_nati...
SELECT n1.n_name AS supp_nation, n2.n_name AS cust_nation, SUM(l_extendedprice * (1 - l_discount)) AS revenue FROM supplier JOIN lineitem ON s_suppkey = l_suppkey JOIN orders ON l_orderkey = o_orderkey JOIN customer ON o_custkey = c_custkey JOIN nation n1 ON s_nati...
3.12
Complex multi-table join structure with 5 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 3.12x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00060
SELECT 100.00 * SUM(CASE WHEN p_type LIKE 'PROMO%' THEN l_extendedprice * (1 - l_discount) ELSE 0 END) / SUM(l_extendedprice * (1 - l_discount)) AS promo_revenue FROM lineitem JOIN part ON l_partkey = p_partkey WHER...
SELECT 100.00 * SUM(CASE WHEN p_type LIKE 'PROMO%' THEN l_extendedprice * (1 - l_discount) ELSE 0 END) / SUM(l_extendedprice * (1 - l_discount)) AS promo_revenue FROM lineitem JOIN part ON l_partkey = p_partkey WHER...
2.93
Pattern matching using LIKE may inhibit standard B-Tree index lookups.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 2.93x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00061
SELECT o_orderdate, SUM(CASE WHEN n_name = 'MOROCCO' THEN l_extendedprice * (1 - l_discount) ELSE 0 END) AS nation_rev, SUM(l_extendedprice * (1 - l_discount)) AS total_rev FROM lineitem JOIN orders ON l_orderkey = o_orderkey JOIN customer ON o_custkey = c_custkey ...
SELECT o_orderdate, SUM(CASE WHEN n_name = 'MOROCCO' THEN l_extendedprice * (1 - l_discount) ELSE 0 END) AS nation_rev, SUM(l_extendedprice * (1 - l_discount)) AS total_rev FROM lineitem JOIN orders ON l_orderkey = o_orderkey JOIN customer ON o_custkey = c_custkey ...
10.19
Complex multi-table join structure with 3 joins requiring optimal join reordering.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 10.19x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
qp_00062
SELECT ps_partkey, SUM(ps_supplycost * ps_availqty) AS value FROM partsupp JOIN supplier ON ps_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey WHERE n_name = 'FRANCE' GROUP BY ps_partkey HAVING SUM(ps_supplycost * ps_availqty) > 997287 ORDER BY value ...
SELECT ps_partkey, SUM(ps_supplycost * ps_availqty) AS value FROM partsupp JOIN supplier ON ps_suppkey = s_suppkey JOIN nation ON s_nationkey = n_nationkey WHERE n_name = 'FRANCE' GROUP BY ps_partkey HAVING SUM(ps_supplycost * ps_availqty) > 997287 ORDER BY value ...
6.72
High row scanning overhead on unindexed filter attributes.
Restructured query filters and join ordering to reduce intermediate Cartesian volume. Observed engine acceleration factor of 6.72x when evaluated on column-store execution.
duckdb
[ { "role": "system", "content": "You are QueryPilot-SLM, an expert database optimization assistant. Analyze the provided SQL query and execution context. Identify the performance bottleneck, explain the optimization reasoning, and generate a high-performance, semantically equivalent optimized SQL query." }...
End of preview. Expand in Data Studio
README.md exists but content is empty.
Downloads last month
35