> ## Documentation Index
> Fetch the complete documentation index at: https://docs.ditto.live/llms.txt
> Use this file to discover all available pages before exploring further.

# ALTER SYSTEM

> The ALTER SYSTEM statement allows you to modify configuration parameters at runtime without restarting your Ditto instance.

<Note>
  `ALTER SYSTEM` is available in SDK v5+.
</Note>

The `ALTER SYSTEM` statement provides runtime configuration management, allowing you to change system parameters dynamically.

## Syntax

```sql DQL theme={null}
ALTER SYSTEM SET parameter_name TO value
ALTER SYSTEM SET parameter_name = value
ALTER SYSTEM RESET parameter_name
ALTER SYSTEM RESET ALL
```

<img src="https://mintcdn.com/ditto-248bc0d1/pf3IlRElveI85RoM/images/dql/AlterSystem.svg?fit=max&auto=format&n=pf3IlRElveI85RoM&q=85&s=f6246e953fad3c259d9c7afd0e32ad22" alt="ALTER SYSTEM Syntax Diagram" width="631" height="209" data-path="images/dql/AlterSystem.svg" />

## SET Parameter

Change a configuration parameter to a specific value:

```sql DQL theme={null}
-- Using TO syntax
ALTER SYSTEM SET DQL_STRICT_MODE TO false

-- Using = syntax (equivalent)
ALTER SYSTEM SET DQL_STRICT_MODE = false
```

### Set to DEFAULT

Reset a parameter to its default value using the `DEFAULT` keyword:

```sql DQL theme={null}
ALTER SYSTEM SET parameter_name TO DEFAULT
```

## RESET Parameter

Reset a configuration parameter to its default value:

```sql DQL theme={null}
-- Reset single parameter
ALTER SYSTEM RESET DQL_STRICT_MODE

-- Reset all parameters to defaults
ALTER SYSTEM RESET ALL
```

## Parameter Values

Parameter values can be:

* **Literals**: Numbers, strings, booleans
  * Boolean: `true`, `false`
  * Integer: `100`, `5000`
  * String: `'value'` or `"value"`
* **DEFAULT keyword**: Resets to the default value

## Available DQL Configuration Parameters

### DQL\_STRICT\_MODE

**Type**: Boolean
**Default**: `true`

Controls whether strict mode is enabled for collection type definitions.

```sql DQL theme={null}
ALTER SYSTEM SET DQL_STRICT_MODE TO false
```

See [Strict Mode](/dql/strict-mode) for more information.

### DQL\_DEFAULT\_DIRECTIVES

**Type**: Object (JSON)
**Default**: `{}`

Sets default query directives that apply to all queries. Individual query directives can override these defaults.

```sql DQL theme={null}
-- Set default directives for development
ALTER SYSTEM SET DQL_DEFAULT_DIRECTIVES = {"#reprepare": true, "#max_serial_ranges": 2}

-- Reset to no default directives
ALTER SYSTEM SET DQL_DEFAULT_DIRECTIVES = {}
```

