diff --git a/docs/generated/settings/settings.html b/docs/generated/settings/settings.html index 4eff757180ce..6e4b8b65ff44 100644 --- a/docs/generated/settings/settings.html +++ b/docs/generated/settings/settings.html @@ -92,7 +92,7 @@ server.web_session_timeoutduration168h0m0sthe duration that a newly created web session will be valid sql.defaults.default_int_sizeinteger8the size, in bytes, of an INT type sql.defaults.distsqlenumerationautodefault distributed SQL execution mode [off = 0, auto = 1, on = 2] -sql.defaults.optimizer_foreign_keys.enabledbooleanfalseenables optimizer-driven foreign key checks by default +sql.defaults.experimental_optimizer_foreign_keys.enabledbooleanfalseenables optimizer-driven foreign key checks by default sql.defaults.reorder_joins_limitinteger4default number of joins to reorder sql.defaults.results_buffer.sizebyte size16 KiBdefault size of the buffer that accumulates results for a statement or a batch of statements before they are sent to the client. This can be overridden on an individual connection with the 'results_buffer_size' parameter. Note that auto-retries generally only happen while no results have been delivered to the client, so reducing this size can increase the number of retriable errors a client receives. On the other hand, increasing the buffer size can increase the delay until the client receives the first result row. Updating the setting only affects new connections. Setting to 0 disables any buffering. sql.defaults.serial_normalizationenumerationrowiddefault handling of SERIAL in table definitions [rowid = 0, virtual_sequence = 1, sql_sequence = 2] diff --git a/pkg/sql/exec_util.go b/pkg/sql/exec_util.go index d60e9b73daf4..0d5909b13aff 100644 --- a/pkg/sql/exec_util.go +++ b/pkg/sql/exec_util.go @@ -135,7 +135,7 @@ var ReorderJoinsLimitClusterValue = settings.RegisterValidatedIntSetting( ) var optDrivenFKClusterMode = settings.RegisterBoolSetting( - "sql.defaults.optimizer_foreign_keys.enabled", + "sql.defaults.experimental_optimizer_foreign_keys.enabled", "enables optimizer-driven foreign key checks by default", false, ) diff --git a/pkg/sql/logictest/testdata/logic_test/cascade b/pkg/sql/logictest/testdata/logic_test/cascade index ead8524e57e3..1d72d51bb2cf 100644 --- a/pkg/sql/logictest/testdata/logic_test/cascade +++ b/pkg/sql/logictest/testdata/logic_test/cascade @@ -1,6 +1,6 @@ # The tests in this file target the legacy FK paths. statement ok -SET optimizer_foreign_keys = false +SET experimental_optimizer_foreign_keys = false subtest AllCascadingActions ### A test of all cascading actions in their most basic form. diff --git a/pkg/sql/logictest/testdata/logic_test/cascade_opt b/pkg/sql/logictest/testdata/logic_test/cascade_opt index c17023e6d32e..3752c51775cd 100644 --- a/pkg/sql/logictest/testdata/logic_test/cascade_opt +++ b/pkg/sql/logictest/testdata/logic_test/cascade_opt @@ -1,7 +1,7 @@ # The tests in this file target the new optimizer-driven FK paths (with # fall back on the legacy paths for unsupported cases). statement ok -SET optimizer_foreign_keys = true +SET experimental_optimizer_foreign_keys = true subtest AllCascadingActions ### A test of all cascading actions in their most basic form. diff --git a/pkg/sql/logictest/testdata/logic_test/fk b/pkg/sql/logictest/testdata/logic_test/fk index 634d28c7685d..8a6ca8888e54 100644 --- a/pkg/sql/logictest/testdata/logic_test/fk +++ b/pkg/sql/logictest/testdata/logic_test/fk @@ -6,7 +6,7 @@ # The tests in this file target the legacy FK paths. statement ok -SET optimizer_foreign_keys = false +SET experimental_optimizer_foreign_keys = false # Disable automatic stats to avoid flakiness. statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/fk-mixed-19.1-19.2 b/pkg/sql/logictest/testdata/logic_test/fk-mixed-19.1-19.2 index cdbe34b6302f..bc9bb8dea32b 100644 --- a/pkg/sql/logictest/testdata/logic_test/fk-mixed-19.1-19.2 +++ b/pkg/sql/logictest/testdata/logic_test/fk-mixed-19.1-19.2 @@ -7,7 +7,7 @@ # validated when added in 19.1, hence the need for different logic tests. statement ok -SET optimizer_foreign_keys = false +SET experimental_optimizer_foreign_keys = false # Disable automatic stats to avoid flakiness. statement ok diff --git a/pkg/sql/logictest/testdata/logic_test/fk_opt b/pkg/sql/logictest/testdata/logic_test/fk_opt index c9a57fb81321..a1b5fa34beff 100644 --- a/pkg/sql/logictest/testdata/logic_test/fk_opt +++ b/pkg/sql/logictest/testdata/logic_test/fk_opt @@ -3,7 +3,7 @@ # The tests in this file target the new optimizer-driven FK paths (with # fall back on the legacy paths for unsupported cases). statement ok -SET optimizer_foreign_keys = true +SET experimental_optimizer_foreign_keys = true # Insert # ------ diff --git a/pkg/sql/logictest/testdata/logic_test/json_builtins b/pkg/sql/logictest/testdata/logic_test/json_builtins index efdffbdfd557..9fe45fb9930e 100644 --- a/pkg/sql/logictest/testdata/logic_test/json_builtins +++ b/pkg/sql/logictest/testdata/logic_test/json_builtins @@ -1031,4 +1031,3 @@ query T SELECT '["a", {"b":1}]'::jsonb #- '{1,b}' ---- ["a", {}] - diff --git a/pkg/sql/logictest/testdata/logic_test/pg_catalog b/pkg/sql/logictest/testdata/logic_test/pg_catalog index 210b1971a178..fd5f4b5cf0d6 100644 --- a/pkg/sql/logictest/testdata/logic_test/pg_catalog +++ b/pkg/sql/logictest/testdata/logic_test/pg_catalog @@ -1526,6 +1526,7 @@ default_transaction_read_only off NULL NULL N distsql off NULL NULL NULL string enable_zigzag_join on NULL NULL NULL string experimental_force_split_at off NULL NULL NULL string +experimental_optimizer_foreign_keys off NULL NULL NULL string experimental_serial_normalization rowid NULL NULL NULL string extra_float_digits 0 NULL NULL NULL string force_savepoint_restart off NULL NULL NULL string @@ -1536,7 +1537,6 @@ locality region=test,dc=dc1 NULL NULL N lock_timeout 0 NULL NULL NULL string max_index_keys 32 NULL NULL NULL string node_id 1 NULL NULL NULL string -optimizer_foreign_keys off NULL NULL NULL string reorder_joins_limit 4 NULL NULL NULL string results_buffer_size 16384 NULL NULL NULL string row_security off NULL NULL NULL string @@ -1580,6 +1580,7 @@ default_transaction_read_only off NULL user NULL distsql off NULL user NULL off off enable_zigzag_join on NULL user NULL on on experimental_force_split_at off NULL user NULL off off +experimental_optimizer_foreign_keys off NULL user NULL off off experimental_serial_normalization rowid NULL user NULL rowid rowid extra_float_digits 0 NULL user NULL 0 2 force_savepoint_restart off NULL user NULL off off @@ -1590,7 +1591,6 @@ locality region=test,dc=dc1 NULL user NULL lock_timeout 0 NULL user NULL 0 0 max_index_keys 32 NULL user NULL 32 32 node_id 1 NULL user NULL 1 1 -optimizer_foreign_keys off NULL user NULL off off reorder_joins_limit 4 NULL user NULL 4 4 results_buffer_size 16384 NULL user NULL 16384 16384 row_security off NULL user NULL off off @@ -1630,6 +1630,7 @@ default_transaction_read_only NULL NULL NULL NULL NULL distsql NULL NULL NULL NULL NULL enable_zigzag_join NULL NULL NULL NULL NULL experimental_force_split_at NULL NULL NULL NULL NULL +experimental_optimizer_foreign_keys NULL NULL NULL NULL NULL experimental_serial_normalization NULL NULL NULL NULL NULL extra_float_digits NULL NULL NULL NULL NULL force_savepoint_restart NULL NULL NULL NULL NULL @@ -1641,7 +1642,6 @@ lock_timeout NULL NULL NULL NULL NULL max_index_keys NULL NULL NULL NULL NULL node_id NULL NULL NULL NULL NULL optimizer NULL NULL NULL NULL NULL -optimizer_foreign_keys NULL NULL NULL NULL NULL reorder_joins_limit NULL NULL NULL NULL NULL results_buffer_size NULL NULL NULL NULL NULL row_security NULL NULL NULL NULL NULL diff --git a/pkg/sql/logictest/testdata/logic_test/show_source b/pkg/sql/logictest/testdata/logic_test/show_source index fecbed1f2c3b..9a3e8bbe06c3 100644 --- a/pkg/sql/logictest/testdata/logic_test/show_source +++ b/pkg/sql/logictest/testdata/logic_test/show_source @@ -39,6 +39,7 @@ default_transaction_read_only off distsql off enable_zigzag_join on experimental_force_split_at off +experimental_optimizer_foreign_keys off experimental_serial_normalization rowid extra_float_digits 0 force_savepoint_restart off @@ -49,7 +50,6 @@ locality region=test,dc=dc1 lock_timeout 0 max_index_keys 32 node_id 1 -optimizer_foreign_keys off reorder_joins_limit 4 results_buffer_size 16384 row_security off diff --git a/pkg/sql/opt/bench/fk_test.go b/pkg/sql/opt/bench/fk_test.go index e546a19c8945..eb8735d1ed4e 100644 --- a/pkg/sql/opt/bench/fk_test.go +++ b/pkg/sql/opt/bench/fk_test.go @@ -44,7 +44,7 @@ func runFKBench( // Don't let auto stats interfere with the test. Stock stats are // sufficient to get the right plans (i.e. lookup join). r.Exec(b, "SET CLUSTER SETTING sql.stats.automatic_collection.enabled = false") - r.Exec(b, fmt.Sprintf("SET optimizer_foreign_keys = %v", cfg.optFKOn)) + r.Exec(b, fmt.Sprintf("SET experimental_optimizer_foreign_keys = %v", cfg.optFKOn)) setup(b, r, cfg.setupFKs) b.ResetTimer() run(b, r) diff --git a/pkg/sql/opt/exec/execbuilder/testdata/explain_env b/pkg/sql/opt/exec/execbuilder/testdata/explain_env index fa888b1ed194..172a6e07753c 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/explain_env +++ b/pkg/sql/opt/exec/execbuilder/testdata/explain_env @@ -85,12 +85,12 @@ EXPLAIN (OPT, ENV) SELECT * FROM y WHERE u = 3 https://cockroachdb.github.io/text/decode.html#eJxUj81O20AUhdfMUxyxwa5iAsqmSpTFYG7aaZ1xNJ5SIoQsx5nQKcFG4x_FrHgIP2GepEqTSmV57_3uOfrujKtsWYwRlvmzK7P81-0NzM7kq8Zu18ahNlWN9kgxFirimqD5TUTo4LGzBkLqz5CxhvwRRQN21p42xymMZaIVF1Lj_NXZl8x151goMedqie-0hNeAJ6H_Ed08p23qzCbdYRYrEl_kkW19KJqRIhlSgp2XHf6EvKV7dGmb2vUOXvsvb8bnIlr-V-s1A7Q-8yeM8UiTOnkcFC9fm9XW5pcdhPxGoUaiuRaJFmGCi4fHiwljCWk4U7q1cenv0hZVurUvtsYU11dXp7spstXWpG_26S17-kthinKzmTBG94uICwkvXugBSN75SCg6VH3CTMVzdPj5lRShwRSjCQuCIGBVnhXoGPZ9v-_f9_078rKoapfZoh5jeD3Gw3CEAMPRI_sTAAD___ayhqM= statement ok -SET optimizer_foreign_keys = true +SET experimental_optimizer_foreign_keys = true query T EXPLAIN (OPT, ENV) SELECT * FROM y WHERE u = 3 ---- -https://cockroachdb.github.io/text/decode.html#eJxUj81u2kwUhteZq3iVTexPOCRi8wnEwnGGdlozRuNpGhRFI2PGdAp40PhHmFUugivkSioKldrlOe9zfp4X7SpjyyEim6-dzfIfz0_Qe50vGrNZaodaVzXaC0VIJGgoKWT4FFN08MhNA8bl_-CJBP8Wxz1y0147lypKeCpFyLjE7c6Zbea6W8wEm4Zijq90Dq9BmEb-v2ixVq1yulB7TBJB2Sd-YVsfgk6ooDyiKfZedp5j_Jm-olOtMss9vPbPvkk4ZfH8r7Ne00PrE39ESBhLKq4eZ8X7XbPYmPy-A-NfaCSRylCyVLIoxd3b-92IkJRKOG3dUjv105qyUhuzNTXGeHx4uOa6zBYbrQ5mdchWvymMYYviGttdbbbmoJ0qrNNmVaq17qozUo4Ioa-zOGQcXjKTPVD-4iOl8fmZ_zARyRQdvn-mgqLBGIMRCYIgIFWelegITsfj6fhxOn4gt2VVu8yU9RD9xyHe-gME6A_eya8AAAD__30skp8= +https://cockroachdb.github.io/text/decode.html#eJxUj8tu2kAUhteZp_iVTewqDonYVCAWjjO005oxGk_ToCgaGTOmU4yNxhfZrPIQPCFPUlGI1C7P-b9z-Z61rUxZjBCU6caWSfrr6RG60-myMflKW9S6qtGeKUICQX1JIf3HkKKHQ64aMC4_g0cS_EcY3pKr9tI5V0HEYyl8xiWud9ZsE9tfYy7YzBcLfKcLOA38OHD_R7ONapXVmeowjQRlX_iZbV0IOqWC8oDG6JzkNMf4E31Br1plVh2c9mPf1J-xcPHPWae5ResSd0yIH0oqLh4nxbtds8xNeteD8W80kIilL1ksWRDj5vXtZkxITCWsLu1KW_W7NEWlcrM1NSZ4uL-_5LpIlrlWe7PeJ-u_FCYos-wj7nbamq0u6iRX5a42W7PXVmWl1WZdqI3uqxNfjAmhL_PQZxxONJe3oPzZRUzD02efMBXRDD1-fqWCosEEwzHxPM8jVZoU6AmOh8Px8H48vCMti6q2iSnqEQYPI7wOhvAwGL6RPwEAAP__x3qYDA== statement ok RESET reorder_joins_limit @@ -99,7 +99,7 @@ statement ok RESET enable_zigzag_join statement ok -RESET optimizer_foreign_keys +RESET experimental_optimizer_foreign_keys # # Test sequences. diff --git a/pkg/sql/opt/exec/execbuilder/testdata/fk_opt b/pkg/sql/opt/exec/execbuilder/testdata/fk_opt index 53d291a12bbe..e6c44e894e81 100644 --- a/pkg/sql/opt/exec/execbuilder/testdata/fk_opt +++ b/pkg/sql/opt/exec/execbuilder/testdata/fk_opt @@ -1,7 +1,7 @@ # LogicTest: local statement ok -SET optimizer_foreign_keys = true +SET experimental_optimizer_foreign_keys = true statement ok CREATE TABLE parent (p INT PRIMARY KEY, other INT) diff --git a/pkg/sql/opt_exec_factory.go b/pkg/sql/opt_exec_factory.go index 009fbdf9e52a..88f6245ec130 100644 --- a/pkg/sql/opt_exec_factory.go +++ b/pkg/sql/opt_exec_factory.go @@ -1102,7 +1102,7 @@ FROM for _, param := range []string{ "enable_zigzag_join", - "optimizer_foreign_keys", + "experimental_optimizer_foreign_keys", } { value, err := ef.environmentQuery(fmt.Sprintf("SHOW %s", param)) if err != nil { diff --git a/pkg/sql/vars.go b/pkg/sql/vars.go index 1b1f88d16538..a6c40cc7f513 100644 --- a/pkg/sql/vars.go +++ b/pkg/sql/vars.go @@ -442,8 +442,8 @@ var varGen = map[string]sessionVar{ }, // CockroachDB extension. - `optimizer_foreign_keys`: { - GetStringVal: makeBoolGetStringValFn(`optimizer_foreign_keys`), + `experimental_optimizer_foreign_keys`: { + GetStringVal: makeBoolGetStringValFn(`experimental_optimizer_foreign_keys`), Set: func(_ context.Context, m *sessionDataMutator, s string) error { b, err := parsePostgresBool(s) if err != nil {