Skip to content

[toygres] Postgres parameter configuration #28

Description

@affandar

Repository

affandar/toygres

Concept

Allow users to configure Postgres parameters and apply them dynamically or with restart.

Parameter Categories

  • Dynamic: Can be changed without restart (SET command)
  • Reload: Requires pg_reload_conf()
  • Restart: Requires Postgres restart
  • Immutable: Cannot be changed after init

API

// Set parameters
client.set_parameters(SetParametersRequest {
    instance_id: "pg-prod-1".into(),
    parameters: vec![
        ("shared_buffers".into(), "4GB".into()),
        ("work_mem".into(), "256MB".into()),
        ("max_connections".into(), "200".into()),
    ],
    apply_mode: ApplyMode::Immediate,  // or Scheduled, OnNextRestart
}).await?;

// Get current parameters
let params = client.get_parameters("pg-prod-1").await?;

Apply Modes

  • Immediate: Apply now (may restart if needed)
  • Scheduled: Apply at specified time
  • OnNextRestart: Apply when instance next restarts

Parameter Profiles

Pre-defined profiles for common workloads:

  • OLTP: Optimized for transactional workloads
  • Analytics: Optimized for OLAP
  • GeneralPurpose: Balanced for mixed workloads
  • Development: Minimal resources
client.apply_parameter_profile(ApplyProfileRequest {
    instance_id: "pg-prod-1".into(),
    profile: ParameterProfile::Oltp,
    override_params: vec![("max_connections".into(), "500".into())],
}).await?;

See: proposals/toygres-improvements.md

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions