Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions doc/user/content/reference/system-catalog/mz_internal.md
Original file line number Diff line number Diff line change
Expand Up @@ -820,6 +820,19 @@ The `mz_sessions` table contains a row for each active session in the system.
| `connected_at` | [`timestamp with time zone`] | The time at which the session connected to the system. |


## `mz_overridden_system_parameters`

The `mz_overridden_system_parameters` view contains a row for each system parameter whose
environment-wide value differs from its default, as set by `ALTER SYSTEM`.
Parameters left at their default are not listed.

<!-- RELATION_SPEC mz_internal.mz_overridden_system_parameters -->
| Field | Type | Meaning |
| ------------ | -------- | -------- |
| `name` | [`text`] | The name of the system parameter. |
| `value` | [`text`] | The environment-wide value of the system parameter. |


## `mz_cluster_system_parameters`

The `mz_cluster_system_parameters` view contains a row for each cluster-coherent
Expand Down
1 change: 1 addition & 0 deletions src/catalog/src/builtin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1186,6 +1186,7 @@ pub static BUILTINS_STATIC: LazyLock<Vec<Builtin<NameReference>>> = LazyLock::ne
Builtin::Table(&MZ_AWS_CONNECTIONS),
Builtin::Table(&MZ_SUBSCRIPTIONS),
Builtin::Table(&MZ_SESSIONS),
Builtin::MaterializedView(&MZ_OVERRIDDEN_SYSTEM_PARAMETERS),
Builtin::MaterializedView(&MZ_CLUSTER_SYSTEM_PARAMETERS),
Builtin::MaterializedView(&MZ_REPLICA_SYSTEM_PARAMETERS),
Builtin::MaterializedView(&MZ_DEFAULT_PRIVILEGES),
Expand Down
43 changes: 43 additions & 0 deletions src/catalog/src/builtin/mz_internal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2866,6 +2866,49 @@ pub static MZ_SESSIONS: LazyLock<BuiltinTable> = LazyLock::new(|| BuiltinTable {
}),
});

pub static MZ_OVERRIDDEN_SYSTEM_PARAMETERS: LazyLock<BuiltinMaterializedView> =
LazyLock::new(|| BuiltinMaterializedView {
name: "mz_overridden_system_parameters",
schema: MZ_INTERNAL_SCHEMA,
oid: oid::MV_MZ_OVERRIDDEN_SYSTEM_PARAMETERS_OID,
desc: RelationDesc::builder()
.with_column("name", SqlScalarType::String.nullable(false))
.with_column("value", SqlScalarType::String.nullable(false))
.finish(),
column_comments: BTreeMap::from_iter([
("name", "The name of the system parameter."),
(
"value",
"The environment-wide value of the system parameter.",
),
]),
// Projects the durable `system_configurations` collection (the
// `ALTER SYSTEM` set) out of `mz_catalog_raw` (the durable catalog as
// JSON): the key is `{name}` and the value is `{value}`. This surfaces
// only parameters with an explicit environment-wide override, mirroring
// the cluster- and replica-scoped views. Parameters left at their
// default are absent.
sql: "
IN CLUSTER mz_catalog_server
WITH (
ASSERT NOT NULL name,
ASSERT NOT NULL value
) AS
SELECT
data->'key'->>'name' AS name,
data->'value'->>'value' AS value
FROM mz_internal.mz_catalog_raw
WHERE data->>'kind' = 'ServerConfiguration'",
is_retained_metrics_object: false,
access: vec![PUBLIC_SELECT],
ontology: Some(Ontology {
entity_name: "system_parameter",
description: "Environment-wide system parameter overrides",
links: &const { [] },
column_semantic_types: &[],
}),
});

