Apply the parameter group

Overview

A DB instance uses only one DB parameter group at a time. When you change the group of a DB instance, RDS marks it Pending reboot: the new group, including its dynamic parameters, takes effect only after you reboot the DB instance. After that, changes to dynamic parameters in the same group apply without a reboot.

Attach the parameter group to rdspg-lab-db

  1. Choose Databases, select rdspg-lab-db, then choose Modify. Scroll down to Additional configuration > Database options:

    • (1) DB parameter group: rdspg-lab-pg18

    DB parameter group

  2. Choose Continue. On the summary page:

    • (1) Check the change: DB parameter group default.postgres18 → rdspg-lab-pg18.
    • (2) Choose Apply immediately.
    • (3) Choose Modify DB instance.

    Summary of modifications

  3. Choose rdspg-lab-db and open the Configuration tab:

    • (1) DB instance parameter group is rdspg-lab-pg18 with the status Pending reboot.

    Pending reboot

Reboot the DB instance

  1. Choose Actions > Reboot:

    • (1) Check that the DB instance is rdspg-lab-db.
    • (2) Choose Confirm. The database is unavailable for about one minute.

    Reboot

    When the Status is Available again, the parameter group status is In sync.

Check the new values

  1. From the App server (ssh rdspg-app), run:

    psql -d pglab -c "SHOW log_connections;" \
                  -c "SHOW log_min_duration_statement;" \
                  -c "SELECT pg_sleep(5);"
    
    • (1) log_connections is receipt,authentication,authorization.
    • (2) log_min_duration_statement is 4s (4000 ms).
    • (3) pg_sleep(5) runs for 5 seconds, longer than the 4-second limit, so PostgreSQL writes it to the log.

    SHOW

The PostgreSQL log now has lines such as connection authorized: user=postgres database=pglab and duration: 5005.123 ms statement: SELECT pg_sleep(5);. Open them in the console (Logs & events > Logs) or, if you export the PostgreSQL log, in CloudWatch Logs (/aws/rds/instance/rdspg-lab-db/postgresql).

log_connections and a low log_min_duration_statement can produce a lot of log data on a busy database. In production, choose a threshold that only catches the queries that you want to fix.

(Optional) AWS CLI

Attach the parameter group and reboot with the AWS CLI