diff --git a/.gitlab/ci/database.gitlab-ci.yml b/.gitlab/ci/database.gitlab-ci.yml
index 7806cc15b183796dd5804067cc350cea78c935c4..30c5f346ccfb9e0b017d2b64d4c6eb2a434d9f9d 100644
--- a/.gitlab/ci/database.gitlab-ci.yml
+++ b/.gitlab/ci/database.gitlab-ci.yml
@@ -107,10 +107,10 @@ db:migrate:multi-version-upgrade:
     - bundle exec rake gitlab:db:configure
 
 # Validate minimum PG version supported by GitLab
-db:migrate:multi-version-upgrade-pg13:
+db:migrate:multi-version-upgrade-pg14:
   extends:
     - db:migrate:multi-version-upgrade
-    - .use-pg13
+    - .use-pg14
 
 db:migrate:reset:
   extends: .db-job-base
diff --git a/.gitlab/ci/global.gitlab-ci.yml b/.gitlab/ci/global.gitlab-ci.yml
index 003f0d8de840e45a1315e985012e1496aa30b656..bdf2fc12e3a14a73389ad82ef4038b521fbe09f0 100644
--- a/.gitlab/ci/global.gitlab-ci.yml
+++ b/.gitlab/ci/global.gitlab-ci.yml
@@ -360,16 +360,6 @@
         - |
           mkdir -p /tmp && echo "${LITELLM_CONFIG_CONTENT}" > /tmp/config.yaml && litellm --config /tmp/config.yaml
 
-.use-pg13:
-  extends:
-    - .pg-base-variables
-  services:
-    - !reference [.db-services, services]
-  variables:
-    PG_VERSION: "13"
-    REDIS_VERSION: "6.0"
-    REDIS_CLUSTER_VERSION: "6.0"
-
 .use-pg14:
   extends:
     - .pg-base-variables
@@ -400,6 +390,16 @@
     REDIS_VERSION: "7.0"
     REDIS_CLUSTER_VERSION: "7.0.11"
 
+.use-pg17:
+  extends:
+    - .pg-base-variables
+  services:
+    - !reference [.db-services-with-auto-explain, services]
+  variables:
+    PG_VERSION: "17"
+    REDIS_VERSION: "7.0"
+    REDIS_CLUSTER_VERSION: "7.0.11"
+
 .es7-services:
   services:
     - !reference [.zoekt-services, services]
@@ -434,6 +434,14 @@
     - !reference [.db-services-with-auto-explain, services]
     - !reference [.es7-services, services]
 
+.use-pg17-es7-ee:
+  extends:
+    - .use-pg17
+    - .zoekt-variables
+  services:
+    - !reference [.db-services-with-auto-explain, services]
+    - !reference [.es7-services, services]
+
 .es8-services:
   services:
     - !reference [.zoekt-services, services]
@@ -473,6 +481,15 @@
     - !reference [.db-services-with-auto-explain, services]
     - !reference [.es8-services, services]
 
+.use-pg17-es8-ee:
+  extends:
+    - .use-pg17
+    - .zoekt-variables
+    - .es8-variables
+  services:
+    - !reference [.db-services-with-auto-explain, services]
+    - !reference [.es8-services, services]
+
 .os1-services:
   services:
     - !reference [.zoekt-services, services]
@@ -504,6 +521,14 @@
     - !reference [.db-services-with-auto-explain, services]
     - !reference [.os1-services, services]
 
+.use-pg17-opensearch1-ee:
+  extends:
+    - .use-pg17
+    - .zoekt-variables
+  services:
+    - !reference [.db-services-with-auto-explain, services]
+    - !reference [.os1-services, services]
+
 .os2-services:
   services:
     - !reference [.zoekt-services, services]
@@ -535,6 +560,14 @@
     - !reference [.db-services-with-auto-explain, services]
     - !reference [.os2-services, services]
 
+.use-pg17-opensearch2-ee:
+  extends:
+    - .use-pg17
+    - .zoekt-variables
+  services:
+    - !reference [.db-services-with-auto-explain, services]
+    - !reference [.os2-services, services]
+
 .use-pg14-clickhouse23:
   extends: .use-pg14
   services:
diff --git a/.gitlab/ci/rails.gitlab-ci.yml b/.gitlab/ci/rails.gitlab-ci.yml
index 7314decad00c6cc7c1ddb03bb228967f16b614b5..0b56735a0c3e05cfb1561d7a41c3258a36d85376 100644
--- a/.gitlab/ci/rails.gitlab-ci.yml
+++ b/.gitlab/ci/rails.gitlab-ci.yml
@@ -1017,6 +1017,39 @@ rspec system pg16:
     - .rspec-base-pg16
     - .rails:rules:default-branch-schedule-nightly--code-backstage
     - .rspec-system-parallel
