DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Last call! Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workloads.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Related

  • Hello YugabyteDB: Running Kong on the Distributed PostgreSQL Database
  • Quick Pattern-Matching Queries in PostgreSQL and YugabyteDB
  • Lessons Learned Moving From On-Prem to Cloud Native
  • Using Envoy Proxy’s PostgreSQL and TCP Filters to Collect Yugabyte SQL Statistics

Trending

  • Mastering Fluent Bit: Installing and Configuring Fluent Bit on Kubernetes (Part 3)
  • Why High-Performance AI/ML Is Essential in Modern Cybersecurity
  • Unlocking the Benefits of a Private API in AWS API Gateway
  • AI Meets Vector Databases: Redefining Data Retrieval in the Age of Intelligence
  1. DZone
  2. Data Engineering
  3. Databases
  4. Getting Started With Postgres: Three Free and Easy Ways

Getting Started With Postgres: Three Free and Easy Ways

In this article, explore three practical, user-friendly, and absolutely free ways to kickstart your PostgreSQL journey.

By 
Denis Magda user avatar
Denis Magda
DZone Core CORE ·
Aug. 11, 23 · Tutorial
Likes (7)
Comment
Save
Tweet
Share
7.6K Views

Join the DZone community and get the full member experience.

Join For Free

Hello, fellow developers! This year, approximately 90,000 of us participated in the Stack Overflow survey. Impressively, we crowned Postgres as the #1 database. Moreover, DB Engines also spotlights PostgreSQL as one of the fastest-growing databases worldwide. What does this mean for us?

It's clear that we should strive to become PostgreSQL experts. An essential step in this direction is setting up our own database for hands-on experiments. 

So, whether you prefer reading or watching, let’s walk through three practical, user-friendly, and absolutely free ways to kickstart your PostgreSQL journey.

Option #1: Dive Into Postgres With Docker

The simplest and most pocket-friendly way to start your journey with PostgreSQL is Docker.

Back to the Future + Postgres image

That's right: with a single Docker command, you have your database container humming merrily on your laptop:

Shell
 
docker run --name postgresql \
    -e POSTGRES_USER=postgres -e POSTGRES_PASSWORD=password \
    -p 5432:5432 \
    -d postgres:latest


The advantages are immense! Setting up your database is incredibly fast, and guess what? It all happens right on your hardware.

Next, use your preferred SQL editor, like DataGrip, to open a database connection. Ensure you connect to localhost and use the username and password from the Docker command mentioned earlier.

Data Sources and Drivers screen

Once connected, execute a few simple SQL statements to ensure the Postgres instance is ready for more advanced experiments:

SQL
 
create table back_to_the_future(id int, name text);
insert into back_to_the_future(1, 'Doc');
select * from back_to_the_future;


Option #2: Jump Into Cloud-Native Postgres With Neon

The second cost-free and straightforward way to learn PostgreSQL caters to those eager to delve into public cloud environments right from the start.

What if I told you there is one more way

Neon is a PostgreSQL-compatible database born and bred in the cloud. The icing on the cake? It's serverless. Dive in without spending a penny, and it autonomously scales your workload as needed.

Eager to get started with Neon? For us developers, the command line is home, isn't it? Kick things off by installing the Neon Command Line Tool:

Shell
 
npm i -g neonctl


Then authenticate and create an account:

Shell
 
neonctl auth


Create a new project and database instance:

Shell
 
neonctl projects create --name mynewproject --region-id aws-us-east-1
neonctl databases create --name newdb


Lastly, fetch your database connection string and you're set:

Shell
 
neonctl connection-string --database-name newdb 


Use that connection string to link up with the database instance via DataGrip:

Link up with the database instance via DataGrip

For quick verification, execute a couple of straightforward SQL commands:

SQL
 
create table matrix(id int, name text);
insert into matrix values(1, 'Neo');
select * from matrix;


Option #3: Build on Scalable Postgres With YugabyteDB

Therefore, do you think you're done? Not at all, my friend!

We have not finished yet

We conclude with YugabyteDB - the PostgreSQL "beast." Not only does it scale up and out across zones and regions, but it also withstands the most challenging cloud armageddons. Plus, its special knack: pinning user data to specific geographic locations.

Want a taste of YugabyteDB straight in the cloud? YugabyteDB Managed (DBaas) offers a free tier, gifting you a dedicated single-node instance, to begin with, and you can simply transition to their dedicated plan when you're ready.

And now, for the grand tradition! Time to fire up a YugabyteDB instance straight from the command line. First, install the ybm tool:

Shell
 
brew install yugabyte/tap/ybm


Next, create an account and sign in using your authentication token:

Shell
 
ybm signup
ybm auth


The final steps involve setting up your first database instance:

Shell
 
ybm cluster create \
    --cluster-name yugabyte \
    --credentials username=admin,password=password-123 \
    --cluster-tier Sandbox \
    --cloud-provider AWS \
    --wait


And add your laptop to the database’s IP allow list (yep, YugabyteDB folks take security seriously):

Shell
 
ybm network-allow-list create \
   --ip-addr \$(curl ifconfig.me) \
   --name my-address

ybm cluster network allow-list assign \\
   --network-allow-list my-address \\
   --cluster-name yugabyte


Alright, once the database is started, take its connection string:

Shell
 
ybm cluster describe --cluster-name yugabyte


And use that string to establish a connection via DataGrip:

Establish a connection via DataGrip


With the connection opened, send a few SQL commands to YugabyteDB to make sure the "beast" is ready to serve your requests:

SQL
 
create table avengers(id int, name text);
insert into avengers values(1, 'Hulk');
select * from avengers;


That’s All… For Now

With PostgreSQL's popularity on the rise, it's inevitable you'll cross paths with it in upcoming projects. So why wait? Dive in now. And there's no better way to learn than by doing. Roll up your sleeves, launch a Postgres instance using one of the three methods outlined in this article, and savor the journey ahead.

Database YugabyteDB Docker (software) PostgreSQL

Opinions expressed by DZone contributors are their own.

Related

  • Hello YugabyteDB: Running Kong on the Distributed PostgreSQL Database
  • Quick Pattern-Matching Queries in PostgreSQL and YugabyteDB
  • Lessons Learned Moving From On-Prem to Cloud Native
  • Using Envoy Proxy’s PostgreSQL and TCP Filters to Collect Yugabyte SQL Statistics

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!