Author: Faruk Erdem

9 Nov by Faruk Erdem

Universal Unique İdentifier (UUID) Data Type In PostgreSQL

  Uuid is the abbreviation for “universal unique identifier”. It consists of 36 characters, a set of numbers and letters, and its most important feature is: Its extremely unique. To use this feature on PostgreSQL, we need to install uuid-ossp extension. We can install extension with the following command; [crayon-5bf19deab6615068572922/]   After running the command […]
8 Nov by Faruk Erdem

How to Change the Schema Name in PostgreSQL

We may want to change the schema name because of some needs. For this we can use the following script. First, we list the schemes with the command \dn as follows.   We change the name of the faruk scheme with the help of the following command. [crayon-5bf19deab6c3c342462126/]   We changed the schema name to […]
4 Nov by Faruk Erdem

How To Insert Random Data In PostgreSQL

In some cases, we may want to increase the size of the database by inserting random data into the database. In the script below, we create a table named t_random. [crayon-5bf19deab6e80300188848/]   We increase the size of the table by inserting some data after the table is created. [crayon-5bf19deab6e87056654459/]   We can learn the size […]
2 Nov by Faruk Erdem

How to Change User Name in PostgreSQL

You have created a user in Postgresql, but software developer ask for change the user name or you have to change it for different reasons. You do not need to delete and re-create the user, you can change the user name using the command below. [crayon-5bf19deab70db672193552/]  
1 Nov by Faruk Erdem

How To Find and Kill Long Running Queries In PostgreSQL

You can use the following queries to monitor the performance of the database or to find and kill queries that cause lock. The following query returns queries that last longer than 5 minutes. [crayon-5bf19deab7302435560335/]   You can find queries that have ExclusiveLock with the following query. [crayon-5bf19deab7309540329602/]   We have found your query with the […]
28 Oct by Faruk Erdem

How to Install Postgresql Sample Database

In Postgresql, sometimes we need a sample database when we test. We can use pagila in postgresql.org for this. You can follow the steps below to install Pagilla. We’re running the following command to load Pagila’s files. [crayon-5bf19deab75a2007012234/]   As you can see above, pagila files were created. Let’s see where it is now. First, […]
23 Oct by Faruk Erdem

Foreign Data Wrapper Between PostgreSQL and MSSQL

In the article “Postgresql Foreign Data Wrapper“, we created Foreign Data Wrapper to read data between two PostgreSQLs. In this article, we will create Foreign Data Wrapper by using tds_fdw extension between Mssql and Postgresql. Before we create Foreign Data Wrapper, there are a few packages that we need to install. We need to install […]
22 Oct by Faruk Erdem

Postgresql Foreign Data Wrapper

Postgresql is one of the RDMS databases presented in simple form. Therefore, we need to install the extension to use dblink, Foreign Data Wrapper, and so on. Foreign Data Wrapper allows you to connect to different remote systems and query and write over remote systems. The Foreign Data Wrapper feature is available in version 9.1 […]
22 Oct by Faruk Erdem

How to List Table Columns and Data Types On Postgresql

If you don’t use PG ADMIN or any other similar application and you want to see the data type in the columns of the table you created, the command below will help you. You need to connect to postgres to run this command. [crayon-5bf19deab8063919205389/]   In the example above, we see that we have columns […]
17 Oct by Faruk Erdem

Solution of Makefile54 Error On PostgreSQL

You may receive an error as follows when you try to install a different extension package that is not in Postgresql’s repo. To solve this problem, we need to install the packages and the problem will be solved. Makefile: 54: /usr/pgsql-10/lib/pgxs/src/makefiles/pgxs.mk We need to install postgresql libs and dev packages to install the extensions. The […]