# Optimizing PostgreSQL

When optimizing a PostgreSQL instance, typically the goal is one of the following:

* Throughput optimization: increasing the number of transactions
* Cost optimization: minimize resource consumption according to a typical workload, thus cutting costs

Please refer to the [PostgreSQL optimization pack](https://docs.akamas.io/akamas-docs/3.2.1-1/akamas-reference/optimization-packs/postgresql-pack) for the list of component types, parameters, metrics, and constraints.

### Workflow

#### Applying parameters <a href="#applying-parameters" id="applying-parameters"></a>

Akamas offers many operators that you can use to apply the parameters for the tuned PostgreSQL instances. In particular, we suggest using the [FileConfigurator operator](https://docs.akamas.io/akamas-docs/3.2.1-1/akamas-reference/workflow-operators/fileconfigurator-operator) for parameters templating and configuration, and the [Executor operator](https://docs.akamas.io/akamas-docs/3.2.1-1/akamas-reference/workflow-operators/executor-operator) for restoring DB data and launching scripts.

A typical optimization process involves the following steps:

1. Configure PostgreSQL parameters
2. Restore DB data
3. Restart PostgreSQL and wait for the initialization
4. Run benchmark
5. Parse results

Please note that most PostgreSQL parameters do not need an application restart.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.akamas.io/akamas-docs/3.2.1-1/using-akamas/using-optimization-packs/postgresql-pack.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
