You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
> |[pg_repack](https://github.com/reorg/pg_repack)| 1.4.7 | reorganize tables in PostgreSQL databases with minimal locks|
268
271
> |[pg_stat_statements](https://www.postgresql.org/docs/11/pgstatstatements.html)| 1.6 | track execution statistics of all SQL statements executed|
269
272
> |[pg_trgm](https://www.postgresql.org/docs/11/pgtrgm.html)| 1.4 | text similarity measurement and index searching based on trigrams|
270
273
> |[pg_visibility](https://www.postgresql.org/docs/11/pgvisibility.html)| 1.2 | examine the visibility map (VM) and page-level visibility info|
@@ -329,6 +332,75 @@ The setting `pg_stat_statements.track`, which controls what statements are count
329
332
There is a tradeoff between the query execution information pg_stat_statements provides and the impact on server performance as it logs each SQL statement. If you are not actively using the pg_stat_statements extension, we recommend that you set `pg_stat_statements.track` to `none`. Note that some third party monitoring services may rely on pg_stat_statements to deliver query performance insights, so confirm whether this is the case for you or not.
330
333
331
334
335
+
## TimescaleDB
336
+
337
+
TimescaleDB is a time-series database that is packaged as an extension for PostgreSQL. TimescaleDB provides time-oriented analytical functions, optimizations, and scales Postgres for time-series workloads.
338
+
[Learn more about TimescaleDB](https://docs.timescale.com/timescaledb/latest/), a registered trademark of Timescale, Inc.. Azure Database for PostgreSQL provides the TimescaleDB [Apache-2 edition](https://www.timescale.com/legal/licenses).
339
+
## Installing TimescaleDB
340
+
To install TimescaleDB, you need to include it in the server's shared preload libraries. A change to Postgres's `shared_preload_libraries` parameter requires a **server restart** to take effect. You can change parameters using the [Azure portal](howto-configure-server-parameters-using-portal.md) or the [Azure CLI](howto-configure-server-parameters-using-cli.md).
341
+
342
+
Using the [Azure portal](https://portal.azure.com/):
343
+
344
+
1. Select your Azure Database for PostgreSQL server.
345
+
346
+
2. On the sidebar, select **Server Parameters**.
347
+
348
+
3. Search for the `shared_preload_libraries` parameter.
349
+
350
+
4. Select **TimescaleDB**.
351
+
352
+
5. Select **Save** to preserve your changes. You get a notification once the change is saved.
353
+
354
+
6. After the notification, **restart** the server to apply these changes.
355
+
356
+
357
+
You can now enable TimescaleDB in your Postgres database. Connect to the database and issue the following command:
358
+
```sql
359
+
CREATE EXTENSION IF NOT EXISTS timescaledb CASCADE;
360
+
```
361
+
> [!TIP]
362
+
> If you see an error, confirm that you [restarted your server](how-to-restart-server-portal.md) after saving shared_preload_libraries.
363
+
364
+
You can now create a TimescaleDB hypertable [from scratch](https://docs.timescale.com/getting-started/creating-hypertables) or migrate [existing time-series data in PostgreSQL](https://docs.timescale.com/getting-started/migrating-data).
365
+
366
+
### Restoring a Timescale database using pg_dump and pg_restore
367
+
To restore a Timescale database using pg_dump and pg_restore, you need to run two helper procedures in the destination database: `timescaledb_pre_restore()` and `timescaledb_post restore()`.
368
+
369
+
First prepare the destination database:
370
+
371
+
```SQL
372
+
--create the new database where you'll perform the restore
373
+
CREATEDATABASEtutorial;
374
+
\c tutorial --connect to the database
375
+
CREATE EXTENSION timescaledb;
376
+
377
+
SELECT timescaledb_pre_restore();
378
+
```
379
+
380
+
Now you can run pg_dump on the original database and then do pg_restore. After the restore, be sure to run the following command in the restored database:
381
+
382
+
```SQL
383
+
SELECT timescaledb_post_restore();
384
+
```
385
+
For more details on restore method wiith Timescale enabled database see [Timescale documentation](https://docs.timescale.com/timescaledb/latest/how-to-guides/backup-and-restore/pg-dump-and-restore/#restore-your-entire-database-from-backup)
386
+
387
+
388
+
### Restoring a Timescale database using timescaledb-backup
389
+
390
+
While running `SELECT timescaledb_post_restore()` procedure listed above you may get permissions denied error updating timescaledb.restoring flag. This is due to limited ALTER DATABASE permission in Cloud PaaS database services. In this case you can perform alternative method using `timescaledb-backup` tool to backup and restore Timescale database. Timescaledb-backup is a program for making dumping and restoring a TimescaleDB database simpler, less error-prone, and more performant.
391
+
To do so you should do following
392
+
1. Install tools as detailed [here](https://github.com/timescale/timescaledb-backup#installing-timescaledb-backup)
393
+
2. Create target Azure Database for PostgreSQL server and database
394
+
3. Enable Timescale extension as shown above
395
+
4. Grant azure_pg_admin [role](https://www.postgresql.org/docs/11/database-roles.html) to user that will be used by [ts-restore](https://github.com/timescale/timescaledb-backup#using-ts-restore)
396
+
5. Run [ts-restore](https://github.com/timescale/timescaledb-backup#using-ts-restore) to restore database
397
+
398
+
More details on these utilities can be found [here](https://github.com/timescale/timescaledb-backup).
399
+
> [!NOTE]
400
+
> When using `timescale-backup` utilities to restore to Azure is that since database user names for non-flexible Azure Database for PostgresQL must use the `<user@db-name>` format, you need to replace `@` with `%40` character encoding.
401
+
402
+
403
+
332
404
## Next steps
333
405
334
406
If you don't see an extension that you'd like to use, let us know. Vote for existing requests or create new feedback requests in our [feedback forum](https://feedback.azure.com/d365community/forum/c5e32b97-ee24-ec11-b6e6-000d3a4f0da0).
0 commit comments