Skip to content

Commit

Permalink
Merge pull request #3814 from EnterpriseDB/release/2023-03-17
Browse files Browse the repository at this point in the history
Release: 2023-03-17
  • Loading branch information
drothery-edb authored Mar 17, 2023
2 parents c93b162 + 76eaed1 commit 86b9940
Show file tree
Hide file tree
Showing 16 changed files with 145 additions and 317 deletions.
2 changes: 1 addition & 1 deletion advocacy_docs/supported-open-source/pgbackrest/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ pgBackRest is an easy-to-use backup and restore tool that aims to enable your or
!!! Note
Looking for pgBackRest documentation? Head over to [http://www.pgbackrest.org](http://www.pgbackrest.org)

pgBackRest [v2.43](https://github.com/pgbackrest/pgbackrest/releases/tag/release/2.43) is the current stable release. Release notes are on the [Releases](http://www.pgbackrest.org/release.html) page.
pgBackRest [v2.44](https://github.com/pgbackrest/pgbackrest/releases/tag/release/2.44) is the current stable release. Release notes are on the [Releases](http://www.pgbackrest.org/release.html) page.

EDB collaborates with the community on this open-source software. The packages are provided by the **PostgreSQL** community. All of the use cases shown in this document are fully tested and supported by **EDB Postgres Advanced Server**.
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ For example, here is a C loadable module which uses `rot13_passphrase` as the ho
{
size_t size = strlen(pw) + 1;

* new_pw = (char*) palloc(size);
char* new_pw = (char*) palloc(size);
strlcpy(new_pw, pw, size);
for (char *p = new_pw; *p; p++)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,70 +21,23 @@ Specific features and benefits of SQL Profiler include:
- Trace output analyzer. A graphical table lets you quickly sort and filter queries by duration or statement. A graphical or text-based `EXPLAIN` plan lays out your query paths and joins.
- Index Advisor integration. After you find your slow queries and optimize them, you can also let Index Advisor recommend the creation of underlying table indices to further improve performance.

## Installation
## Installing and enabling the SQL Profiler extension

The following describes the installation process.
See [Installing the SQL Profiler extension](/pem/latest/profiling_workloads/installing_sql_profiler/).

### 1. Install SQL Profiler
## Upgrading to the extension

SQL Profiler is installed by the EDB Postgres Advanced Server installer on Windows or from the `edb-asxx-server-sqlprofiler` RPM package on Linux, where `xx` is the EDB Postgres Advanced Server version number.

### 2. Add the SQL Profiler library
If you are upgrading from v4.0 (or an earlier version) of SQL Profiler, where the functions where created by loading the SQL file included in a plugin, first migrate to the extension and later update to 4.1:

To include the SQL Profiler library in the `shared_preload_libraries` configuration parameter, modify the `postgresql.conf` parameter file for the instance.

For Linux installations, the parameter value must include:

```shell
$libdir/sql-profiler
```

On Windows, the parameter value must include:

```shell
$libdir\sql-profiler.dll
```

### 3. Create the functions used by SQL Profiler

The SQL Profiler installation program places a SQL script named `sql-profiler.sql` in the following directories.

On Linux:

```sql
/usr/edb/as14/share/contrib/
```
edb=# CREATE EXTENSION sql_profiler VERSION '4.0';
On Windows:
CREATE EXTENSION
```text
C:\Program Files\edb\as14\share\contrib\
```

Use the `psql` command line interface to run the `sql-profiler.sql` script in the database specified as the maintenance database on the server you want to profile. If you're using EDB Postgres Advanced Server, the default maintenance database is named `edb`. If you're using a PostgreSQL instance, the default maintenance database is named `postgres`.

This command uses the `psql` command line to invoke the `sql-profiler.sql` script on a Linux system:

```shell
$ /usr/edb/as14/bin/psql -U user_name database_name <
/usr/edb/as14/share/contrib/sql-profiler.sql
```
edb=# ALTER EXTENSION sql_profiler UPDATE TO '4.1';
### 4. Stop and restart the serverx
ALTER EXTENSION
For the changes to take affect, you must stop and restart the servers. After configuring SQL Profiler, it's ready to use with all databases that reside on the server. You can take advantage of SQL Profiler functionality with EDB Postgres Enterprise Manager. For more information about Postgres Enterprise Manager, see the [PEM documentation](/pem/latest).

## Troubleshooting

After performing an upgrade to a newer version of SQL Profiler, you might encounter an error that contains the following text:

```text
An error has occurred:
ERROR: function return row and query-specified return row do not match.
DETAIL: Returned row contains 11 attributes, but the query expects 10.
edb=#
```

To correct this error, you must replace the existing query set with a new query set:

1. Uninstall SQL Profiler by invoking the `uninstall-sql-profiler.sql` script.
2. Reinstall SQL Profiler by invoking the `sql-profiler.sql` script.
Original file line number Diff line number Diff line change
Expand Up @@ -26,5 +26,6 @@ EDB Postgres Advanced Server 15.2.0 includes the following enhancements and bug
| Enhancement | Added the FROM_TZ() function. Converts a TIMESTAMP value and a time zone value to an equivalent TIMESTAMP WITH TIME ZONE value. | |
| Enhancement | Adding TO_CLOB() and TO_BLOB() functions. These are the only wrapper functions that cast input to CLOB or BLOB types respectively. | |
| Enhancement | You can now view the package specification and package body definition using the psql meta-commands `\sps` and `\spb`, respectively. | |
| Enhancement | `index _advisor` is now a separate extension. | Index advisor |
| Enhancement | `index _advisor` is now a separate extension, but continues to be packaged with EDB Postgres Advanced Server. | Index advisor |
| Enhancement | `sql_profiler` is now a separate extension and is no longer packaged with EDB Postgres Advanced Server. | SQL Profiler |
| Change | The Windows installer no longer installs pgAdmin, and the parallel-clone and clonescheme extensions are no longer included in an EDB Postgres Advanced Server installation. To download pgAdmin, see the [pgAdmin download page](https://www.pgadmin.org/download/). |
13 changes: 9 additions & 4 deletions product_docs/docs/pem/9/profiling_workloads/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@
title: "Profiling workloads"
navigation:

- pem_sqlprofiler
- installing_sql_profiler
- using_sql_profiler
- index_advisor
---

The following features are available to profile the workloads:
Most RDBMS experts agree that inefficient SQL code is the leading cause of most database performance problems. The challenge for DBAs and developers is to locate that SQL code in large and complex systems and then optimize that code for better performance.

- [SQL Profiler](pem_sqlprofiler)
- [Index Advisor](index_advisor)
The following extensions works with PEM to allow you to profile a server's workload:

- SQL Profiler &mdash; allows a database superuser to locate and optimize inefficient SQL code
- See [Installing the SQL Profiler extension](installing_sql_profiler)
- See [Using SQL Profiler](using_sql_profiler)
- [Index Advisor](index_advisor) &mdash; works with SQL Profiler by examining collected SQL statements and making indexing recommendations for any underlying tables to improve SQL response time
11 changes: 1 addition & 10 deletions product_docs/docs/pem/9/profiling_workloads/index_advisor.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,14 @@ redirects:
- /pem/latest/pem_sqlprofiler/02_using_sql_profiler/#using-the-index-advisor
---

Index Advisor is distributed with EDB Postgres Advanced Server version 9.0 and later. Index Advisor works with SQL Profiler by examining collected SQL statements and making indexing recommendations for any underlying tables to improve SQL response time. Index Advisor works on all DML (INSERT, UPDATE, DELETE) and SELECT statements that are invoked by a superuser.
Index Advisor is distributed with EDB Postgres Advanced Server. Index Advisor works with SQL Profiler by examining collected SQL statements and making indexing recommendations for any underlying tables to improve SQL response time. Index Advisor works on all DML (INSERT, UPDATE, DELETE) and SELECT statements that are invoked by a superuser.

Diagnostic output from the Index Advisor includes:

- Forecasted performance benefits from any recommended indexes
- The predicted size of any recommended indexes
- DDL statements you can use to create the recommended indexes

Before using Index Advisor, you must:

1. Modify the `postgresql.conf` file on each EDB Postgres Advanced Server host, adding the `index_advisor` library to the `shared_preload_libraries` parameter.

2. Install the `Index Advisor contrib` module. To install the module, use the psql client or PEM Query tool to connect to the database, and invoke the following command:

`\i <complete_path>/share/contrib/index_advisor.sql`

3. Restart the server to make your changes to take effect.

Index Advisor can make indexing recommendations based on trace data captured by SQL Profiler. To open Index Advisor, select one or more queries in the SQL Profiler Trace Data pane and select **Index Advisor** from the toolbar. For more information about configuring and using Index Advisor, see [EDB Postgres Advanced Server](/epas/latest/epas_guide/03_database_administration/02_index_advisor/).

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
---
title: "Installing the SQL Profiler extension"
navTitle: Installing SQL Profiler
legacyRedirectsGenerated:
# This list is generated by a script. If you need add entries, use the `legacyRedirects` key.
- "/edb-docs/d/edb-postgres-enterprise-manager/user-guides/sql-profiler-configuration-guide/8.0/installing_the_sql_profiler_plugin.html"
redirects:
- /pem/latest/pem_sqlprofiler/01_installing_the_sql_profiler_plugin/
- /pem/latest/profiling_workloads/pem_sqlprofiler/installing_the_sql_profiler_plugin/
---

You must install and enable the SQL Profiler extension on each server on which you want to use it. For example, if you have a host running PostgreSQL 14 and PostgreSQL 15, you must enable the extension on each server.

SQL Profiler is supported on the same platforms as the Postgres distribution you're using. Support for the SQL Profiler extension starts with version 11 for PostgreSQL and EDB Postgres Advanced Server and version 12 for EDB Postgres Extended. See:
- [EDB Postgres Advanced Server Product Compatibility](https://www.enterprisedb.com/platform-compatibility#epas)

- [PostgreSQL Product Compatibility](https://www.enterprisedb.com/resources/platform-compatibility#pg)
- [EDB Postgres Extended Server Product Compatibility](https://www.enterprisedb.com/resources/platform-compatibility#epas_extended)

## Installing the package

### Prerequisites

Before you begin the installation process:

- Install Postgres. See:
- [Installing EDB Postgres Advanced Server](/epas/latest/installing/)

- [Installing PostgreSQL](https://www.postgresql.org/download/)

- [Installing EDB Postgres Extended Server](/pge/latest/installing/)

- Set up the repository.

Setting up the repository is a one-time task. If you have already set up your repository, you don't need to perform this step.

To set up the repository, go to [EDB repositories](https://www.enterprisedb.com/repos-downloads) and follow the instructions provided there.


### Install the package

The syntax for the install command is:

```shell
sudo <package-manager> -y install sqlprofiler_<major_version>
```

Where:

- `<package-manager>`is the package manager used with your operating system:

| Package manager | Operating system |
| --------------- | -------------------------------- |
| dnf | RHEL 8 and derivatives |
| yum | RHEL 7 and derivatives, CentOS 7 |
| zypper | SLES |
| apt-get | Debian and derivatives |

- `<major_version>` is the major version of Postgres you're using.

For example, to install SQL Profiler version 4.0-1 on a RHEL 8 platform:

```shell
sudo dnf -y install sqlprofiler_15
```


## Enabling the extension


To enable the extension:

1. Edit the `postgresql.conf` file on the server you want to profile, modifying the `shared_preload_libraries` parameter:

```ini
shared_preload_libraries = '$libdir/sql_profiler'
```

2. Restart the Postgres server.

1. Create the SQL Profiler extension in your database with the following command:

```sql
CREATE EXTENSION sql_profiler;
```

!!! Note
If you are connected to the PEM server with the PEM client before configuring SQL Profiler, you must disconnect and reconnect with the server to enable SQL Profiler functionality.

After enabling the extension, SQL Profiler is ready to use with all databases that reside on the server.



This file was deleted.

Loading

2 comments on commit 86b9940

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.