See [Directives](/dql/directives#default-directives) for more information.

### DQL\_CONCURRENT\_REQUEST\_LIMIT

**Type**: Integer
**Default**: System-dependent

Limits the number of concurrent DQL requests that can execute simultaneously. When the limit is reached, additional requests are queued until capacity becomes available.

```sql DQL theme={null}
-- Limit to 10 concurrent requests
ALTER SYSTEM SET DQL_CONCURRENT_REQUEST_LIMIT TO 10

-- Reset to default (no limit)
ALTER SYSTEM RESET DQL_CONCURRENT_REQUEST_LIMIT
```

<Note>
  This parameter helps prevent resource exhaustion under heavy query load by controlling the maximum number of queries running at once.
</Note>

## Common Use Cases

### Enable/Disable Strict Mode

```sql DQL theme={null}
-- Disable strict mode to allow flexible type definitions
ALTER SYSTEM SET DQL_STRICT_MODE TO false

-- Re-enable strict mode
ALTER SYSTEM SET DQL_STRICT_MODE TO true
```

### Configure Default Query Directives

```sql DQL theme={null}
-- Set default directives during development
ALTER SYSTEM SET DQL_DEFAULT_DIRECTIVES = {"#reprepare": true}

-- Clear default directives for production
ALTER SYSTEM SET DQL_DEFAULT_DIRECTIVES = {}
```

### Control Concurrent Query Execution

```sql DQL theme={null}
-- Limit concurrent queries to prevent overload
ALTER SYSTEM SET DQL_CONCURRENT_REQUEST_LIMIT TO 20

-- Remove limit
ALTER SYSTEM RESET DQL_CONCURRENT_REQUEST_LIMIT
```

### Reset All Configuration

```sql DQL theme={null}
-- Reset all parameters to their default values
ALTER SYSTEM RESET ALL
```

## Examples

<CodeGroup>
  ```swift Swift theme={null}
  // Set strict mode
  await ditto.store.execute(
    query: "ALTER SYSTEM SET DQL_STRICT_MODE TO false"
  )

  // Reset parameter
  await ditto.store.execute(
    query: "ALTER SYSTEM RESET DQL_STRICT_MODE"
  )

  // Reset all parameters
  await ditto.store.execute(
    query: "ALTER SYSTEM RESET ALL"
  )
  ```

  ```kotlin Kotlin theme={null}
  // Set strict mode
  ditto.store.execute("ALTER SYSTEM SET DQL_STRICT_MODE TO false")

  // Reset parameter
  ditto.store.execute("ALTER SYSTEM RESET DQL_STRICT_MODE")

  // Reset all parameters
  ditto.store.execute("ALTER SYSTEM RESET ALL")
  ```

  ```javascript JS theme={null}
  // Set strict mode
  await ditto.store.execute("ALTER SYSTEM SET DQL_STRICT_MODE TO false");

  // Reset parameter
  await ditto.store.execute("ALTER SYSTEM RESET DQL_STRICT_MODE");

  // Reset all parameters
  await ditto.store.execute("ALTER SYSTEM RESET ALL");
  ```

  ```java Java theme={null}
  // Set strict mode
  ditto.store.execute("ALTER SYSTEM SET DQL_STRICT_MODE TO false");

  // Reset parameter
  ditto.store.execute("ALTER SYSTEM RESET DQL_STRICT_MODE");

  // Reset all parameters
  ditto.store.execute("ALTER SYSTEM RESET ALL");
  ```

  ```csharp C# theme={null}
  // Set strict mode
  await ditto.Store.ExecuteAsync("ALTER SYSTEM SET DQL_STRICT_MODE TO false");

  // Reset parameter
  await ditto.Store.ExecuteAsync("ALTER SYSTEM RESET DQL_STRICT_MODE");

  // Reset all parameters
  await ditto.Store.ExecuteAsync("ALTER SYSTEM RESET ALL");
  ```

  ```cpp C++ theme={null}
  // Set strict mode
  ditto.get_store().execute("ALTER SYSTEM SET DQL_STRICT_MODE TO false").get();

  // Reset parameter
  ditto.get_store().execute("ALTER SYSTEM RESET DQL_STRICT_MODE").get();

  // Reset all parameters
  ditto.get_store().execute("ALTER SYSTEM RESET ALL").get();
  ```

  ```rust Rust theme={null}
  // Set strict mode
  ditto.store()
      .execute_v2((
          "ALTER SYSTEM SET DQL_STRICT_MODE TO false",
          serde_json::json!({})
      ))
      .await?;

  // Reset parameter
  ditto.store()
      .execute_v2((
          "ALTER SYSTEM RESET DQL_STRICT_MODE",
          serde_json::json!({})
      ))
      .await?;

  // Reset all parameters
  ditto.store()
      .execute_v2((
          "ALTER SYSTEM RESET ALL",
          serde_json::json!({})
      ))
      .await?;
  ```

  ```dart Dart theme={null}
  // Set strict mode
  await ditto.store.execute("ALTER SYSTEM SET DQL_STRICT_MODE TO false");

  // Reset parameter
  await ditto.store.execute("ALTER SYSTEM RESET DQL_STRICT_MODE");

  // Reset all parameters
  await ditto.store.execute("ALTER SYSTEM RESET ALL");
  ```
</CodeGroup>

## Checking Current Values

To verify the current value of a parameter after changing it, use the [SHOW](/dql/show) statement:

```sql DQL theme={null}
-- Set parameter
ALTER SYSTEM SET DQL_STRICT_MODE TO false

-- Verify the change
SHOW DQL_STRICT_MODE
```

<Note>
  Configuration changes made with `ALTER SYSTEM` are **runtime only** and do not persist across restarts. To apply settings on every startup, set the parameters in your Ditto instance configuration before starting.
</Note>

## See Also

* [SHOW](/dql/show) - Display configuration parameter values
* [Strict Mode](/dql/strict-mode) - Understanding DQL\_STRICT\_MODE parameter
