Fading Coder

One Final Commit for the Last Sprint

Efficient Execution Patterns for Hybrid Aggregate-Window Operations in PostgreSQL

Analytical workloads combinign aggregate calculations with window functions often create performance bottlenecks due to PostgreSQL's multi-stage execution pipeline. When processing queries containing both GROUP BY aggregations and OVER() clauses, the executor materializes intermediate results betwee...

PostgreSQL Asynchronous Messaging with LISTEN and NOTIFY

PostgreSQL includes a built-in publish-subscribe framework that enables database sessions to exchange asynchronous signals without relying on external message brokers. This communication layer is implemented through the LISTEN and NOTIFY commands, allowing backend processes and client applications t...

Tracing PostgreSQL Parser Reductions with Bison Debug Output

Enabling the Bison Trace Add the following snippet to the C declarations section of src/backend/parser/gram.y: #ifdef YYDEBUG #undef YYDEBUG #endif #define YYDEBUG 1 int base_yydebug = 1; int plpgsql_yydebug = 1; /* matches %name-prefix used by pl_gram.y */ #define YYFPRINTF trace_parser #include &l...

Integrating DuckDB as a Custom Table Access Method and Executor in PostgreSQL

Embedding an analytical engine like DuckDB directly into PostgreSQL requires bridging two distinct execution models. By implementing a custom extension that hooks in to PostgreSQL's executor and Table Access Method (TAM) interfaces, it is possible to route specific workloads to DuckDB's vectorized,...

PostgreSQL Aggregate Functions and HAVING Clause Implementation

This article examines the implementation of aggregate functions and the HAVING clause in PostgreSQL from a source code perspective. We'll explore how PostgreSQL processes SQL queries containing aggregate operations through its execution pipeline. The PostgreSQL query processing pipeline consists of...

Installing and Configuring PostgreSQL 15 with Streaming Replication on Rocky Linux 9

1. Enable EPEL and CRB Repositories dnf config-manager --set-enabled crb dnf -y install epel-release epel-next-release If the command dnf config-manager is not found, run: dnf install 'dnf-command(config-manager)' -y 2. Install PostgreSQL 15 dnf module -y install postgresql:15 3. Initialize the Data...

Building a Vector Extension for PostgreSQL

Vector databases have surged in popularity, especially with the rise of AI and semantic search applications. Rather than building a database from scratch, we can extend an existing, robust system like PostgreSQL. Thanks to its well-documented extension API and strong ecosystem—exemplified by project...

Understanding Divergent String Sort Orders in PostgreSQL

PostgreSQL comparison and sorting behavior for text data depends on the collation setting. Running an ORDER BY on the same column can yield different sequences when the underlying collation changes. The example below demonstrates the phenomenon using a simple table containing letters and a leading-s...

Greenplum Cluster Operations and Maintenance Guide

Starting the Cluster gpstart -a # bring the entire cluster online gpstop -r # restart after configuration changes that require reboot gpstop -u # reload config files without stopping services Master-only Maintenance Mode gpstart -m # start master in utility mode PGOPTIONS='-c gp_session_role=utility...

Installing PostgreSQL 12 with PostGIS on Rocky Linux 9

Enable the CRB and EPEL repositories, then add the official PostgreSQL YUM repositroy: dnf install 'dnf-command(config-manager)' -y dnf config-manager --set-enabled crb dnf install -y epel-release dnf install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-9-x86_64/pgdg-redhat-repo-late...