Refresh postgres materialized view using scheduler - postgresql

I was trying to figure-out how we can schedule to refresh the materialized view on azure postgres database single server which is in azure cloud, one solution is to use pg_cron extension, but it
seems it is only available on azure flexible postgres database server and not on azure postgres database single server, I did not get any other option available, any suggestion in this regard will be really helpful.

I did not find any postgres scheduler extension for the db hosted on Azure, so created one microservice to schedule the db functions.
Example Link

Related

Scheduling AWS RDS snapshot migrations

I am trying to set up a process in which a postgres staging database is populated with production data.
I have some working implementation with pg_dump and pg_restore but I was wondering if something in RDS itself is possible.
We have nightly snapshots on our production database. My goal would be RDS takes the latest database snapshot, migrates it to an existing database and does this on some scheduled cadence (1/week or something like that).
Is this possible to configure in the console? If not are there some some combination of lambda/cloud formation that can do this?
My goal would be RDS takes the latest database snapshot, migrates it to an existing database
RDS never loads a snapshot into an existing database. It always creates an entirely new database server/cluster from a snapshot.
Is this possible to configure in the console? If not are there some some combination of lambda/cloud formation that can do this?
You would have to write some code that creates a new staging database server from the production snapshot, and deletes your current server.
If you are using CloudFormation, then it could manage this for you if you specify the DBSnapshotIdentifier parameter. You would have to modify that parameter each week, and then update your CloudFormation stack.

Use Terraform on Google Cloud SQL Postgres to create a Replication Slot

Overall I'm trying to create a Datastream Connection to a Postgres database in Cloud SQL.
As I'm trying to configure it all through Terraform, I'm stuck on how I should create a Replication Slot. This guide explains how to do it through the Postgres Client and running SQL commands, but I thought there might be a way to do it in the Terraform configuration directly.
Example SQL that I would like to replicate in Terraform:
ALTER USER [CURRENT_USER] WITH REPLICATION;
CREATE PUBLICATION [PUBLICATION_NAME] FOR ALL TABLES;
SELECT PG_CREATE_LOGICAL_REPLICATION_SLOT('[REPLICATION_SLOT_NAME]', 'pgoutput');
If not, does anyone know how to run the Postgres SQL commands against the Cloud SQL database through Terraform?
I have setup the Datastream and Postgres connection for all other parts. I'm expecting that there is a Terraform setting I'm missing or a way to run Postgres commands against the Google Cloud SQL Postgres database.
Unfortunately, there is no terraform resource for specifying a replication slot on a google_sql_database_instance.

PostgreSQL data migration from one database to other database in AWS

I have my Old postgres database which is not a cloud based. And I want to migrate the data from the old database to new database which is in aws.
So can this be done via dblink or what is the other best practises to do this.
You can migrate DBs to AWS via AWS Database Migration Service. It's fully managed tool to help you move your data from on premises to AWS. You can read more about it here: https://aws.amazon.com/dms/?nc=sn&loc=1.

PostgreSQL Job Scheduler on Azure DB for PostgreSQL

In Azure Database for PostgreSQL, how do I install a pgAgent?
As, its a PaaS only, I will not have access to the Server. In that case, if I need a pgAgent to install, how do I do it?
As per azure docs, it seems PgCron is available in flexible server type.

How do I connect from Azure Data Factory to an AWS-hosted Postgres database?

I have a Postgres database created on Heroku but looks like it's spun up on AWS based on the server name. Unfortunately, I can't tell if it's an Aurora or RDS instance.
I'm trying to create some data pipelines on Azure Data Factory to do some ETL work moving Blob files onto the Postgres Database but am having a tough time setting it up. The default Postgres option isn't working - looks like DataFactory tries to make a JDBC connection.
I'm stuck and am clueless as to how I should set up the connection.