Category: MySQL & Other Databases

  • Have You Ever Thought About Vibe Coding Your Own Database Engine?

    DATABASE ENGINEERING   /   AI-ASSISTED DEVELOPMENT

    From a college project written in C to architecting a relational database engine with AI.

    Jugal Shah   |   Database & AI Architect   |   aiDeeva

    What if you could build your own database engine?

    During my college days, I built a simple invoice management system using C, linked lists, and doubly linked lists. It allowed users to add, delete, update, and retrieve invoice records.

    At the time, implementing these basic data operations from scratch was an exciting engineering challenge. I had to think about how records were organized, how memory was managed, and how different operations interacted with the underlying data structures.

    Looking back, that project sparked my curiosity about how database systems work internally.

    THEN VS. NOW

    💻

    College Days

    C programming, linked lists, manual memory management, and basic record operations.

    🤖

    Today

    AI coding agents, modern programming languages, and the opportunity to explore complete database architectures.

    Fast-forward to today.

    We now have AI coding assistants capable of generating code, explaining complex algorithms, helping design software architectures, and accelerating development in ways that were difficult to imagine during my college days.

    And that got me thinking:

    “If I could build a basic invoice management system using C and linked lists back then, what could I build today with modern programming languages, database engineering principles, and AI as my engineering copilot?”

    Could I build my own relational database engine?

    Not another application running on PostgreSQL or SQLite.

    An actual database engine that manages its own storage, processes SQL queries, maintains indexes, handles transactions, and recovers from failures.

    That’s the engineering challenge I want to explore through aiDeeva.

    01. What Does It Really Take to Build a Database Engine?

    When most developers think about a database, they think about SQL.

    Consider a simple example:

    CREATE TABLE customers (
        customer_id INTEGER PRIMARY KEY,
        customer_name VARCHAR(100),
        email VARCHAR(255)
    );
    
    INSERT INTO customers
    VALUES (
        1,
        'Jugal',
        'jugal@example.com'
    );
    
    SELECT *
    FROM customers
    WHERE customer_id = 1;

    Three simple SQL statements.

    But behind those statements is an entire execution infrastructure.

    When you execute an INSERT, the database must validate the statement, locate the table, identify the appropriate storage pages, write the record, update indexes, and maintain transactional consistency.

    When you execute a SELECT, the database must parse the SQL, resolve table and column references, determine an execution strategy, retrieve data, and return the result.

    And when the system crashes, the database must recover without losing acknowledged committed transactions.

    These are not simply programming tasks. They are architectural responsibilities.

    Inside a Relational Database Engine

    APPLICATIONS & SQL CLIENTS
    SQL Queries · Connections · Result Sets
    ↓
    SQL QUERY ENGINE
    Parser → Binder → Planner → Executor
    ↓

    DATABASE KERNEL

    Transaction Manager
    Buffer Pool Manager
    Index Manager
    Catalog Manager
    ↓
    STORAGE ENGINE
    Pages · Records · Files
    RECOVERY ENGINE
    WAL · Checkpoints
    ↓
    PERSISTENT STORAGE
    Data Files · Index Files · Transaction Logs

    Conceptual single-node database architecture. Transaction, storage, buffer, and recovery components cooperate across subsystem boundaries.

    Our goal is to build these components incrementally, using AI to accelerate implementation while retaining architectural control.

    02. Introducing aiDeevaDB: Our Database Engineering Experiment

    Before writing code, we need to define what we are actually building.

    For this engineering experiment, let’s call our database aiDeevaDB.

    CONCEPTUAL ENGINEERING PROJECT

    aiDeevaDB

    An AI-assisted, single-node SQL relational database built from first principles.

    Initial Design Objectives

    • Persistent row-oriented storage
    • A defined subset of SQL
    • B+ Tree indexing
    • Transaction processing and crash recovery
    • A basic query planner and executor
    • Single-node deployment

    Why start with a single-node database?

    Because distribution introduces an entirely different category of engineering challenges.

    Before solving consensus, replication, and distributed transaction coordination, we need to demonstrate that our database can reliably store and retrieve information on one machine.

    Our initial success criterion is straightforward:

    Create a table, insert records, restart the database, execute queries, and verify that committed data remains consistent.

    Then progressively introduce indexing, concurrent transactions, recovery, and query optimization.

    03. The Engineering Roadmap: Seven Stages to a Relational Database

    Building a database should be treated as a sequence of engineering milestones, not a single enormous AI prompt.

    The aiDeevaDB Development Roadmap

    STAGE 01

    Storage Foundation

    Build a disk manager, fixed-size pages, record layouts, and persistent table storage.

    Milestone: Records survive a database restart.

    STAGE 02

    Memory Management

    Introduce a buffer pool, page pinning, dirty-page tracking, and a replacement policy.

    Milestone: Frequently accessed pages are cached safely.

    STAGE 03

    Indexes and Access Paths

    Implement persistent B+ Tree indexes, node splits, point lookups, and range scans.

    Milestone: Queries can locate records without scanning every page.

    STAGE 04

    SQL Processing

    Build a SQL parser, catalog, binder, logical planner, and execution operators.

    Milestone: The engine accepts a defined subset of SQL.

    STAGE 05

    Transactions and Concurrency

    Implement transaction lifecycle management, isolation, locking, and rollback.

    Milestone: Concurrent operations preserve defined consistency guarantees.

    STAGE 06

    Durability and Recovery

    Integrate write-ahead logging, commit durability, checkpoints, and crash recovery.

    Milestone: Committed transactions survive supported crash scenarios.

    STAGE 07

    Optimization and Validation

    Add statistics, plan selection, benchmarks, fault injection, and regression tests.

    Milestone: Correctness and performance are measured against explicit targets.

    The roadmap describes our learning and development sequence, not seven completely independent components.

    Storage, transactions, indexing, and recovery must eventually operate together through well-defined interfaces and protocols.

    04. Where AI Changes the Development Process

    Traditionally, building a database engine requires engineers to implement and validate each subsystem manually.

    AI coding agents introduce a different development model.

    An architect can define the subsystem, establish its interfaces, specify its invariants, and ask an AI agent to propose an implementation.

    AI can generate code, write tests, explain design alternatives, and help investigate failures.

    However, AI-generated code is not automatically correct, particularly in low-level systems where subtle concurrency or durability defects may only appear under unusual conditions.

    The architect remains responsible for the system’s guarantees.

    The AI-Assisted Engineering Loop

    1. ARCHITECT DEFINES THE CONTRACT
    Requirements · Interfaces · Invariants
    ↓
    2. AI GENERATES IMPLEMENTATION
    Code · Unit Tests · Documentation
    ↓
    3. ENGINEERING VALIDATION
    Correctness · Concurrency · Failure Testing
    ↓
    4. REVIEW AND REFINE
    Fix Defects · Revisit Assumptions · Optimize

    ↻ Repeat until the acceptance criteria pass.

    An Example: Building the Buffer Pool Manager

    A generic prompt might say:

    “Build a database cache that stores 100 pages in memory.”

    An architectural prompt should go further.

    AI ENGINEERING PROMPT

    Build a buffer pool manager for a single-node relational database.

    Implement a fixed-capacity page cache with page identifiers, pin counts, dirty-page tracking, and an LRU replacement policy.

    Define how concurrent requests access cached pages and how the manager coordinates with persistent storage.

    Ensure that pinned pages cannot be evicted and that dirty-page flushing respects the write-ahead logging durability protocol once recovery support is integrated.

    Generate unit tests for page loading, eviction, concurrent access, and I/O failures.

    The difference is not simply a longer prompt.

    It is the explicit definition of system behavior, failure conditions, and correctness requirements.

    That is where architectural expertise becomes essential.

    05. The Real Challenge: A Database Must Be Correct When Things Go Wrong

    A database that successfully executes SQL under normal conditions is only the beginning.

    What happens if the application crashes halfway through a transaction?

    What happens when two transactions update the same record?

    What happens when an index node splits while another operation is reading the index?

    What happens when a storage write fails?

    These questions separate a database demonstration from a reliable database system.

    The Four ACID Guarantees

    A — Atomicity

    A transaction either commits its intended changes or has no lasting effect.

    C — Consistency

    Transactions preserve the database’s defined integrity constraints and invariants.

    I — Isolation

    Concurrent transactions interact according to the database’s documented isolation guarantees.

    D — Durability

    Acknowledged committed transactions survive failures within the database’s stated durability model.

    These guarantees require coordination across multiple database subsystems.

    Write-ahead logging alone does not guarantee ACID. Neither does using a memory-safe programming language.

    The complete transaction, storage, concurrency, and recovery protocols must work together.

    For aiDeevaDB, every major engineering milestone should include tests that deliberately attempt to violate the guarantees the system claims to provide.

    06. What Would a Working aiDeevaDB Actually Look Like?

    Imagine opening a terminal and connecting to the database engine we have built.

    The following is an illustrative target for our future implementation, not a demonstration of an already completed database.

    aideevadb> CREATE TABLE products (
        id INTEGER PRIMARY KEY,
        name VARCHAR(100),
        price DECIMAL(10,2)
    );
    
    OK. Table created.
    
    aideevadb> INSERT INTO products
    VALUES (101, 'AI Server', 2499.00);
    
    OK. 1 row inserted.
    
    aideevadb> SELECT id, name, price
    FROM products
    WHERE id = 101;
    
    +-----+-----------+---------+
    | id  | name      | price   |
    +-----+-----------+---------+
    | 101 | AI Server | 2499.00 |
    +-----+-----------+---------+
    
    1 row returned.

    The interface may look simple, but the system behind it is not.

    The SQL parser recognizes the statement. The catalog resolves the table and columns. The planner selects an access path. The executor retrieves the relevant record through the storage and indexing subsystems.

    The transaction manager and recovery infrastructure coordinate to maintain the database’s defined consistency and durability guarantees.

    At this point, we have more than an AI-generated script.

    We have the foundation of a relational database engine.

    07. Where This Journey Could Lead: AI-Native Database Engineering

    Building a database from scratch is an engineering challenge in its own right.

    But the longer-term opportunity is exploring how AI can improve the way database systems are developed, operated, and optimized.

    Imagine an AI-assisted database engineering platform that can examine query workloads, analyze execution plans, recommend indexing strategies, investigate performance regressions, and propose storage optimizations.

    A Possible AI-Native Database Architecture

    APPLICATIONS & SQL WORKLOADS
    ↓
    RELATIONAL DATABASE ENGINE
    SQL · Transactions · Storage · Recovery
    ↕
    OBSERVABILITY & WORKLOAD INTELLIGENCE
    Query Plans · Statistics · Latency · Resource Metrics
    ↕
    AI ENGINEERING & OPTIMIZATION LAYER
    Workload Analysis · Recommendations · Diagnostics
    ↓
    VALIDATION & CONTROLLED EXECUTION
    Policy Checks · Benchmarks · Human Approval · Rollback

    Conceptual AI-native extension of aiDeevaDB. AI proposes improvements while deterministic database components retain responsibility for execution and correctness.

    This is an important distinction.

    An LLM should not be responsible for deciding whether a transaction is committed or whether a storage page is durable.

    Those decisions belong to deterministic, verifiable database protocols.

    AI can instead assist with higher-level analysis, engineering recommendations, and optimization workflows.

    That separation allows us to explore AI-native database capabilities without abandoning the reliability principles that database systems depend on.

    08. Can You Really Build a Database Engine With Vibe Coding?

    Yes, AI-assisted development can help you build an educational database engine from scratch.

    But there is a significant difference between generating a functional prototype and engineering a database that can safely support production workloads.

    A prototype can demonstrate storage, SQL execution, and indexing with a limited feature set.

    A production database requires considerably more work: comprehensive failure handling, concurrency correctness, recovery validation, operational tooling, security, performance engineering, and sustained testing.

    AI can accelerate parts of that work.

    It does not eliminate the need for database engineering expertise.

    The real opportunity is not replacing database engineers with prompts. It is enabling engineers to explore more ambitious architectures, validate ideas faster, and spend more time on the design decisions that matter.

    Final Thoughts

    We are entering a period where AI-assisted development makes complex systems engineering more accessible.

    Database engines, compilers, operating systems, and distributed platforms are no longer projects that engineers must approach entirely through manual implementation.

    But accessibility should not be confused with simplicity.

    The real engineering challenge is not getting AI to generate thousands of lines of code.

    It is designing a system whose components work together correctly, defining the guarantees it must uphold, and validating those guarantees under realistic operating conditions.

    That is the journey I want to explore through aiDeevaDB.

    From the first persistent storage page to a functioning SQL engine, and eventually toward AI-assisted database optimization.

    The question is no longer just whether AI can help us write a database engine. It is how we can use AI to build better database systems while preserving the engineering discipline that makes them trustworthy.

    COMING NEXT ON AIDEEVA

    What Happens When a Database Writes a Record to Disk?

    In the next article, we’ll explore database page layouts, row storage, record identifiers, buffer pools, and how to begin implementing a persistent storage engine with AI-assisted development.

    ABOUT THE AUTHOR

    Jugal Shah

    Database & AI Architect | aiDeeva

    Jugal Shah works across enterprise database modernization, cloud data platforms, and AI architecture. His experience includes PostgreSQL, SQL Server, Teradata, Snowflake, Amazon Redshift, and Databricks.

    Through aiDeeva, he explores the intersection of database engineering, enterprise architecture, and AI-assisted software development.

    Interested in database engine development, enterprise database modernization, or AI-native data infrastructure? Connect with Jugal to discuss architecture, engineering, and collaboration opportunities.

  • Data Engineering ETL Patterns

    Data Engineering ETL Patterns: A Practical Deep Dive for Modern Pipelines

    In the early days of data engineering, ETL was a straightforward assembly line: extract data from a handful of transactional systems, transform it inside a monolithic compute engine, and load it into a warehouse that fed dashboards. That world doesn’t exist anymore.

    Case Study: How Large-Scale ETL Looked in 2006 — Lessons from the PhoneSpots Pipeline

    To understand how ETL patterns have evolved, it helps to look at real systems from the pre-cloud era. One of the most formative experiences in my early career came from managing the data ingestion and transformation pipeline at PhoneSpots back in 2006.

    The architecture was surprisingly large for its time: more than 600 MySQL instances deployed across the USA and EMEA. Our job was to ingest high-volume application logs coming in from distributed servers, run batch transformations, and load the structured output into these geographically distributed databases.

    There was nothing “serverless” or “auto-scaling” then. Everything hinged on custom shell scripts, cron-scheduled batch jobs, and multiple Linux servers executing transformation logic in parallel. Each stage performed cleansing, normalization, enrichment, and aggregation before pushing the data downstream.

    Once the nightly ingestion cycles finished, we generated business and operational reports using BIRT (Eclipse’s Business Intelligence and Reporting Tools). Leadership teams depended heavily on these reports for operational decisions, so reliability mattered as much as correctness. That meant building our own monitoring dashboards, tracking failures across hundreds of nodes, and manually tuning jobs when a server lagged or a batch window ran long.

    Working on that system taught me many of the principles that still define robust ETL today:

    • Batch patterns scale surprisingly well when designed carefully
    • Distributed ingestion requires tight orchestration and recovery logic
    • Monitoring isn’t an afterthought; it is part of the architecture
    • A pipeline is only as good as its failure-handling strategy

    Even though today’s tools are vastly more advanced—cloud warehouses, streaming architectures, metadata-driven frameworks—the foundational patterns remain the same. The PhoneSpots pipeline was a reminder that ETL is ultimately about disciplined engineering, regardless of era or tooling.

    Today’s data platforms deal with dozens of sources, streaming events, multi-cloud target systems, unstructured formats, and stakeholders who want insights in near real time. The fundamentals of ETL haven’t changed, but the patterns have evolved. Understanding these patterns—and when to apply them—is one of the biggest differentiators for a strong data engineer.

    Below is a deep dive into the most battle-tested ETL design patterns used in modern systems. These aren’t theoretical descriptions. They come from real-world pipelines that run at scale in finance, e-commerce, logistics, healthcare, and tech companies.


    1. The Batch Extraction Pattern

    When to use: predictable workloads, stable source systems, large datasets
    Core reasoning: reliability, cost efficiency, and operational simplicity

    Batch extraction is still the backbone of many pipelines. In high-throughput environments, pulling data in scheduled intervals (hourly, daily, or even every few minutes) allows the system to optimize throughput and cost.

    A typical batch extraction implementation uses one of these approaches:

    • Full Extract — pulling all data on a schedule (rare now, but still used for small datasets).
    • Incremental Extract — using timestamps, high-water marks, CDC logs, or version columns.
    • Microbatch — batching small intervals (e.g., every 5 minutes) using orchestrators like Airflow or AWS Glue Workflows.

    The beauty of batch extraction is timing predictability. The downside: latency. If your business model requires user-facing freshness (e.g., fraud detection), batch extraction isn’t enough.


    2. Change Data Capture (CDC) Pattern

    When to use: transaction-heavy systems, low-latency requirements, minimal source-impact
    Core reasoning: avoiding full refreshes, reducing load on source systems

    CDC is one of the most important patterns in the modern data engineer’s toolkit. Instead of pulling everything repeatedly, CDC taps into database logs to capture inserts, updates, and deletes in real time. Technologies like Debezium, AWS DMS, Oracle GoldenGate, and SQL Server Replication are the usual suspects.

    The advantages are huge: low source load, near real-time replication, and efficient transformations.

    However, CDC introduces complexity: schema drift, log retention tuning, and ordering guarantees. A poorly configured CDC pipeline can silently fall behind for hours or days. When using CDC, data engineers must monitor LSN/SCN offsets, replication lags, and dead-letter queues religiously.


    3. The ELT Pattern (Transform Later)

    When to use: cloud warehouses, large-scale analytics, dynamic business transformations
    Core reasoning: push heavy computation downstream to cheaper and scalable engines

    The rise of Snowflake, BigQuery, and Redshift shifted the industry from ETL to ELT: extract, load raw data, then transform inside the warehouse.

    This pattern works exceptionally well when:

    • Data volume is large and transformations are complex
    • Business logic evolves frequently
    • SQL is the primary transformation language
    • You need a single source of truth for both raw and curated layers

    The ELT workflow allows the raw zone to stay untouched—helping auditability, debugging, and replayability. It also centralizes the logic in SQL pipelines (dbt being the industry’s favorite).

    But ELT is not a silver bullet. Complex transformations (e.g., heavy ML feature engineering) often require distributed compute engines outside the warehouse.


    4. Streaming ETL (Real-Time ETL)

    When to use: low-latency analytics, event-based architectures, ML inference, monitoring
    Core reasoning: business decisions that rely on second-level or millisecond-level freshness

    Streaming ETL changes the game in industries like ride-sharing, payments, IoT, gaming telemetry, and logistics. Instead of waiting for batch windows, data is processed continuously.

    The pattern typically uses:

    • Kafka / Kinesis — for ingestion
    • Flink / Spark Structured Streaming — for processing
    • Delta Lake / Apache Hudi / Iceberg — for incremental table updates

    A streaming ETL pattern requires design decisions around:

    • Exactly-once semantics
    • State management
    • Late arrival handling (watermarks)
    • Reprocessing logic
    • Back-pressure and throughput tuning

    Streaming pipelines give you near real-time insights but require deep operational maturity. Without proper monitoring, a stream can silently accumulate lag and cause cascading failures.


    5. The Merge (Upsert) Pattern

    When to use: CDC, slowly changing data, fact tables with late-arriving records
    Core reasoning: maintaining accurate history and reconciling evolving records

    Upserts are everywhere in modern ETL. A raw event arrives, an earlier event updates the same business key, or a late transaction changes the state of an order.

    Technologies like MERGE INTO (Snowflake, BigQuery), Delta Lake, Iceberg, and Hudi make this easy.

    The subtle challenge with merge patterns is ensuring deterministic ordering. If ingestion doesn’t respect row ordering, the warehouse might process updates in the wrong sequence, causing incorrect facts and broken KPIs.

    Good pipelines maintain:

    • Surrogate keys
    • Version columns
    • Timestamp ordering
    • Idempotence

    Engineers who ignore these details end up with hard-to-diagnose data anomalies.


    6. The Slowly Changing Dimension (SCD) Pattern

    When to use: dimensional models, tracking attribute changes over time
    Core reasoning: ensuring historical accuracy for analytics

    SCD is one of the oldest patterns but still essential for enterprise analytics.

    Common types:

    • SCD Type 1 — Overwrite, no history
    • SCD Type 2 — Preserve history via new rows and validity windows
    • SCD Type 3 — Limited history stored in separate fields

    Most production-grade systems rely on Type 2. Proper SCD requires consistent surrogate key generation, effective-dates management, and careful handling of expired records.

    Typical mistakes:

    • Not closing old records properly
    • Handling out-of-order updates incorrectly
    • Forgetting surrogate keys and relying only on natural keys

    SCD patterns force engineers to think carefully about how a business entity evolves.


    7. The Orchestration Pattern

    When to use: dependency-heavy pipelines, multi-step workflows
    Core reasoning: making pipelines reliable, observable, and recoverable

    Great ETL isn’t just about data movement—it is about orchestration.

    Tools like Airflow, Dagster, Prefect, and AWS Glue Workflows coordinate:

    • Ingestion
    • Transformations
    • Quality checks
    • Data publishing
    • Monitoring

    A good orchestration pattern defines:

    • Clear task dependencies
    • Retry logic
    • Failure notifications
    • SLAs and SLIs
    • Conditional branching (for late-arriving data or schema drift)

    The difference between a junior pipeline and a senior one usually shows in orchestration quality.


    8. The Data Quality Gate Pattern

    When to use: high-trust domains, finance, healthcare, executive reporting
    Core reasoning: preventing bad data from propagating downstream

    Data quality is no longer optional. Pipelines increasingly embed:

    • Schema checks
    • Row count validations
    • Nullability checks
    • Distribution checks
    • Business-rule assertions

    Tools like Great Expectations, Soda, dbt tests, or custom validation frameworks enforce contracts across the pipeline.

    A quality gate ensures that if something breaks upstream, downstream consumers get notified instead of ingesting garbage.


    9. The Multi-Zone Architecture Pattern

    When to use: enterprise platforms, scalable ingestion layers
    Core reasoning: clarity, reproducibility, lineage, governance

    Most mature data lakes and warehouses follow a layered architecture:

    • Landing / Raw Zone — untouched source replication
    • Staging Zone — format normalization, light transformations
    • Curated Zone — business-ready models, fact/dim structure
    • Presentation Zone — consumption-ready data for BI/ML

    This pattern enables:

    • Reprocessing without impacting source systems
    • Strong lineage
    • Auditing capability
    • Role-based access
    • Data contract boundaries

    A well-designed multi-zone pattern dramatically improves platform maintainability.


    10. The End-to-End Metadata-Driven ETL Pattern

    When to use: large enterprises, high schema variability, multi-source environments
    Core reasoning: automating transformations and reducing manual work

    A metadata-driven pattern uses config files or control tables to define:

    • Source locations
    • Target mappings
    • Transform logic
    • SCD rules
    • Validation checks

    Instead of hardcoding pipelines, the system reads instructions from metadata and executes dynamically. This is the architecture behind many enterprise ETL platforms like Informatica, Talend, AWS Glue Studio, and internal frameworks in large companies.

    Metadata-driven ETL reduces development time, enforces consistency, and enables self-service analytics teams.


    Conclusion

    ETL patterns are not one-size-fits-all. The art of data engineering lies in selecting the right pattern for the right workload and combining them intelligently. A single enterprise pipeline might use CDC to extract changes, micro-batch to stage them, SCD Type 2 to maintain history, and an orchestration engine to tie everything together.

    What makes an engineer “senior” is not knowing the patterns—it is knowing when to apply them, how to scale them, and how to operationalize them so the entire system is reliable.

  • Types of Modern World Database Administrators

    1. System DBA

    • Responsibilities:
      • Focus on the physical and technical aspects of database management.
      • Install, configure, and upgrade database software.
      • Manage the operating system and hardware that the database runs on.
      • Monitor system performance and manage system resources.
      • Implement and manage database security.
    • Technologies:
      • Database Systems: Oracle, SQL Server, MySQL, PostgreSQL, DB2
      • Operating Systems: Linux, Windows, Unix
      • Virtualization: VMware, Hyper-V
      • Cloud Platforms: AWS, Azure, Google Cloud Platform (GCP)
      • Cloud Databases: Amazon RDS, Azure SQL Database, Google Cloud SQL, Amazon Aurora
      • Cloud Storage: Amazon S3, Azure Blob Storage, Google Cloud Storage
      • Monitoring Tools: Amazon CloudWatch, Azure Monitor, Google Stackdriver
      • Backup Solutions: AWS Backup, Azure Backup, Google Cloud Backup and DR

    2. Database Architect

    • Responsibilities:
      • Design the overall database structure and architecture.
      • Develop and maintain database models and standards.
      • Plan for scalability and performance improvements.
      • Work with application developers to design and optimize queries.
      • Ensure data integrity and normalization.
    • Technologies:
      • Database Systems: Oracle, SQL Server, MySQL, PostgreSQL, MongoDB
      • Modeling Tools: ERwin, Microsoft Visio, Lucidchart
      • Data Warehousing: Amazon Redshift, Snowflake, Google BigQuery
      • ETL Tools: AWS Glue, Azure Data Factory, Google Dataflow
      • Cloud Platforms: AWS, Azure, Google Cloud Platform (GCP)
      • Infrastructure as Code (IaC): AWS CloudFormation, Azure Resource Manager (ARM) templates, Google Deployment Manager

    3. Application DBA

    • Responsibilities:
      • Focus on managing and optimizing the database from the application’s perspective.
      • Work closely with developers to understand the database needs of applications.
      • Tune SQL queries and database performance for applications.
      • Ensure database changes and deployments are aligned with application requirements.
      • Manage database objects such as tables, indexes, and views used by applications.
    • Technologies:
      • Database Systems: Oracle, SQL Server, MySQL, PostgreSQL
      • Application Servers: AWS Elastic Beanstalk, Azure App Service, Google App Engine
      • ORM Tools: Hibernate, Entity Framework, Sequelize
      • Performance Tuning: AWS RDS Performance Insights, Azure SQL Database Advisor, Google Cloud SQL Insights
      • Version Control: AWS CodeCommit, Azure Repos, Google Cloud Source Repositories

    4. Development DBA

    • Responsibilities:
      • Support development projects by creating and managing development databases.
      • Collaborate with development teams to design database schemas.
      • Develop and optimize stored procedures, functions, and triggers.
      • Participate in code reviews and ensure best practices for database programming.
      • Assist in testing and deploying database changes.
    • Technologies:
      • Database Systems: Oracle, SQL Server, MySQL, PostgreSQL
      • Development Languages: PL/SQL, T-SQL, Python, Java, C#
      • Version Control: Git (GitHub, GitLab, Bitbucket)
      • CI/CD Tools: AWS CodePipeline, Azure DevOps, Google Cloud Build
      • Testing Tools: JUnit, pytest, SQL Unit Test

    5. Data Warehouse DBA

    • Responsibilities:
      • Manage data warehouse environments.
      • Design and implement ETL (Extract, Transform, Load) processes.
      • Optimize the performance of data warehouse queries and reports.
      • Ensure data quality and integrity within the data warehouse.
      • Work with BI (Business Intelligence) tools and support data analytics needs.
    • Technologies:
      • Data Warehousing: Amazon Redshift, Snowflake, Google BigQuery, Azure Synapse Analytics
      • ETL Tools: AWS Glue, Azure Data Factory, Google Dataflow
      • BI Tools: AWS QuickSight, Microsoft Power BI, Google Data Studio
      • SQL: Advanced SQL, Window Functions, Analytical SQL
      • Cloud Platforms: AWS, Azure, Google Cloud Platform (GCP)

    6. Operational DBA

    • Responsibilities:
      • Focus on the day-to-day operation and maintenance of databases.
      • Monitor database performance and troubleshoot issues.
      • Perform regular backups and ensure data recovery processes.
      • Manage database user accounts and permissions.
      • Implement and manage database security policies.
    • Technologies:
      • Database Systems: Oracle, SQL Server, MySQL, PostgreSQL, DB2
      • Backup Solutions: AWS Backup, Azure Backup, Google Cloud Backup and DR
      • Monitoring Tools: Amazon CloudWatch, Azure Monitor, Google Stackdriver
      • Automation Scripts: Shell scripting, PowerShell, AWS Lambda, Azure Functions
      • Cloud Platforms: AWS, Azure, Google Cloud Platform (GCP)
      • Security Tools: AWS IAM, Azure AD, Google Cloud IAM

    7. Cloud DBA

    • Responsibilities:
      • Manage databases hosted in cloud environments (e.g., AWS, Azure, Google Cloud).
      • Ensure optimal configuration and performance of cloud-based databases.
      • Manage cloud-specific database services like Amazon RDS, Azure SQL Database, etc.
      • Implement cloud-specific security and compliance measures.
      • Monitor and manage cloud resource usage and costs.
    • Technologies:
      • Cloud Platforms: AWS, Azure, Google Cloud Platform (GCP)
      • Cloud Databases: Amazon RDS, Azure SQL Database, Google Cloud SQL, Amazon Aurora, Google BigQuery, Azure Cosmos DB
      • Infrastructure as Code (IaC): Terraform, AWS CloudFormation, Azure Resource Manager (ARM) templates
      • Monitoring Tools: AWS CloudWatch, Azure Monitor, Google Cloud Monitoring
      • Security Tools: AWS IAM, Azure AD, Google Cloud IAM

    8. DevOps DBA

    • Responsibilities:
      • Integrate database management with DevOps practices.
      • Automate database deployment and configuration using scripts and tools.
      • Collaborate with DevOps teams to ensure continuous integration and delivery (CI/CD) of database changes.
      • Implement monitoring and logging for databases as part of the DevOps pipeline.
      • Ensure database environments are consistent across development, testing, and production.
    • Technologies:
      • CI/CD Tools: AWS CodePipeline, Azure DevOps, Google Cloud Build, Jenkins
      • Configuration Management: Ansible, Puppet, Chef
      • Containerization: Docker, Kubernetes, AWS EKS, Azure AKS, Google Kubernetes Engine (GKE)
      • Scripting Languages: Bash, Python, PowerShell
      • Monitoring Tools: Prometheus, Grafana, AWS CloudWatch, Azure Monitor, Google Cloud Monitoring

    9. Performance Tuning DBA

    • Responsibilities:
      • Focus on optimizing database performance.
      • Analyze and tune SQL queries for efficiency.
      • Monitor and optimize database indexes and storage.
      • Identify and resolve performance bottlenecks.
      • Work with developers and other DBAs to implement performance improvements.
    • Technologies:
      • Database Systems: Oracle, SQL Server, MySQL, PostgreSQL
      • Performance Tools: Oracle AWR, SQL Server Profiler, EXPLAIN (PostgreSQL), MySQL Performance Schema
      • Indexing Tools: DBMS_STATS (Oracle), SQL Server Index Tuning Wizard
      • Monitoring Tools: AWS RDS Performance Insights, Azure SQL Database Advisor, Google Cloud SQL Insights

    10. Security DBA

    • Responsibilities:
      • Ensure databases are secure from internal and external threats.
      • Implement and manage database encryption, authentication, and authorization.
      • Conduct security audits and vulnerability assessments.
      • Develop and enforce database security policies and procedures.
      • Monitor for security breaches and respond to incidents.
    • Technologies:
      • Database Systems: Oracle, SQL Server, MySQL, PostgreSQL
      • Security Tools: AWS IAM, Azure AD, Google Cloud IAM, Oracle Data Vault, SQL Server TDE, pgcrypto (PostgreSQL)
      • Auditing Tools: AWS CloudTrail, Azure Security Center, Google Cloud Audit Logs
      • Encryption: SSL/TLS, TDE (Transparent Data Encryption)
      • Authentication: Kerberos, LDAP, Active Directory

  • How PostgreSQL stores the oversized or extended fields?

    Recently I was loading the very large analytics data set to the PosgreSQL table and compare to the rows/tuples size, table has claimed the around 200X of the storage. Upon the investigation I found the issue related to toast bloating and have to reclaim the space. Let’s learn about the toast table in this article.

    PostgreSQL loads and stores the data into pages. The page size is commonly 8KB. The page is used to store tuples, indexes etc. Even WAL files are written 8KB pages. Therefore it is not possible to store the very large field values directly to the page. To store the large filed values, PostgreSQL compresses the values and sliced into multiple rows. This technique is known as TOAST. TOAST the values (compressing and slicing) will also help handling large values in the memory.

    Toast is enabled by default and all tables will have the toast table associated with it. You can check the toast table by querying the pg_class. Toast tables are resides in the PG_Toast schema.

    select relname from pg_class where oid = (select reltoastrelid from pg_class where relname=’TABLE_NAME’)

    or

    select oid, relname,reltoastrelid, relkind from pg_class where relname = ‘table name’

    select oid, relname, relkind from pg_class where oid = ‘reltoastrelid from above query’

    In the next article we will check more information about the toast table bloating and how to reclaim the space from toast table.

  • PostgreSQL – .pgpass file

    .pgpass file in a user’s home directory or the file referenced by PGPASSFILE can contain passwords to be used if the connection requires a password (and no password has been specified otherwise). On Microsoft Windows the file is named %APPDATA%\postgresql\pgpass.conf (where %APPDATA% refers to the Application Data subdirectory in the user’s profile).

    This file should contain lines of the following format:
    hostname:port:database:username:password

    You can follow below steps to connect to PostgreSQL or PostgreSQL compatible tool or database systems.

    Step 1: Created the .pgpass file. Below command will create the hidden .pgpass file in the home directory.

    vi ~/.pgpass

    Step 2: Add the connection details with the instnace, port, database, user and password information in the below format. You can also use the wild card character like * as well.

    PostgreSQLInstance1:5432:mydatabase:myuser:mypassword
    *:*:mydatabase:myuser:mypassword

    Step 3: On Unix systems, the permissions on .pgpass must disallow any access to world or group; achieve this by the command chmod 0600 ~/.pgpass. Changed file mode to 600 as below

    chmod 600 ~/.pgpass

    Step 4: Export the PGPASSFILE file
    export PGPASSFILE=~/.pgpass

    Step 5: Test the connection. PGSQL -w (lower case) option will not prompt for password and will connect using the password from the .pgpass file.

    Example:
    psql -U imuser -h MySQLPgsql.sqldbpool.com myDB -p 5432 -w -c “select * from tb1”

    id
    —-
    3
    1
    2

    (3 rows)

    PGSQL -W (upper case) will prompt for the password even specified in .pgpass file.
    Example :
    psql -U imuser -h MySQLPgsql.sqldbpool.com myDB -p 5432 -w -c “select * from tb1”
    Password for user imuser:

    id
    —-
    3
    1
    2