pub static MZ_CLUSTER_SYSTEM_PARAMETERS: LazyLock<BuiltinMaterializedView> =
LazyLock::new(|| BuiltinMaterializedView {
name: "mz_cluster_system_parameters",
Expand Down
1 change: 1 addition & 0 deletions src/pgrepr-consts/src/oid.rs
Original file line number Diff line number Diff line change
Expand Up @@ -805,3 +805,4 @@ pub const MV_MZ_CLUSTER_SYSTEM_PARAMETERS_OID: u32 = 17091;
pub const MV_MZ_REPLICA_SYSTEM_PARAMETERS_OID: u32 = 17092;
pub const FUNC_MZ_GEN_SERIES_UNOPT_OID: u32 = 17093;
pub const FUNC_MZ_GEN_SERIES_UNOPT_STEP_OID: u32 = 17094;
pub const MV_MZ_OVERRIDDEN_SYSTEM_PARAMETERS_OID: u32 = 17095;
7 changes: 7 additions & 0 deletions test/sqllogictest/autogenerated/mz_internal.slt
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,12 @@ role_id text The␠role␠ID␠of␠the␠role␠that␠the␠session␠is␠l
client_ip text The␠IP␠address␠of␠the␠client␠that␠initiated␠the␠session.
connected_at timestamp␠with␠time␠zone The␠time␠at␠which␠the␠session␠connected␠to␠the␠system.

query TTT
SELECT name, type, comment FROM objects WHERE schema = 'mz_internal' AND object = 'mz_overridden_system_parameters' ORDER BY position
----
name text The␠name␠of␠the␠system␠parameter.
value text The␠environment-wide␠value␠of␠the␠system␠parameter.

query TTT
SELECT name, type, comment FROM objects WHERE schema = 'mz_internal' AND object = 'mz_cluster_system_parameters' ORDER BY position
----
Expand Down Expand Up @@ -812,6 +818,7 @@ mz_ontology_link_types
mz_ontology_properties
mz_ontology_semantic_types
mz_optimizer_notices
mz_overridden_system_parameters
mz_pending_cluster_replicas
mz_postgres_source_tables
mz_postgres_sources
Expand Down
29 changes: 25 additions & 4 deletions test/sqllogictest/catalog_server_explain.slt
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@

mode cockroach

# Start from a pristine server so no user objects (e.g. roles created by a
# preceding file in the same run) leak into the constant-folded plans. Several
# `information_schema` views embed the current set of role OIDs as a literal,
# which would otherwise make this snapshot depend on run order.
reset-server

# `mz_internal.mz_wallclock_global_lag` is a monotonic top-1 over a temporal
# filter; planning it folds `mz_now()` into a literal millisecond timestamp that
# changes on every run. Mask that one literal so the snapshot stays stable. The
Expand Down Expand Up @@ -4394,7 +4400,7 @@ mz_catalog.mz_materialized_views:
Project: #4, #0, #5, #1, #6, #2, #9, #8, #3, #7
Map: {=r/s1, s1=r/s1}, "s1"
→Arrange (#1{schema_name}, #2{name})
→Constant (22 rows)
→Constant (23 rows)
→Arrange (empty key) (#0{schema_name}) (#0{schema_name}, #1{name})
→Fused with Child Map/Filter/Project
Project: #4, #3, #5
Expand Down Expand Up @@ -4803,6 +4809,21 @@ Target cluster: mz_catalog_server

EOF

query T multiline
EXPLAIN MATERIALIZED VIEW "mz_internal"."mz_overridden_system_parameters";
----
mz_internal.mz_overridden_system_parameters:
→Read mz_internal.mz_catalog_raw

Source mz_internal.mz_catalog_raw
project=(#1, #2)
filter=(("ServerConfiguration" = (#0{data} ->> "kind")))
map=(((#0{data} -> "key") ->> "name"), ((#0{data} -> "value") ->> "value"))

Target cluster: mz_catalog_server

EOF

query T multiline
EXPLAIN SELECT * FROM "information_schema"."applicable_roles";
----
Expand Down Expand Up @@ -7019,7 +7040,7 @@ query T multiline
EXPLAIN SELECT * FROM "mz_internal"."mz_builtin_materialized_views";
----
Explained Query (fast path):
→Constant (22 rows)
→Constant (23 rows)

Target cluster: mz_catalog_server

Expand Down Expand Up @@ -8883,7 +8904,7 @@ query T multiline
EXPLAIN SELECT * FROM "mz_internal"."mz_ontology_entity_types";
----
Explained Query (fast path):
→Constant (131 rows)
→Constant (132 rows)

Target cluster: mz_catalog_server

Expand All @@ -8907,7 +8928,7 @@ Explained Query:
cte l0 =
→Differential Join %1:mz_schemas[#0{id}] » %2:mz_objects[#2{schema_id}] » %0[#0{schema_name}, #1{table_name}] » %3:mz_columns[#0{id}]
→Arrange (#0{schema_name}, #1{table_name})
→Constant (131 rows)
→Constant (132 rows)
→Arrange (#0{id})
→Fused with Child Map/Filter/Project
Project: #1, #3
Expand Down
4 changes: 4 additions & 0 deletions test/sqllogictest/information_schema_tables.slt
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,10 @@ mz_optimizer_notices
BASE TABLE
materialize
mz_internal
mz_overridden_system_parameters
MATERIALIZED VIEW
materialize
mz_internal
mz_pending_cluster_replicas
MATERIALIZED VIEW
materialize
Expand Down
Loading
Loading