Skip to main content

Posts

How to Move PostgreSQL Temporary Files to a Dedicated Disk for Faster Queries

Welcome back to my PostgreSQL optimization series! In previous posts, I covered installing PostgreSQL 18 with an optimized disk layout and relocating WAL files to a dedicated disk. Today, I'm tackling another critical performance optimization: moving temporary files to their own disk volume. If you've ever run complex queries involving large sorts or joins and watched your database slow to a crawl, this optimization is for you. Understanding PostgreSQL Temporary Files Before we dive into the how, let's understand the what and why. PostgreSQL creates temporary files when performing operations that exceed available memory. These files support operations like: Large sorts - When ORDER BY clauses process more data than fits in work_mem Hash joins - When joining large tables that exceed hash_mem limits Aggregations - GROUP BY operations on massive datasets Window functions - Complex analytical queries with partitioning Here's what makes temporary files unique:...
Recent posts

How to Move PostgreSQL WAL Files to a Dedicated Disk for Better Performance (Step-by-Step Guide)

  Moving PostgreSQL WAL Files to a Dedicated Disk: A Complete Guide In my previous post, I covered installing PostgreSQL 18 with a performance-optimized disk layout. Today, I'm diving deeper into one of the most impactful optimizations you can make: relocating your Write-Ahead Log (WAL) files to a dedicated disk volume. This seemingly simple change can dramatically reduce I/O contention and boost your database performance, especially for write-heavy workloads. Let me show you exactly how to do it safely. What Are WAL Files and Why Do They Matter? Write-Ahead Logs are the backbone of PostgreSQL's durability guarantees. They're sequential transaction logs that record every change made to your database before those changes hit the actual data files. Think of them as a detailed journal of everything happening in your database. WAL files serve two critical purposes: Crash Recovery : If PostgreSQL crashes unexpectedly, WAL files allow the database to replay transactions an...

Complete Guide to PostgreSQL 18 Source Installation with Performance Optimization

PostgreSQL 18 brings powerful new features and performance improvements that make it an excellent choice for modern database workloads. In this comprehensive guide, I'll walk you through installing PostgreSQL 18 from source code while implementing a strategic disk layout that maximizes performance. Why Install from Source? While package managers offer convenience, building PostgreSQL from source gives you complete control over configuration and optimization options. This flexibility allows you to tailor the database precisely to your hardware and workload requirements. Prerequisites Before we begin, ensure you're working with a RHEL, CentOS, or Fedora-based system. We'll be installing several development tools and libraries needed for compilation. Installation Process 1. Download PostgreSQL 18 Source Code First, grab the latest PostgreSQL 18 source tarball: wget https://ftp.postgresql.org/pub/source/v18.0/postgresql-18.0.tar.gz 2. Install Required Dependencies Install all n...

🚀 DB BOT: Real-Time Oracle & GoldenGate Monitoring in Slack

In today's fast-paced DevOps environment, quick access to database metrics is essential. This blog will walk you through creating a Slack bot that provides real-time monitoring of Oracle databases and Golden Gate replication. With simple slash commands, your team can check tablespace usage, Flash Recovery Area status, and Golden Gate replication health directly in Slack. Project Overview Our "DB Bot" offers these key capabilities: Monitor tablespace usage across multiple Oracle databases Check Flash Recovery Area (FRA) status on multiple databases View GoldenGate process status across different servers List GoldenGate credential stores Monitor replication lag in GoldenGate Prerequisites Node.js v14+ Python 3.6+ Oracle client libraries (instantclient_21_19) Access to Oracle databases and GoldenGate servers A Slack workspace with permissions to add apps   Project Structure oracle-slack-bot...

How to Install MySQL on Windows: A Complete Step-by-Step Guide

  Setting up MySQL on your Windows machine doesn't have to be complicated. Whether you're a developer starting a new project or a student learning database management, this comprehensive guide will walk you through every step of installing MySQL Server on Windows. What You'll Need Before we begin, make sure you have: A Windows computer with administrator privileges A stable internet connection for downloading the installer At least 2GB of free disk space Step 1: Download the MySQL Installer The first step is getting the official MySQL installer from the source: Navigate to the official MySQL downloads page: https://dev.mysql.com/downloads/installer/ You'll see two installer options: Web installer (smaller download, requires internet during installation) Full installer (larger download, includes all components offline) Choose the version that best fits your needs and download the in...

Installing MySQL Community Edition on Amazon Linux 2023 with Custom Data Directory

  Setting up MySQL on Amazon Linux 2023 with a dedicated storage configuration can significantly improve your database performance and management capabilities. In this comprehensive guide, we'll walk through the process of installing MySQL Community Edition and configuring it to use a separate mounted filesystem for data storage. Why Use a Custom Data Directory? Before diving into the installation, let's understand why you might want to configure MySQL with a custom data directory: Performance : Dedicated storage can provide better I/O performance Scalability : Easier to resize storage independently from the root filesystem Backup Management : Simplified backup processes by isolating database files Security : Better separation between system and application data System Requirements For this tutorial, we're working with the following system configuration: Operating System : Amazon Linux 2023.8.20250818.0 x86_64 Kernel : 6.1 Storage Configuration : /dev/xvda1 ...

⚡ Automating Oracle 19c Database Patching on Windows Server with PowerShell

Applying Oracle patches on Windows often feels repetitive and error-prone — stopping services, updating OPatch, applying patches, running datapatch , and restarting services. To save time ⏱ and reduce mistakes ⚠, I created a PowerShell automation script that performs the patching process end-to-end 🚀. 🔹 Why Automate Oracle Patching? ⏱ Save time by automating repetitive steps ⚙ Avoid manual errors during patching 📜 Maintain logs for auditing and troubleshooting 🛡 Ensure consistent, reliable patching 🔹 Full PowerShell Script # --- CONFIGURATION --- $oracleHome = "c:\users\administrator\downloads\v982656-01" # Change if this is not your actual Oracle Home! $patchDir = "C:\Users\Administrator\Downloads\p37962957_190000_MSWIN-x86-64\37962957" #update the Patchfile directory $opatchDir = "$oracleHome\OPatch" $opatchZip = "C:\Users\Administrator\Downloads\p6880880_190000_MSWIN-x86-64.zip" #Based on your setup update Opatch di...