+
+# PG17
+rspec migration pg17:
+  extends:
+    - .rspec-base-pg17
+    - .rspec-base-migration
+    - .rails:rules:default-branch-schedule-nightly--code-backstage
+    - .rspec-migration-parallel
+
+rspec background_migration pg17:
+  extends:
+    - .rspec-base-pg17
+    - .rspec-base-migration
+    - .rails:rules:default-branch-schedule-nightly--code-backstage
+    - .rspec-background-migration-parallel
+
+rspec unit pg17:
+  extends:
+    - .rspec-base-pg17
+    - .rails:rules:default-branch-schedule-nightly--code-backstage
+    - .rspec-unit-parallel
+
+rspec integration pg17:
+  extends:
+    - .rspec-base-pg16
+    - .rails:rules:default-branch-schedule-nightly--code-backstage
+    - .rspec-integration-parallel
+
+rspec system pg17:
+  extends:
+    - .rspec-base-pg17
+    - .rails:rules:default-branch-schedule-nightly--code-backstage
+    - .rspec-system-parallel
 # EE/FOSS: default branch nightly scheduled jobs #
 ##########################################
 
@@ -1144,6 +1177,41 @@ rspec-ee system pg16 es8:
     - .rspec-ee-base-pg16-es8
     - .rails:rules:default-branch-schedule-nightly--code-backstage-ee-only
     - .rspec-ee-system-parallel
+
+# PG17
+# Note: PG17 brought us close to the limit of nightly jobs, with 1946 out of 2000.
+# Adding new job families can cause the nightly pipeline to fail.
+rspec-ee migration pg17:
+  extends:
+    - .rspec-ee-base-pg17
+    - .rspec-base-migration
+    - .rails:rules:default-branch-schedule-nightly--code-backstage-ee-only
+    - .rspec-ee-migration-parallel
+
+rspec-ee background_migration pg17:
+  extends:
+    - .rspec-ee-base-pg17
+    - .rspec-base-migration
+    - .rails:rules:default-branch-schedule-nightly--code-backstage-ee-only
+    - .rspec-ee-background-migration-parallel
+
+rspec-ee unit pg17:
+  extends:
+    - .rspec-ee-base-pg17
+    - .rails:rules:default-branch-schedule-nightly--code-backstage-ee-only
+    - .rspec-ee-unit-parallel
+
+rspec-ee integration pg17:
+  extends:
+    - .rspec-ee-base-pg17
+    - .rails:rules:default-branch-schedule-nightly--code-backstage-ee-only
+    - .rspec-ee-integration-parallel
+
+rspec-ee system pg17:
+  extends:
+    - .rspec-ee-base-pg17
+    - .rails:rules:default-branch-schedule-nightly--code-backstage-ee-only
+    - .rspec-ee-system-parallel
 # EE: default branch nightly scheduled jobs #
 #####################################
 
diff --git a/.gitlab/ci/rails/shared.gitlab-ci.yml b/.gitlab/ci/rails/shared.gitlab-ci.yml
index 636d44b19d5e8b025f331c2d80cd5875b4a56d83..dc71e991a5e78b3de2c7b391615e78944131ee46 100644
--- a/.gitlab/ci/rails/shared.gitlab-ci.yml
+++ b/.gitlab/ci/rails/shared.gitlab-ci.yml
@@ -238,6 +238,11 @@ include:
     - .rspec-base
     - .use-pg16
 
+.rspec-base-pg17:
+  extends:
+    - .rspec-base
+    - .use-pg17
+
 .rspec-ee-base-pg14:
   extends:
     - .rspec-base
@@ -271,6 +276,11 @@ include:
     - .use-pg16-opensearch2-ee
     - .rails:rules:run-search-tests
 
+.rspec-ee-base-pg17:
+  extends:
+    - .rspec-base
+    - .use-pg17-es7-ee
+
 .ci-config-validation-base:
   extends:
     - .rspec-base-pg14
diff --git a/.gitlab/ci/static-analysis.gitlab-ci.yml b/.gitlab/ci/static-analysis.gitlab-ci.yml
index d65b64e54b91ef8f305dd2bbd6d8b8630be94be5..4fc5fba66934f87c9a323e819bd7f297e502c0d7 100644
--- a/.gitlab/ci/static-analysis.gitlab-ci.yml
+++ b/.gitlab/ci/static-analysis.gitlab-ci.yml
@@ -261,7 +261,7 @@ templates-shellcheck:
     - .default-before_script
     - .default-retry
     - .ruby-cache
-    - .use-pg16
+    - .use-pg17
   stage: lint
   needs:
     - setup-test-env
