VOOZH about

URL: https://thenewstack.io/pgq-queuing-for-long-running-jobs-in-go-written-atop-postgres/

⇱ PGQ: Queuing for Long-Running Jobs in Go Written Atop Postgres - The New Stack


TNS
SUBSCRIBE
Join our community of software engineering leaders and aspirational developers. Always stay in-the-know by getting the most important news and exclusive content delivered fresh to your inbox to learn more about at-scale software development.
REQUIRED
It seems that you've previously unsubscribed from our newsletter in the past. Click the button below to open the re-subscribe form in a new tab. When you're done, simply close that tab and continue with this form to complete your subscription.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.
Welcome and thank you for joining The New Stack community!
Please answer a few simple questions to help us deliver the news and resources you are interested in.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Great to meet you!
Tell us a bit about your job so we can cover the topics you find most relevant.
REQUIRED
REQUIRED
REQUIRED
REQUIRED
REQUIRED
Welcome!

We’re so glad you’re here. You can expect all the best TNS content to arrive Monday through Friday to keep you on top of the news and at the top of your game.

What’s next?

Check your inbox for a confirmation email where you can adjust your preferences and even join additional groups.

Follow TNS on your favorite social media networks.

Become a TNS follower on LinkedIn.

Check out the latest featured and trending stories while you wait for your first TNS newsletter.

PREV
1 of 2
NEXT
VOXPOP
As a JavaScript developer, what non-React tools do you use most often?
Angular
0%
Astro
0%
Svelte
0%
Vue.js
0%
Other
0%
I only use React
0%
I don't use JavaScript
0%
Thanks for your opinion! Subscribe below to get the final results, published exclusively in our TNS Update newsletter:
NEW! Try Stackie AI
From clobbered drafts to real-time sync
Apr 14th 2026 10:00am, by David Moore
TypeScript 6.0 RC arrives as a bridge to a faster future
Mar 14th 2026 9:00am, by Darryl K. Taft
Mastra empowers web devs to build AI agents in TypeScript
Jan 28th 2026 11:00am, by Loraine Lawson
2024-02-06 06:00:23
PGQ: Queuing for Long-Running Jobs in Go Written Atop Postgres
profile,sponsor-percona,sponsored-topic,
Data / Software Development

PGQ: Queuing for Long-Running Jobs in Go Written Atop Postgres

With Postgres, developers can add simple but reliable message queues for their services using the infrastructure they’re likely already familiar with.
Feb 6th, 2024 6:00am by Susan Hall
👁 Featued image for: PGQ: Queuing for Long-Running Jobs in Go Written Atop Postgres

When Dataddo was maxing out the capabilities of RabbitMQ, it discovered it already had a solution hiding in plain sight: PostgreSQL.

Long-running jobs with RabbitMQ were leading to heartbeat timeouts and reconnects without full observability into why the problems were happening. Running it on hosted AWS meant the data integration company couldn’t configure RabbitMQ quite the way it wanted, but didn’t have the engineering capability to manage the open source message broker in-house.

Working with some Postgres contributors on other projects, the global data integration company found that Postgres, the tried-and-true workhorse database could quite nicely handle those long-running jobs and provide better insights into any potential problems. Thus the queuing mechanism PGQ, short for Postgres queue, was born and made open source.

Written in Go and built on top of a Postgres database, it means developers can add simple but reliable message queues for their services using the infrastructure they’re likely already familiar with.

“A lot of people are interested in this topic. …[They] already use Postgres in their company or on the project, and they are facing the same troubles or they are using Postgres for everything, and are satisfied with that,” said Dataddo CTO Tomáš Sedláček, adding that using RabbitMQ, Kafka or another tool simply adds another technology that developers have to learn and maintain. From a hiring standpoint, it’s easier to find engineers who just know Postgres, he said.

A Regular Postgres Table

The queue in PGQ is just a regular Postgres table, so anyone who has some experience with standard SQL can use it to look at a table, insert new rows or whatever. PGQ uses a publisher-consumer model in which publishers add events to the queue and consumers process them asynchronously. With a high volume of tasks distributed across multiple workers, this also enables jobs to execute in parallel. PGQ is designed to be resilient even amid temporary failures with mechanisms to handle errors and retries.

Improved visibility is one big plus, according to Sedláček.

Dataddo found observability limited with RabbitMQ — only able to see what is waiting to be processed, not what is being or what has already been processed.

In Postgres, everything is written to the hard disk rather than in memory mode to eliminate the risk of losing any data, which means there’s a record of everything that happens whether processing was completed or not. You can easily track metrics such as queue depth, processing and error rates and customize them according to your needs.

“When using PGQ, you have nice observability about what is happening in the queue; [errors] are mitigated by default … Like what happened yesterday in the queue? … It’s already stored there until you delete it,” he said.

The company maintains that PGQ works well for companies that already use Postgres, don’t need to optimize for speed and don’t want to deal with the learning curve and maintenance of yet another technology. Because it’s writing everything to hard disk, PGQ will be a tad slower than Kafka, according to Sedláček, but not all that much.

But it’s not well suited for companies with highly advanced requirements for message routing or those dealing with extreme volumes and needing to optimize for throughput.

Though only for Go applications at the moment, a PHP version is in the works.

How Dataddo Uses PGQ Internally

Founded in 2018, Dataddo offers a fully managed, no-code data integration platform that provides ETL (extract, transform, load), ELT (extract, load, transform) and reverse ETL services along with more than 250 connectors to securely send data between cloud-based applications and business intelligence tools, data warehouses and data lakes.

Its customers include X (formerly Twitter), Ogilvy, Uber Eats, international financial services provider Allianz and Microsoft.

Dataddo uses PGQ internally for more than 200,000 long-running jobs daily, as well as short jobs like sending emails or saving logs, asynchronous app communication between Go, PHP and Node.js, and monitoring the performance of its own platform.

Percona is widely recognized as a world-class open source database software, support, and services company for MySQL®, MongoDB®, and PostgreSQL® databases. We are dedicated to helping make your databases and applications run better through a unique combination of expertise and open source software.  
Learn More
The latest from Percona
TRENDING STORIES
Susan Hall is the Sponsor Editor for The New Stack. Her job is to help sponsors attain the widest readership possible for their contributed content. She has written for The New Stack since its early days, as well as sites...
Read more from Susan Hall
SHARE THIS STORY
TRENDING STORIES
SHARE THIS STORY
TRENDING STORIES
TNS DAILY NEWSLETTER Receive a free roundup of the most recent TNS articles in your inbox each day.
The New Stack does not sell your information or share it with unaffiliated third parties. By continuing, you agree to our Terms of Use and Privacy Policy.