What is the difference between Stored Procedure and Trigger in SQL

In this article, we will see the difference between Stored Procedure and Trigger in SQL. Following are the main differences between Stored Procedure and Trigger:

Continue reading What is the difference between Stored Procedure and Trigger in SQL

Stored Procedure Trigger
Store Procedures are invoked explicitly Triggers are invoked implicitly
Stored procedure is a user defined piece of code which may return a value (making it a function) that is invoked by calling it explicitly. A trigger is a stored procedure that runs automatically when various events happen (eg update, insert, delete).

What is the difference between synchronous and asynchronous Replication

Following are the difference between synchronous and asynchronous Replication.

1. Asynchronous Replication: There is delay between Master and Slave(Secondary). In this data can be replicated after the transaction has been committed on the master. Which means the slave is never ahead of the master. So, in the case of writing it is usually a little behind the master. This delay also called lag.

2. Synchronous Replication: Continue reading What is the difference between synchronous and asynchronous Replication

How to connect to PostgreSQL using Python script

In this article, we will see how to connect to PostgreSQL Server using Python script. To connect to PostgreSQL Server from Python, we have to install psycopg2 on Linux or Windows.

Steps to connect to PostgreSQL using Python:

Continue reading How to connect to PostgreSQL using Python script

ModuleNotFoundError: No module named ‘psycopg2’

psycopg2 module is used to connect to PostgreSQL Server using Python. But, if you receive below error means,you have not installed psycopg2 module.

Traceback (most recent call last): File "", line 1, in ModuleNotFoundError: No module named 'psycopg2'

Solution:

Continue reading ModuleNotFoundError: No module named ‘psycopg2’

How to Install pgAdmin4 on Ubuntu

In this article, we will see how to Install pgAdmin4 on Ubuntu.

What is pgAdmin?

pgAdmin is the leading Open Source management tool for Postgres, the world’s most advanced Open Source database.

Steps to Install pgAdmin4 on Ubuntu:

1. Run the command

sudo apt-get install pgadmin4 pgadmin4-apache2

Continue reading How to Install pgAdmin4 on Ubuntu

How to start stop PostgreSQL on Ubuntu

This article covers how to start, stop and restart PostgreSQL on Ubuntu. This is PostgreSQL DBA routine task.
We are going to cover stop, start and restart using service and systemctl commands. But, not covering to kill the PostgreSQL process from Linux shell.

Stop Start and Restart PostgreSQL using service:

sudo service postgresql stop sudo service postgresql start sudo service postgresql restart

Examples for How to start stop PostgreSQL on Ubuntu:
Continue reading How to start stop PostgreSQL on Ubuntu

Install PostgreSQL 11 on Ubuntu 19.04

In this article, we are going to install PostgreSQL 11 on Ubuntu 19.04 Linux server.

Step1: Add PostgreSQL Repository:

So you need to add PostgreSQL apt repository to your system suggested on official PostgreSQL website using following commands.

wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'

Continue reading Install PostgreSQL 11 on Ubuntu 19.04