You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
156889: sql/schemachanger: execute validation operations in batches for indexes r=fqazi a=fqazi
Previously, when ALTER PRIMARY KEY was issued or multiple indexes were created in a single transaction, we would end up recounting the table for each index. This patch modifies the validation logic to batch counts of indexes together on the same table.
Fixes: #156590
Release note (performance improvement): Optimize validation queries during ALTER PRIMARY KEY to avoid counting the primary key multiple times.
Co-authored-by: Faizan Qazi <[email protected]>
Copy file name to clipboardExpand all lines: pkg/ccl/schemachangerccl/testdata/end_to_end/add_column_multiple_regional_by_row/add_column_multiple_regional_by_row.side_effects
+1-2Lines changed: 1 addition & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -1389,8 +1389,7 @@ update progress of schema change job #1: "Pending: Validating index (2 operation
1389
1389
commit transaction #24
1390
1390
begin transaction #25
1391
1391
## PostCommitPhase stage 23 of 23 with 2 ValidationType ops
1392
-
validate forward indexes [2] in table #108
1393
-
validate forward indexes [4] in table #108
1392
+
validate forward indexes [2 4] in table #108
1394
1393
commit transaction #25
1395
1394
begin transaction #26
1396
1395
## PostCommitNonRevertiblePhase stage 1 of 5 with 33 MutationType ops
Copy file name to clipboardExpand all lines: pkg/ccl/schemachangerccl/testdata/end_to_end/alter_table_alter_primary_key_rbr/alter_table_alter_primary_key_rbr.side_effects
+1-2Lines changed: 1 addition & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -968,9 +968,8 @@ update progress of schema change job #1: "Pending: Validating NOT NULL constrain
968
968
commit transaction #16
969
969
begin transaction #17
970
970
## PostCommitPhase stage 15 of 24 with 3 ValidationType ops
971
-
validate forward indexes [10] in table #108
971
+
validate forward indexes [10 4] in table #108
972
972
validate CHECK constraint crdb_internal_k_shard_16_auto_not_null in table #108
973
-
validate forward indexes [4] in table #108
974
973
commit transaction #17
975
974
begin transaction #18
976
975
## PostCommitPhase stage 16 of 24 with 27 MutationType ops
Copy file name to clipboardExpand all lines: pkg/sql/schemachanger/testdata/end_to_end/alter_table_add_primary_key_drop_rowid_with_secondary_idx/alter_table_add_primary_key_drop_rowid_with_secondary_idx.side_effects
+1-3Lines changed: 1 addition & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -887,9 +887,7 @@ update progress of schema change job #1: "Pending: Validating index (3 operation
887
887
commit transaction #8
888
888
begin transaction #9
889
889
## PostCommitPhase stage 7 of 16 with 3 ValidationType ops
890
-
validate forward indexes [10] in table #104
891
-
validate forward indexes [6] in table #104
892
-
validate forward indexes [8] in table #104
890
+
validate forward indexes [10 6 8] in table #104
893
891
commit transaction #9
894
892
begin transaction #10
895
893
## PostCommitPhase stage 8 of 16 with 23 MutationType ops
Copy file name to clipboardExpand all lines: pkg/sql/schemachanger/testdata/end_to_end/alter_table_alter_primary_key_drop_rowid_with_idx/alter_table_alter_primary_key_drop_rowid_with_idx.side_effects
+1-2Lines changed: 1 addition & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -814,8 +814,7 @@ update progress of schema change job #1: "Pending: Validating index (2 operation
814
814
commit transaction #16
815
815
begin transaction #17
816
816
## PostCommitPhase stage 15 of 23 with 2 ValidationType ops
817
-
validate forward indexes [8] in table #104
818
-
validate forward indexes [4] in table #104
817
+
validate forward indexes [8 4] in table #104
819
818
commit transaction #17
820
819
begin transaction #18
821
820
## PostCommitPhase stage 16 of 23 with 17 MutationType ops
Copy file name to clipboardExpand all lines: pkg/sql/schemachanger/testdata/end_to_end/alter_table_alter_primary_key_using_hash/alter_table_alter_primary_key_using_hash.side_effects
+1-2Lines changed: 1 addition & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -616,9 +616,8 @@ update progress of schema change job #1: "Pending: Validating NOT NULL constrain
616
616
commit transaction #8
617
617
begin transaction #9
618
618
## PostCommitPhase stage 7 of 16 with 3 ValidationType ops
619
-
validate forward indexes [8] in table #104
619
+
validate forward indexes [8 4] in table #104
620
620
validate CHECK constraint crdb_internal_j_shard_3_auto_not_null in table #104
621
-
validate forward indexes [4] in table #104
622
621
commit transaction #9
623
622
begin transaction #10
624
623
## PostCommitPhase stage 8 of 16 with 20 MutationType ops
Copy file name to clipboardExpand all lines: pkg/sql/schemachanger/testdata/end_to_end/alter_table_alter_primary_key_vanilla/alter_table_alter_primary_key_vanilla.side_effects
+1-4Lines changed: 1 addition & 4 deletions
Original file line number
Diff line number
Diff line change
@@ -739,10 +739,7 @@ update progress of schema change job #1: "Pending: Validating index (4 operation
739
739
commit transaction #8
740
740
begin transaction #9
741
741
## PostCommitPhase stage 7 of 15 with 4 ValidationType ops
742
-
validate forward indexes [16] in table #104
743
-
validate forward indexes [8] in table #104
744
-
validate forward indexes [10] in table #104
745
-
validate forward indexes [12] in table #104
742
+
validate forward indexes [16 8 10 12] in table #104
746
743
commit transaction #9
747
744
begin transaction #10
748
745
## PostCommitPhase stage 8 of 15 with 23 MutationType ops
0 commit comments