How to Download and Install PostgreSQL on Windows

Try this guide with our instant dedicated server for as low as 40 Euros

install postgresql on windows

PostgreSQL is a free and open-source relational database management system (RDBMS). 

It offers various advanced features including support for complex data types, ACID transactions, advanced user management, and multi-tier security options. 

If you are building web applications that require complex data models, high performance or working with geospatial data, PostgreSQL can be a great tool. 

In this comprehensive tutorial, you will learn how to download and install PostgreSQL on Windows in three easy steps.

Table Of Contents

  1. Download and Install PostgreSQL on Windows
    1. The Prerequisites
    2. Step #1: PostgreSQL Installer Download
    3. Step #2: Install PostgreSQL on Windows
    4. Step #3: Set up the PostgreSQL Database Connection
  2. Conclusion
  3. FAQs

Download and Install PostgreSQL on Windows

Let’s discuss the three steps in the process of downloading and installing PostgreSQL on a Windows machine. However, before that, take a quick look at the prerequisites.

The Prerequisites

Before going ahead with working with a PostgreSQL database, make sure you have the following:

  • A server running the latest stable Windows version (Windows 10 or newer).
  • A user account with administrator privileges.

Step #1: PostgreSQL Installer Download 

Before the PostgreSQL installation, you need to download the installation file from the EDB website.

PostgreSQL Installer Download

We recommend the Windows x86-64 file to get the most recent PostgreSQL version.

Step #2: Install PostgreSQL on Windows

Now that you have downloaded the appropriate installation file, you can initiate the installation process. 

Double click the PostgreSQL install file and click Next to proceed. 

postgresql setup

The installer will ask you to select the directory where you want to install PostgreSQL.

installation directory

Choose from the following program components:

  • PostgreSQL Server: Installs the database server PostgreSQL.
  • pgAdmin 4: Offers a graphical database management interface for PostgreSQL.
  • Stack Builder: Enables you to install and download extra tools for PostgreSQL.
  • Command Line Tools: This installs client libraries and the command-line utility necessary to install pgAdmin 4 and PostgreSQL Server.

components selection

Next, click Next to proceed to the selection of the database directory to store data. 

data directory

The installer will ask you to set the superuser password. Remember to follow the best password practices and click Next to continue.

password setup

You will then need to set the port on which the PostgreSQL server should listen for incoming connections. The default port is 5432, but you can choose a different one if the default option is already in use.

port selection

Select the locale that the database will use. By default, the installer chooses your operating system’s locale settings as the default choice. 

advanced options

The final step provides an overview of the installation settings. To undo any changes you made, click Back. If all details are correct, click Next to continue.

pre installation summary

The setup wizard will initiate the installation process and notify when the installation finishes.

installation ready

Step #3: Set up the PostgreSQL Database Connection

Once the installation finishes, we strongly recommend verifying that the PostgreSQL installation is successful. You can use the SQL shell or the pgAdmin GUI tool for this purpose.

SQL Shell (psql)

Launch the SQL Shell (psql) from the PostgreSQL folder in the Start menu. Fill in the superuser account details and press Enter.

sql shell

The prompt will change to postgres=# to indicate successful login.

Now, run the following command to confirm the new database:

postgres=# select version();

select version

If the PostgreSQL database was successfully installed, you will see the PostgreSQL version information.

pgAdmin 4

Choose the PostgreSQL folder from the Start menu and launch the pgAdmin 4 tool.

If it is the first time, you may be asked to set a master password for the tool. Make sure this password is NOT the same as your superuser password. 

Click Add New Server in the main window to add the details of your PostgreSQL server.

add new user from pg admin

In the General tab, add the name of the new database. Here, we will use PostgreSQL as the name of the test database.

register server

In the Connection tab, enter the hostname (localhost by default) and the password during the setup. Click Save to create the new database. 

register server localhost

Click Servers > PostgreSQL on the left to expand the Servers drop-down menu. Choose the PostgreSQL (our test database). Alternatively, you can pick your database.

pick postgresql database

Select the Query Tool from the Tools drop-down menu. This opens the query editor.

query editor

Run the following SQL statement in the query editor to see the database version information.

> SELECT version()

Click Execute to run the query.

If the installation is successful, the query will return the PostgreSQL version information, confirming a working connection.

postgresql select version


Running PostgreSQL on your own server can be complex and resource-intensive, especially for critical applications. Here dedicated server hosting providers like RedSwitches become an indispensable component of your operations.

At RedSwitches, we’re dedicated to helping you discover the perfect server solutions to drive your business to new heights. So, if you’re looking for a robust server, we offer the best-dedicated server pricing and deliver instant dedicated servers, usually on the same day the order gets approved. 

Whether you need a dedicated server, a traffic-friendly 10Gbps dedicated server, or a powerful bare metal server, we are your trusted hosting partner.


Q. Is PostgreSQL compatible with all versions of Windows?

Most Windows versions, including Windows 7, 8, and 10, and Windows Server editions, are compatible with PostgreSQL. Make sure that the installation you download is compatible with the architecture and version of Windows that you are using.

Q. Do I need administrative privileges to install PostgreSQL on Windows?

Yes, administrative privileges are typically required to install PostgreSQL on Windows. This allows the installer to make necessary changes to your system, such as adding PostgreSQL to the PATH variable and creating necessary directories.

Q. Can I install PostgreSQL on Windows without using the graphical installer?

While the graphical installer is the most common method for installing PostgreSQL on Windows, you can install it using the command-line interface (CLI). However, this method may require more manual configuration.

Q. What if I forget the password for the PostgreSQL superuser (postgres)?

If you lose the password for the PostgreSQL superuser (postgres), you may need to reset it. You can accomplish this by either manually upgrading the password file in the PostgreSQL data directory or using the PostgreSQL installer.

Q. Is it necessary to restart my computer after installing PostgreSQL on Windows?

PostgreSQL for Windows typically does not require a computer restart after installation. But before you can utilize PostgreSQL, you might have to manually start the database.

Q. How do I uninstall PostgreSQL from Windows if needed?

You can use the Control Panel’s “Add or Remove Programs” option to uninstall PostgreSQL from Windows. To uninstall PostgreSQL from your system, simply find it in the list of installed programs, select it, and click “Uninstall”. 

Q. Can I install multiple versions of PostgreSQL on the same Windows machine?

It is possible to install numerous PostgreSQL versions on a single Windows computer. However, every installation needs to utilize a distinct port and data directory to prevent conflicts.

Q. Is PostgreSQL free to use on Windows?

On Windows and other operating systems, PostgreSQL is an open-source database management system that is available for free. For the majority of uses, PostgreSQL does not require a license fee.

Try this guide with our instant dedicated server for as low as 40 Euros