@@ -1522,18 +1522,75 @@ impl DatabricksAdapter {
15221522 async fn create_lakebase_pg_indexes ( & self , lakebase_config : & LakebaseConfig ) -> Result < ( ) > {
15231523 let client = self . connect_lakebase_pg ( ) . await ?;
15241524
1525+ let s = & lakebase_config. schema ;
15251526 let index_stmts = [
1527+ // Existing indexes
15261528 format ! (
1527- "CREATE INDEX IF NOT EXISTS idx_lineitem_partkey_quantity ON \" {}\" .lineitem (l_partkey, l_quantity)" ,
1528- lakebase_config. schema
1529+ "CREATE INDEX IF NOT EXISTS idx_lineitem_partkey_quantity ON \" {s}\" .lineitem (l_partkey, l_quantity)"
15291530 ) ,
15301531 format ! (
1531- "CREATE INDEX IF NOT EXISTS idx_lineitem_partkey_suppkey_shipdate ON \" {}\" .lineitem (l_partkey, l_suppkey, l_shipdate, l_quantity)" ,
1532- lakebase_config. schema
1532+ "CREATE INDEX IF NOT EXISTS idx_lineitem_partkey_suppkey_shipdate ON \" {s}\" .lineitem (l_partkey, l_suppkey, l_shipdate, l_quantity)"
15331533 ) ,
15341534 format ! (
1535- "CREATE INDEX IF NOT EXISTS idx_part_name_prefix ON \" {}\" .part USING btree (p_name text_pattern_ops)" ,
1536- lakebase_config. schema
1535+ "CREATE INDEX IF NOT EXISTS idx_part_name_prefix ON \" {s}\" .part USING btree (p_name text_pattern_ops)"
1536+ ) ,
1537+ // Customer
1538+ format ! (
1539+ "CREATE INDEX IF NOT EXISTS idx_customer_mktsegment ON \" {s}\" .customer (c_mktsegment)"
1540+ ) ,
1541+ format ! (
1542+ "CREATE INDEX IF NOT EXISTS idx_customer_nation_custkey ON \" {s}\" .customer (c_nationkey, c_custkey)"
1543+ ) ,
1544+ // Orders
1545+ format ! (
1546+ "CREATE INDEX IF NOT EXISTS idx_orders_cust_orderdate ON \" {s}\" .orders (o_custkey, o_orderdate)"
1547+ ) ,
1548+ format ! (
1549+ "CREATE INDEX IF NOT EXISTS idx_orders_cust_orderdate_key ON \" {s}\" .orders (o_custkey, o_orderdate, o_orderkey)"
1550+ ) ,
1551+ format ! (
1552+ "CREATE INDEX IF NOT EXISTS idx_orders_orderdate_key ON \" {s}\" .orders (o_orderdate, o_orderkey)"
1553+ ) ,
1554+ format ! (
1555+ "CREATE INDEX IF NOT EXISTS idx_orders_status_orderkey ON \" {s}\" .orders (o_orderstatus, o_orderkey)"
1556+ ) ,
1557+ format ! (
1558+ "CREATE INDEX IF NOT EXISTS idx_orders_cust_comment ON \" {s}\" .orders (o_custkey, o_comment, o_orderkey)"
1559+ ) ,
1560+ // Lineitem
1561+ format ! (
1562+ "CREATE INDEX IF NOT EXISTS idx_lineitem_order_shipdate ON \" {s}\" .lineitem (l_orderkey, l_shipdate)"
1563+ ) ,
1564+ format ! (
1565+ "CREATE INDEX IF NOT EXISTS idx_lineitem_order_supp ON \" {s}\" .lineitem (l_orderkey, l_suppkey)"
1566+ ) ,
1567+ format ! (
1568+ "CREATE INDEX IF NOT EXISTS idx_lineitem_part_supp_order ON \" {s}\" .lineitem (l_partkey, l_suppkey, l_orderkey)"
1569+ ) ,
1570+ format ! (
1571+ "CREATE INDEX IF NOT EXISTS idx_lineitem_supp_order_commit ON \" {s}\" .lineitem (l_suppkey, l_orderkey, l_commitdate, l_receiptdate)"
1572+ ) ,
1573+ // Supplier
1574+ format ! (
1575+ "CREATE INDEX IF NOT EXISTS idx_supplier_nationkey_suppkey ON \" {s}\" .supplier (s_nationkey, s_suppkey)"
1576+ ) ,
1577+ // Nation
1578+ format ! (
1579+ "CREATE INDEX IF NOT EXISTS idx_nation_key_name ON \" {s}\" .nation (n_nationkey, n_name)"
1580+ ) ,
1581+ format ! (
1582+ "CREATE INDEX IF NOT EXISTS idx_nation_name_nationkey ON \" {s}\" .nation (n_name, n_nationkey)"
1583+ ) ,
1584+ // Part
1585+ format ! (
1586+ "CREATE INDEX IF NOT EXISTS idx_part_type_partkey ON \" {s}\" .part (p_type, p_partkey)"
1587+ ) ,
1588+ format ! (
1589+ "CREATE INDEX IF NOT EXISTS idx_part_type_cover ON \" {s}\" .part (p_type, p_partkey, p_name)"
1590+ ) ,
1591+ // Partsupp
1592+ format ! (
1593+ "CREATE INDEX IF NOT EXISTS idx_partsupp_part_supp_cost ON \" {s}\" .partsupp (ps_partkey, ps_suppkey, ps_supplycost)"
15371594 ) ,
15381595 ] ;
15391596
0 commit comments