From 0ac6d56594059e9c12bef79d77b215575fc203f5 Mon Sep 17 00:00:00 2001 From: Daniel Harrison Date: Wed, 1 Jun 2016 12:15:08 -0400 Subject: [PATCH] sql: turn on column family heuristics MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit name old time/op new time/op delta Bank2_Cockroach-32 12.2ms ±44% 12.9ms ±35% ~ (p=0.529 n=10+10) Bank4_Cockroach-32 9.32ms ±52% 9.66ms ±39% ~ (p=0.579 n=10+10) Bank8_Cockroach-32 4.44ms ±52% 4.82ms ±26% ~ (p=0.190 n=10+10) Bank16_Cockroach-32 3.09ms ±38% 2.68ms ± 8% ~ (p=0.113 n=9+9) Bank32_Cockroach-32 2.00ms ±26% 2.09ms ±21% ~ (p=0.549 n=9+10) Bank64_Cockroach-32 1.53ms ±14% 1.51ms ±34% ~ (p=0.315 n=10+10) Insert1_Cockroach-32 517µs ± 2% 513µs ± 2% ~ (p=0.165 n=10+10) Insert10_Cockroach-32 671µs ± 2% 671µs ± 2% ~ (p=0.912 n=10+10) Insert100_Cockroach-32 1.82ms ± 3% 1.80ms ± 3% ~ (p=0.247 n=10+10) Insert1000_Cockroach-32 12.2ms ± 3% 12.1ms ± 4% ~ (p=0.065 n=10+9) Update1_Cockroach-32 722µs ± 1% 725µs ± 3% ~ (p=0.853 n=10+10) Update10_Cockroach-32 1.15ms ± 2% 1.13ms ± 3% ~ (p=0.089 n=10+10) Update100_Cockroach-32 4.51ms ± 2% 4.44ms ± 4% ~ (p=0.095 n=9+10) Update1000_Cockroach-32 35.5ms ±10% 33.4ms ± 3% -6.11% (p=0.000 n=10+10) Upsert1_Cockroach-32 1.77ms ± 2% 1.71ms ± 1% -3.33% (p=0.000 n=9+9) Upsert10_Cockroach-32 2.21ms ± 2% 1.95ms ± 2% -11.85% (p=0.000 n=10+9) Upsert100_Cockroach-32 6.85ms ± 2% 4.50ms ± 2% -34.35% (p=0.000 n=10+10) Upsert1000_Cockroach-32 54.6ms ± 5% 29.8ms ± 2% -45.48% (p=0.000 n=9+10) Delete1_Cockroach-32 738µs ± 2% 691µs ± 2% -6.30% (p=0.000 n=10+10) Delete10_Cockroach-32 1.28ms ± 3% 0.86ms ± 1% -32.94% (p=0.000 n=10+10) Delete100_Cockroach-32 6.37ms ± 7% 2.33ms ± 1% -63.43% (p=0.000 n=10+9) Delete1000_Cockroach-32 64.8ms ± 7% 17.6ms ± 6% -72.79% (p=0.000 n=10+10) TrackChoices1_Cockroach-32 607µs ± 5% 593µs ± 2% ~ (p=0.068 n=10+8) TrackChoices10_Cockroach-32 127µs ± 2% 112µs ± 5% -11.13% (p=0.000 n=10+10) TrackChoices100_Cockroach-32 73.0µs ± 4% 60.4µs ± 2% -17.19% (p=0.000 n=10+10) TrackChoices1000_Cockroach-32 67.3µs ± 4% 55.2µs ± 4% -17.97% (p=0.000 n=10+9) InsertDistinct1_Cockroach-32 1.63ms ± 2% 1.62ms ± 2% ~ (p=0.190 n=9+9) InsertDistinct10_Cockroach-32 1.16ms ± 3% 1.15ms ± 3% ~ (p=0.579 n=10+10) InsertDistinct100_Cockroach-32 1.54ms ± 3% 1.55ms ± 3% ~ (p=0.447 n=9+10) WideTable1_Cockroach-32 2.32ms ± 2% 2.31ms ± 2% ~ (p=0.353 n=10+10) WideTable10_Cockroach-32 3.69ms ± 2% 3.64ms ± 1% ~ (p=0.065 n=10+9) WideTable100_Cockroach-32 16.3ms ± 2% 16.3ms ± 4% ~ (p=0.393 n=10+10) WideTable1000_Cockroach-32 138ms ± 1% 137ms ± 2% ~ (p=0.095 n=9+10) name old alloc/op new alloc/op delta Bank2_Cockroach-32 1.07MB ±35% 1.15MB ±34% ~ (p=0.315 n=10+10) Bank4_Cockroach-32 976kB ±31% 971kB ±25% ~ (p=0.684 n=10+10) Bank8_Cockroach-32 573kB ± 7% 619kB ±19% ~ (p=0.211 n=9+10) Bank16_Cockroach-32 431kB ± 6% 420kB ± 4% ~ (p=0.133 n=9+10) Bank32_Cockroach-32 327kB ±19% 334kB ±14% ~ (p=1.000 n=10+10) Bank64_Cockroach-32 262kB ± 3% 259kB ± 4% ~ (p=0.218 n=10+10) Insert1_Cockroach-32 30.2kB ± 0% 30.2kB ± 0% ~ (p=0.091 n=10+7) Insert10_Cockroach-32 75.5kB ± 0% 75.5kB ± 0% ~ (p=0.956 n=10+10) Insert100_Cockroach-32 491kB ± 0% 491kB ± 0% ~ (p=0.887 n=7+10) Insert1000_Cockroach-32 4.17MB ± 0% 4.17MB ± 0% ~ (p=0.780 n=10+9) Update1_Cockroach-32 52.5kB ± 0% 52.3kB ± 0% -0.52% (p=0.000 n=10+10) Update10_Cockroach-32 123kB ± 0% 120kB ± 0% -1.68% (p=0.000 n=7+9) Update100_Cockroach-32 799kB ± 0% 776kB ± 0% -2.83% (p=0.000 n=9+9) Update1000_Cockroach-32 6.56MB ± 0% 6.36MB ± 0% -3.01% (p=0.000 n=8+8) Upsert1_Cockroach-32 105kB ± 0% 99kB ± 0% -5.90% (p=0.000 n=10+10) Upsert10_Cockroach-32 174kB ± 0% 130kB ± 0% -24.93% (p=0.000 n=9+10) Upsert100_Cockroach-32 946kB ± 0% 557kB ± 0% -41.11% (p=0.000 n=9+10) Upsert1000_Cockroach-32 7.91MB ± 1% 4.50MB ± 0% -43.13% (p=0.000 n=10+8) Delete1_Cockroach-32 45.8kB ± 0% 44.4kB ± 0% -2.95% (p=0.000 n=9+10) Delete10_Cockroach-32 71.4kB ± 0% 54.5kB ± 0% -23.64% (p=0.000 n=9+10) Delete100_Cockroach-32 311kB ± 0% 158kB ± 1% -49.08% (p=0.000 n=10+10) Delete1000_Cockroach-32 3.19MB ± 0% 1.07MB ± 0% -66.47% (p=0.000 n=8+9) TrackChoices1_Cockroach-32 47.3kB ± 0% 44.6kB ± 0% -5.63% (p=0.000 n=10+8) TrackChoices10_Cockroach-32 23.8kB ± 0% 16.7kB ± 0% -29.65% (p=0.000 n=8+9) TrackChoices100_Cockroach-32 20.1kB ± 0% 16.1kB ± 0% -19.93% (p=0.000 n=9+6) TrackChoices1000_Cockroach-32 22.7kB ± 0% 17.7kB ± 0% -21.74% (p=0.000 n=9+10) InsertDistinct1_Cockroach-32 306kB ± 0% 306kB ± 0% ~ (p=0.620 n=9+9) InsertDistinct10_Cockroach-32 319kB ± 0% 319kB ± 0% ~ (p=0.971 n=10+10) InsertDistinct100_Cockroach-32 476kB ± 0% 476kB ± 0% ~ (p=0.905 n=9+10) WideTable1_Cockroach-32 172kB ± 0% 172kB ± 0% ~ (p=0.251 n=9+10) WideTable10_Cockroach-32 378kB ± 0% 378kB ± 0% ~ (p=0.278 n=9+10) WideTable100_Cockroach-32 2.38MB ± 0% 2.38MB ± 0% ~ (p=0.661 n=9+10) WideTable1000_Cockroach-32 21.2MB ± 0% 21.2MB ± 0% ~ (p=0.315 n=10+9) name old allocs/op new allocs/op delta Bank2_Cockroach-32 11.7k ±36% 12.4k ±33% ~ (p=0.353 n=10+10) Bank4_Cockroach-32 10.7k ±29% 10.6k ±24% ~ (p=0.796 n=10+10) Bank8_Cockroach-32 6.49k ± 8% 7.01k ±17% ~ (p=0.211 n=9+10) Bank16_Cockroach-32 4.98k ± 7% 4.88k ± 4% ~ (p=0.315 n=9+10) Bank32_Cockroach-32 3.80k ±18% 3.88k ±12% ~ (p=0.912 n=10+10) Bank64_Cockroach-32 3.09k ± 3% 3.07k ± 4% ~ (p=0.698 n=10+10) Insert1_Cockroach-32 302 ± 0% 303 ± 0% ~ (p=0.450 n=10+10) Insert10_Cockroach-32 510 ± 0% 510 ± 0% ~ (all samples are equal) Insert100_Cockroach-32 2.35k ± 0% 2.35k ± 0% ~ (p=0.873 n=10+10) Insert1000_Cockroach-32 20.5k ± 0% 20.5k ± 0% ~ (p=0.643 n=10+10) Update1_Cockroach-32 577 ± 0% 582 ± 0% +0.94% (p=0.000 n=10+10) Update10_Cockroach-32 888 ± 0% 886 ± 0% -0.23% (p=0.000 n=10+10) Update100_Cockroach-32 3.68k ± 0% 3.59k ± 0% -2.41% (p=0.000 n=9+10) Update1000_Cockroach-32 29.7k ± 0% 28.8k ± 0% -2.87% (p=0.000 n=9+8) Upsert1_Cockroach-32 1.16k ± 0% 1.13k ± 0% -2.75% (p=0.001 n=7+7) Upsert10_Cockroach-32 1.55k ± 0% 1.41k ± 0% -9.32% (p=0.000 n=8+10) Upsert100_Cockroach-32 5.69k ± 0% 4.36k ± 0% -23.34% (p=0.000 n=10+10) Upsert1000_Cockroach-32 46.7k ± 0% 33.4k ± 0% -28.44% (p=0.000 n=10+8) Delete1_Cockroach-32 480 ± 0% 468 ± 0% -2.71% (p=0.000 n=10+10) Delete10_Cockroach-32 685 ± 0% 591 ± 0% -13.66% (p=0.000 n=8+10) Delete100_Cockroach-32 2.60k ± 0% 1.69k ± 0% -34.86% (p=0.000 n=9+10) Delete1000_Cockroach-32 21.6k ± 0% 12.6k ± 0% -41.83% (p=0.000 n=8+10) TrackChoices1_Cockroach-32 399 ± 0% 389 ± 0% -2.60% (p=0.000 n=10+8) TrackChoices10_Cockroach-32 118 ± 0% 107 ± 0% -9.32% (p=0.000 n=10+10) TrackChoices100_Cockroach-32 87.0 ± 0% 76.0 ± 0% -12.64% (p=0.000 n=10+8) TrackChoices1000_Cockroach-32 83.0 ± 0% 73.0 ± 0% -12.05% (p=0.000 n=10+10) InsertDistinct1_Cockroach-32 1.91k ± 0% 1.91k ± 0% ~ (p=0.137 n=8+10) InsertDistinct10_Cockroach-32 1.98k ± 0% 1.97k ± 0% ~ (p=0.845 n=10+9) InsertDistinct100_Cockroach-32 3.32k ± 0% 3.32k ± 0% ~ (p=0.386 n=9+9) WideTable1_Cockroach-32 1.97k ± 0% 1.97k ± 0% ~ (p=0.961 n=8+10) WideTable10_Cockroach-32 4.03k ± 0% 4.03k ± 0% ~ (p=0.515 n=10+10) WideTable100_Cockroach-32 24.0k ± 0% 24.0k ± 0% ~ (p=0.669 n=10+10) WideTable1000_Cockroach-32 224k ± 0% 224k ± 0% -0.01% (p=0.042 n=9+9) --- acceptance/util_test.go | 2 +- cli/dump_test.go | 15 +++----- sql/bench_test.go | 3 +- sql/schema_changer_test.go | 18 +++++----- sql/show_test.go | 26 +++++--------- sql/sqlbase/structured.go | 36 ++++++++++++++----- sql/sqlbase/structured_test.go | 13 +++---- sql/testdata/aggregate | 9 +++-- sql/testdata/alter_table | 10 ++---- sql/testdata/create_index | 4 ++- sql/testdata/datetime | 5 ++- sql/testdata/family | 10 +++--- sql/testdata/select_non_covering_index | 6 +++- .../select_non_covering_index_filtering | 6 +++- sql/testdata/table | 20 +++++------ sql/testdata/update | 4 ++- 16 files changed, 97 insertions(+), 90 deletions(-) diff --git a/acceptance/util_test.go b/acceptance/util_test.go index 447b531cf1e3..6623dab59519 100644 --- a/acceptance/util_test.go +++ b/acceptance/util_test.go @@ -322,7 +322,7 @@ func testDockerSuccess(t *testing.T, name string, cmd []string) { const ( // NB: postgresTestTag is grepped for in circle-deps.sh, so don't rename it. - postgresTestTag = "20160623-2125" + postgresTestTag = "20160705-1326" // Iterating against a locally built version of the docker image can be done // by changing postgresTestImage to the hash of the container. postgresTestImage = "cockroachdb/postgres-test:" + postgresTestTag diff --git a/cli/dump_test.go b/cli/dump_test.go index 8d91b4609abf..1bca5ce81ef8 100644 --- a/cli/dump_test.go +++ b/cli/dump_test.go @@ -95,17 +95,10 @@ CREATE TABLE t ( o BOOL NULL, e DECIMAL NULL, tz TIMESTAMP WITH TIME ZONE NULL, - FAMILY "primary" (rowid), - FAMILY fam_1_i (i), - FAMILY fam_2_f (f), - FAMILY fam_3_s (s), - FAMILY fam_4_b (b), - FAMILY fam_5_d (d), - FAMILY fam_6_t (t), - FAMILY fam_7_n (n), - FAMILY fam_8_o (o), - FAMILY fam_9_e (e), - FAMILY fam_10_tz (tz) + FAMILY "primary" (i, f, d, t, n, o, tz, rowid), + FAMILY fam_1_s (s), + FAMILY fam_2_b (b), + FAMILY fam_3_e (e) ); INSERT INTO t VALUES diff --git a/sql/bench_test.go b/sql/bench_test.go index ee3180f62da2..ee1916f1ce06 100644 --- a/sql/bench_test.go +++ b/sql/bench_test.go @@ -1184,8 +1184,7 @@ func runBenchmarkWideTable(b *testing.B, db *gosql.DB, count int) { const schema = `CREATE TABLE bench.widetable ( f1 INT, f2 INT, f3 INT, f4 INT, f5 INT, f6 INT, f7 INT, f8 INT, f9 INT, f10 INT, f11 INT, f12 INT, f13 INT, f14 INT, f15 INT, f16 INT, f17 INT, f18 INT, f19 INT, f20 INT, - PRIMARY KEY (f1, f2, f3), - FAMILY (f1, f2, f3, f4, f5, f6, f7, f8, f9, f10, f11, f12, f13, f14, f15, f16, f17, f18, f19, f20) + PRIMARY KEY (f1, f2, f3) )` if _, err := db.Exec(schema); err != nil { b.Fatal(err) diff --git a/sql/schema_changer_test.go b/sql/schema_changer_test.go index cc0692f0406b..6262a6c9b69c 100644 --- a/sql/schema_changer_test.go +++ b/sql/schema_changer_test.go @@ -555,11 +555,11 @@ CREATE UNIQUE INDEX vidx ON t.test (v); tableDesc := sqlbase.GetTableDescriptor(kvDB, "t", "test") tablePrefix := roachpb.Key(keys.MakeTablePrefix(uint32(tableDesc.ID))) tableEnd := tablePrefix.PrefixEnd() - // number of keys == 4 * number of rows; 3 columns and 1 index entry for - // each row. + // number of keys == 3 * number of rows; 2 column families and 1 index entry + // for each row. if kvs, err := kvDB.Scan(tablePrefix, tableEnd, 0); err != nil { t.Fatal(err) - } else if e := 4 * (maxValue + 1); len(kvs) != e { + } else if e := 3 * (maxValue + 1); len(kvs) != e { t.Fatalf("expected %d key value pairs, but got %d", e, len(kvs)) } @@ -573,7 +573,7 @@ CREATE UNIQUE INDEX vidx ON t.test (v); kvDB, "ALTER TABLE t.test ADD COLUMN x DECIMAL DEFAULT (DECIMAL '1.4')", maxValue, - 5, + 4, backfillNotification) // Drop column. @@ -584,7 +584,7 @@ CREATE UNIQUE INDEX vidx ON t.test (v); kvDB, "ALTER TABLE t.test DROP pi", maxValue, - 4, + 3, backfillNotification) // Add index. @@ -595,7 +595,7 @@ CREATE UNIQUE INDEX vidx ON t.test (v); kvDB, "CREATE UNIQUE INDEX foo ON t.test (v)", maxValue, - 5, + 4, backfillNotification) // Drop index. @@ -606,7 +606,7 @@ CREATE UNIQUE INDEX vidx ON t.test (v); kvDB, "DROP INDEX t.test@vidx", maxValue, - 4, + 3, backfillNotification) // Verify that the index foo over v is consistent, and that column x has @@ -858,7 +858,7 @@ CREATE TABLE t.test (k INT PRIMARY KEY, v INT); tableEnd := tablePrefix.PrefixEnd() if kvs, err := kvDB.Scan(tablePrefix, tableEnd, 0); err != nil { t.Fatal(err) - } else if e := 2*(maxValue+2) + numGarbageValues; len(kvs) != e { + } else if e := 1*(maxValue+2) + numGarbageValues; len(kvs) != e { t.Fatalf("expected %d key value pairs, but got %d", e, len(kvs)) } @@ -878,7 +878,7 @@ CREATE TABLE t.test (k INT PRIMARY KEY, v INT); numGarbageValues = 0 if kvs, err := kvDB.Scan(tablePrefix, tableEnd, 0); err != nil { t.Fatal(err) - } else if e := 2*(maxValue+2) + numGarbageValues; len(kvs) != e { + } else if e := 1*(maxValue+2) + numGarbageValues; len(kvs) != e { t.Fatalf("expected %d key value pairs, but got %d", e, len(kvs)) } } diff --git a/sql/show_test.go b/sql/show_test.go index 466350d59961..f80730df733b 100644 --- a/sql/show_test.go +++ b/sql/show_test.go @@ -54,11 +54,8 @@ func TestShowCreateTable(t *testing.T) { s STRING NULL, v FLOAT NOT NULL, t TIMESTAMP NULL DEFAULT NOW(), - FAMILY "primary" (rowid), - FAMILY fam_1_i (i), - FAMILY fam_2_s (s), - FAMILY fam_3_v (v), - FAMILY fam_4_t (t), + FAMILY "primary" (i, v, t, rowid), + FAMILY fam_1_s (s), CHECK (i > 0) )`, }, @@ -74,11 +71,8 @@ func TestShowCreateTable(t *testing.T) { s STRING NULL, v FLOAT NOT NULL, t TIMESTAMP NULL DEFAULT NOW(), - FAMILY "primary" (rowid), - FAMILY fam_1_i (i), - FAMILY fam_2_s (s), - FAMILY fam_3_v (v), - FAMILY fam_4_t (t), + FAMILY "primary" (i, v, t, rowid), + FAMILY fam_1_s (s), CHECK (i > 0) )`, }, @@ -91,9 +85,8 @@ func TestShowCreateTable(t *testing.T) { expect: `CREATE TABLE %s ( i INT NULL, s STRING NULL, - FAMILY "primary" (rowid), - FAMILY fam_1_i (i), - FAMILY fam_2_s (s), + FAMILY "primary" (i, rowid), + FAMILY fam_1_s (s), CONSTRAINT ck CHECK (i > 0) )`, }, @@ -120,11 +113,8 @@ func TestShowCreateTable(t *testing.T) { d DATE NULL, INDEX idx_if (f, i) STORING (s, d), UNIQUE INDEX %[1]s_d_key (d), - FAMILY "primary" (rowid), - FAMILY fam_1_i (i), - FAMILY fam_2_f (f), - FAMILY fam_3_s (s), - FAMILY fam_4_d (d) + FAMILY "primary" (i, f, d, rowid), + FAMILY fam_1_s (s) )`, }, { diff --git a/sql/sqlbase/structured.go b/sql/sqlbase/structured.go index 02ce2089b6af..affc8ba0b019 100644 --- a/sql/sqlbase/structured.go +++ b/sql/sqlbase/structured.go @@ -456,19 +456,37 @@ func (desc *TableDescriptor) AllocateIDs() error { return } if _, ok := primaryIndexColIDs[col.ID]; ok { + // Primary index columns are required to be assigned to family 0. desc.Families[0].ColumnNames = append(desc.Families[0].ColumnNames, col.Name) desc.Families[0].ColumnIDs = append(desc.Families[0].ColumnIDs, col.ID) return } - // TODO(dan): This assigns families such that the encoding is exactly the - // same as before column families. A followup commit will implement the - // heuristics described in the families rfc. - familyID := FamilyID(col.ID) - desc.Families = append(desc.Families, ColumnFamilyDescriptor{ - ID: familyID, - ColumnNames: []string{col.Name}, - ColumnIDs: []ColumnID{col.ID}, - }) + var familyID FamilyID + if desc.ParentID == keys.SystemDatabaseID { + // TODO(dan): This assigns families such that the encoding is exactly the + // same as before column families. It's used for all system tables because + // reads of them don't go through the normal sql layer, which is where the + // knowledge of families lives. Fix that and remove this workaround. + familyID = FamilyID(col.ID) + desc.Families = append(desc.Families, ColumnFamilyDescriptor{ + ID: familyID, + ColumnNames: []string{col.Name}, + ColumnIDs: []ColumnID{col.ID}, + }) + } else { + idx, ok := fitColumnToFamily(*desc, *col) + if !ok { + idx = len(desc.Families) + desc.Families = append(desc.Families, ColumnFamilyDescriptor{ + ID: desc.NextFamilyID, + ColumnNames: []string{}, + ColumnIDs: []ColumnID{}, + }) + } + familyID = desc.Families[idx].ID + desc.Families[idx].ColumnNames = append(desc.Families[idx].ColumnNames, col.Name) + desc.Families[idx].ColumnIDs = append(desc.Families[idx].ColumnIDs, col.ID) + } if familyID >= desc.NextFamilyID { desc.NextFamilyID = familyID + 1 } diff --git a/sql/sqlbase/structured_test.go b/sql/sqlbase/structured_test.go index cd86ab611610..9fd5fd9222f9 100644 --- a/sql/sqlbase/structured_test.go +++ b/sql/sqlbase/structured_test.go @@ -76,14 +76,9 @@ func TestAllocateIDs(t *testing.T) { Families: []ColumnFamilyDescriptor{ { ID: 0, Name: "primary", - ColumnNames: []string{"a", "b"}, - ColumnIDs: []ColumnID{1, 2}, - }, - { - ID: 3, Name: "fam_3_c", - ColumnNames: []string{"c"}, - ColumnIDs: []ColumnID{3}, - DefaultColumnID: ColumnID(3), + ColumnNames: []string{"a", "b", "c"}, + ColumnIDs: []ColumnID{1, 2, 3}, + DefaultColumnID: 3, }, }, PrimaryIndex: IndexDescriptor{ @@ -101,7 +96,7 @@ func TestAllocateIDs(t *testing.T) { }, Privileges: NewDefaultPrivilegeDescriptor(), NextColumnID: 4, - NextFamilyID: 4, + NextFamilyID: 1, NextIndexID: 4, NextMutationID: 1, FormatVersion: FamilyFormatVersion, diff --git a/sql/testdata/aggregate b/sql/testdata/aggregate index 9939642b9e0b..43d1f6f7c7bf 100644 --- a/sql/testdata/aggregate +++ b/sql/testdata/aggregate @@ -476,7 +476,10 @@ CREATE TABLE xyz ( y INT, z FLOAT, INDEX xy (x, y), - INDEX zyx (z, y, x) + INDEX zyx (z, y, x), + FAMILY (x), + FAMILY (y), + FAMILY (z) ) statement ok @@ -705,7 +708,9 @@ false false statement OK CREATE TABLE ab ( a INT PRIMARY KEY, - b INT + b INT, + FAMILY (a), + FAMILY (b) ) statement OK diff --git a/sql/testdata/alter_table b/sql/testdata/alter_table index b004b73df66a..22c5abd6fe33 100644 --- a/sql/testdata/alter_table +++ b/sql/testdata/alter_table @@ -94,13 +94,9 @@ query ITTT colnames EXPLAIN (DEBUG) SELECT * FROM t ---- RowIdx Key Value Disposition -0 /t/primary/1 NULL ROW -1 /t/primary/2 NULL PARTIAL -1 /t/primary/2/b 1 PARTIAL -1 /t/primary/2/c 1 ROW -2 /t/primary/3 NULL PARTIAL -2 /t/primary/3/b 2 PARTIAL -2 /t/primary/3/c 1 ROW +0 /t/primary/1 NULL ROW +1 /t/primary/2/b/c /1/1 ROW +2 /t/primary/3/b/c /2/1 ROW statement ok ALTER TABLE t DROP b, DROP c diff --git a/sql/testdata/create_index b/sql/testdata/create_index index c798c6609a6a..b5951281c2eb 100644 --- a/sql/testdata/create_index +++ b/sql/testdata/create_index @@ -1,7 +1,9 @@ statement ok CREATE TABLE t ( a INT PRIMARY KEY, - b INT + b INT, + FAMILY (a), + FAMILY (b) ) statement ok diff --git a/sql/testdata/datetime b/sql/testdata/datetime index dd00f4372d55..acb392bfd5a5 100644 --- a/sql/testdata/datetime +++ b/sql/testdata/datetime @@ -4,7 +4,10 @@ CREATE TABLE t ( b DATE, c INTERVAL, UNIQUE (b), - UNIQUE (c) + UNIQUE (c), + FAMILY (a), + FAMILY (b), + FAMILY (c) ) statement ok diff --git a/sql/testdata/family b/sql/testdata/family index e3ef812b32ae..dead058b9e6f 100644 --- a/sql/testdata/family +++ b/sql/testdata/family @@ -80,7 +80,7 @@ SELECT * from abcd WHERE a > 1 # Check the descriptor bookkeeping statement ok -ALTER TABLE abcd ADD COLUMN f INT +ALTER TABLE abcd ADD COLUMN f DECIMAL query TT SHOW CREATE TABLE abcd @@ -91,11 +91,11 @@ abcd CREATE TABLE abcd ( c INT NULL, d INT NULL, e STRING NULL, - f INT NULL, + f DECIMAL NULL, CONSTRAINT "primary" PRIMARY KEY (a), FAMILY f1 (a, b, e), FAMILY fam_1_c_d (c, d), - FAMILY fam_6_f (f) + FAMILY fam_2_f (f) ) statement ok @@ -107,10 +107,10 @@ SHOW CREATE TABLE abcd abcd CREATE TABLE abcd ( a INT NOT NULL, b INT NULL, - f INT NULL, + f DECIMAL NULL, CONSTRAINT "primary" PRIMARY KEY (a), FAMILY f1 (a, b), - FAMILY fam_6_f (f) + FAMILY fam_2_f (f) ) statement error unknown family \"foo\" diff --git a/sql/testdata/select_non_covering_index b/sql/testdata/select_non_covering_index index ad8714e3f979..48f4a2ed6097 100644 --- a/sql/testdata/select_non_covering_index +++ b/sql/testdata/select_non_covering_index @@ -5,7 +5,11 @@ CREATE TABLE t ( c INT, d INT, INDEX b (b), - UNIQUE INDEX c (c) + UNIQUE INDEX c (c), + FAMILY (a), + FAMILY (b), + FAMILY (c), + FAMILY (d) ) statement ok diff --git a/sql/testdata/select_non_covering_index_filtering b/sql/testdata/select_non_covering_index_filtering index 83e9b4402c74..e0e6e046361e 100644 --- a/sql/testdata/select_non_covering_index_filtering +++ b/sql/testdata/select_non_covering_index_filtering @@ -8,7 +8,11 @@ CREATE TABLE t ( b INT, c INT, s STRING, - INDEX bc (b, c) + INDEX bc (b, c), + FAMILY (a), + FAMILY (b), + FAMILY (c), + FAMILY (s) ) statement ok diff --git a/sql/testdata/table b/sql/testdata/table index e9e365d9901f..498dadf6f15a 100644 --- a/sql/testdata/table +++ b/sql/testdata/table @@ -186,12 +186,10 @@ test.users CREATE TABLE "test.users" CONSTRAINT "primary" PRIMARY KEY (id), INDEX foo (name), UNIQUE INDEX bar (id, name), - FAMILY "primary" (id), - FAMILY fam_2_name (name), - FAMILY fam_3_title (title), - FAMILY fam_4_nickname (nickname), - FAMILY fam_5_username (username), - FAMILY fam_6_email (email), + FAMILY "primary" (id, username, email), + FAMILY fam_1_name (name), + FAMILY fam_2_title (title), + FAMILY fam_3_nickname (nickname), CHECK (LENGTH(nickname) < LENGTH(name)), CHECK (LENGTH(nickname) < 10) ) @@ -225,12 +223,10 @@ test.named_constraints CREATE TABLE "test.named_constraints" ( INDEX foo (name), UNIQUE INDEX uq2 (username), UNIQUE INDEX bar (id, name), - FAMILY "primary" (id), - FAMILY fam_2_name (name), - FAMILY fam_3_title (title), - FAMILY fam_4_nickname (nickname), - FAMILY fam_5_username (username), - FAMILY fam_6_email (email), + FAMILY "primary" (id, username, email), + FAMILY fam_1_name (name), + FAMILY fam_2_title (title), + FAMILY fam_3_nickname (nickname), CONSTRAINT ck2 CHECK (LENGTH(nickname) < LENGTH(name)), CONSTRAINT ck1 CHECK (LENGTH(nickname) < 10) ) diff --git a/sql/testdata/update b/sql/testdata/update index fb92f16fc390..173cc343f121 100644 --- a/sql/testdata/update +++ b/sql/testdata/update @@ -248,7 +248,9 @@ CREATE TABLE pks ( k2 INT, v INT, PRIMARY KEY (k1, k2), - UNIQUE INDEX i (k2, v) + UNIQUE INDEX i (k2, v), + FAMILY (k1, k2), + FAMILY (v) ) statement ok