diff --git a/doc/development/pipelines/_index.md b/doc/development/pipelines/_index.md
index 12b1a3e6873ee968e9817910a3ce91ccaacfdc5e..aed3a2eeda48edd646501651290276d5180b6ec2 100644
--- a/doc/development/pipelines/_index.md
+++ b/doc/development/pipelines/_index.md
@@ -742,17 +742,19 @@ Ruby version only:
 Our test suite runs against PostgreSQL 14 as GitLab.com runs on PostgreSQL 14 and
 [Omnibus defaults to PG14 for new installs and upgrades](../../administration/package_information/postgresql_versions.md).
 
-We run our test suite against PostgreSQL 14, 15 and 16 on nightly scheduled pipelines.
+We run our test suite against PostgreSQL 14, 15, 16, and 17 on nightly scheduled pipelines.
+
+NOTE: With the addition of PG17, we are close to the limit of nightly jobs, with 1946 out of 2000 jobs per pipeline. Adding new job families could cause the nightly pipeline to fail.
 
 #### Current versions testing
 
-| Where?                                                                                        | PostgreSQL version           | Ruby version          |
-|-----------------------------------------------------------------------------------------------|------------------------------|-----------------------|
-| Merge requests                                                                                | 14 (default version)         | 3.2 (default version) |
-| `master` branch commits                                                                       | 14 (default version)         | 3.2 (default version) |
-| `maintenance` scheduled pipelines for the `master` branch (every even-numbered hour at XX:05) | 14 (default version)         | 3.2 (default version) |
-| `maintenance` scheduled pipelines for the `ruby-next` branch (every odd-numbered hour at XX:10) | 14 (default version)         | 3.3                   |
-| `nightly` scheduled pipelines for the `master` branch                                         | 14 (default version), 15, 16 | 3.2 (default version) |
+| Where?                                                                                          | PostgreSQL version                  | Ruby version          |
+|-------------------------------------------------------------------------------------------------|-------------------------------------|-----------------------|
+| Merge requests                                                                                  | 14 (default version)                | 3.2 (default version) |
+| `master` branch commits                                                                         | 14 (default version)                | 3.2 (default version) |
+| `maintenance` scheduled pipelines for the `master` branch (every even-numbered hour at XX:05)   | 14 (default version)                | 3.2 (default version) |
+| `maintenance` scheduled pipelines for the `ruby-next` branch (every odd-numbered hour at XX:10) | 14 (default version)                | 3.3                   |
+| `nightly` scheduled pipelines for the `master` branch                                           | 14 (default version), 15, 16 and 17 | 3.2 (default version) |
 
 For the next Ruby versions we're testing against with, we run
 maintenance scheduled pipelines every 2 hours on the `ruby-next` branch.
diff --git a/doc/development/pipelines/internals.md b/doc/development/pipelines/internals.md
index ff8921164a5edbe095a01e09a5097963e84ca9ce..25467807a3c187ed04ed405c47e0a42d1d271c9f 100644
--- a/doc/development/pipelines/internals.md
+++ b/doc/development/pipelines/internals.md
@@ -183,6 +183,8 @@ that are scoped to a single [configuration keyword](../../ci/yaml/_index.md#job-
 | `.use-pg15-ee` | Same as `.use-pg15` but also use an `elasticsearch` service (see [`.gitlab/ci/global.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/ci/global.gitlab-ci.yml) for the specific version of the service). |
 | `.use-pg16` | Allows a job to use the `postgres` 16, `redis`, and `rediscluster` services (see [`.gitlab/ci/global.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/ci/global.gitlab-ci.yml) for the specific versions of the services). |
 | `.use-pg16-ee` | Same as `.use-pg16` but also use an `elasticsearch` service (see [`.gitlab/ci/global.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/ci/global.gitlab-ci.yml) for the specific version of the service). |
+| `.use-pg17` | Allows a job to use the `postgres` 17, `redis`, and `rediscluster` services (see [`.gitlab/ci/global.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/ci/global.gitlab-ci.yml) for the specific versions of the services). |
+| `.use-pg17-ee` | Same as `.use-pg17` but also use an `elasticsearch` service (see [`.gitlab/ci/global.gitlab-ci.yml`](https://gitlab.com/gitlab-org/gitlab/-/blob/master/.gitlab/ci/global.gitlab-ci.yml) for the specific version of the service). |
 | `.use-kaniko` | Allows a job to use the `kaniko` tool to build Docker images. |
 | `.as-if-foss` | Simulate the FOSS project by setting the `FOSS_ONLY='1'` CI/CD variable. |
 | `.use-docker-in-docker` | Allows a job to use Docker in Docker. For more details, see the [handbook about CI/CD configuration](https://handbook.gitlab.com/handbook/engineering/gitlab-repositories/#cicd-configuration). |