<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Geopits Global Pvt Ltd on Medium]]></title>
        <description><![CDATA[Stories by Geopits Global Pvt Ltd on Medium]]></description>
        <link>https://medium.com/@geopitswebmaster?source=rss-e2b434e06715------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*_IUoFcRMwziKOlM5YwMpHQ.png</url>
            <title>Stories by Geopits Global Pvt Ltd on Medium</title>
            <link>https://medium.com/@geopitswebmaster?source=rss-e2b434e06715------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 08:48:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@geopitswebmaster/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Your Database Worked Fine at 200 GB. Here’s What Breaks at 5 TB]]></title>
            <link>https://medium.com/@geopitswebmaster/your-database-worked-fine-at-200-gb-heres-what-breaks-at-5-tb-4e33c509b16b?source=rss-e2b434e06715------2</link>
            <guid isPermaLink="false">https://medium.com/p/4e33c509b16b</guid>
            <dc:creator><![CDATA[Geopits Global Pvt Ltd]]></dc:creator>
            <pubDate>Tue, 13 Oct 2026 15:20:48 GMT</pubDate>
            <atom:updated>2026-10-13T15:20:48.095Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Your Database Worked Fine at 200 GB. Here’s What Breaks at 5 TB</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*f5WSFZnx_1iix_JNy-lndQ.png" /></figure><p>At small scale, either one works. At terabyte scale, your choice affects cost, uptime, and how many engineers it takes to keep the lights on.</p><p>Picture a retail company with a 200 GB database. Everything runs smoothly. Then the data grows to 5 TB.</p><p>Queries that took milliseconds now take seconds. The nightly backup that finished in an hour is still running when the first reports are due. Dashboards time out.</p><p>None of this happens overnight. But once it starts, it exposes weaknesses that were always there, just hidden by low data volume.</p><p>This is the point where the <strong>PostgreSQL vs MySQL</strong> decision changes shape. At small scale, either database can run a business without much trouble. At enterprise scale, the choice affects storage costs, query speed, uptime, and how much engineering effort goes into just keeping the database healthy.</p><p>Here’s how I’d think about it.</p><p><strong>What actually changes at terabyte scale</strong></p><p>A 10 GB database runs happily on one small server with no tuning. A 10 TB database does not. Four problems show up again and again:</p><ul><li><strong>Storage growth:</strong> disks fill faster than teams expect</li><li><strong>Query speed:</strong> reports that took seconds start taking minutes</li><li><strong>Concurrency:</strong> more people, apps, and services hit the database at once</li><li><strong>Availability:</strong> downtime gets expensive, so failures and maintenance must not take you down</li></ul><p>So the real question isn’t “which database wins a lab benchmark?” It’s <strong>which one fits your workload, your team’s skills, and your growth plans over the next five years.</strong></p><p><strong>The short answer</strong></p><p>The main deciding factor is <strong>workload complexity and data integrity needs</strong>.</p><ul><li><strong>PostgreSQL</strong> suits complex systems that need advanced data types, strict accuracy, and heavy processing.</li><li><strong>MySQL</strong> suits fast, web-scale applications with high-speed reads and simpler data structures.</li></ul><p><strong>Performance: it depends on the workload</strong></p><p>MySQL tends to win on simple, high-volume reads. PostgreSQL tends to win on complex queries and heavy write activity.</p><p><strong>MySQL is a natural fit for:</strong></p><ul><li>E-commerce catalogs</li><li>Content platforms</li><li>Apps with high-volume, repetitive read traffic</li></ul><p><strong>PostgreSQL is a natural fit for:</strong></p><ul><li>Financial systems</li><li>Analytics platforms</li><li>Workloads with heavy or complex writes</li></ul><p>For most standard applications, the performance gap between the two is small. Proper indexing and query optimization will affect your speed far more than the engine you pick.</p><p><strong>Read replicas: the easiest scaling win</strong></p><p>Both databases support read replicas, which are copies of your database used only for reading. They take load off the main server and speed up reporting. For read-heavy applications, this is one of the simplest and most effective moves you can make.</p><p>The catch is <strong>replication lag</strong>, the delay between the main server and its replicas. Replicas can show slightly outdated data, which matters a lot in finance or inventory systems where up-to-the-second accuracy counts.</p><p>How they compare on replication:</p><ul><li><strong>PostgreSQL:</strong> supports physical and logical replication. It’s more flexible but needs more configuration, and it suits complex data flows and selective replication.</li><li><strong>MySQL:</strong> primarily statement- or row-based replication. It’s straightforward to set up and has a strong track record for high read traffic.</li><li><strong>Both:</strong> need extra tooling for fully automated failover, and both can manage lag with tuning.</li></ul><p><strong>Backups and disaster recovery</strong></p><p>At terabyte scale, backups take longer and use more storage. Both databases support full and incremental backups, but enterprise teams usually add extra tools for faster, more reliable recovery.</p><p>A strong backup and recovery plan matters as much as the engine itself.</p><p><strong>Operational effort: the hidden cost</strong></p><p>This is the factor leaders often underestimate.</p><p>MySQL is generally easier to manage day to day, especially for teams without deep database expertise. PostgreSQL offers more configuration options and advanced features, but it often needs a more skilled team to run well.</p><p>Neither database runs itself at terabyte volume. Both need:</p><ul><li>Storage planned ahead of need (adding storage under pressure is costlier and riskier)</li><li>Automated backups and monitoring</li><li>Regular tuning of queries and indexes as data grows</li></ul><p>Without good monitoring, small issues turn into major outages before anyone notices.</p><p><strong>What matters more than the database you pick</strong></p><p>Four things shape long-term scalability more than the engine itself:</p><ol><li>A <strong>partitioning strategy</strong> matched to how your data is actually queried</li><li><strong>Healthy, low-lag replication</strong> across read replicas</li><li><strong>Indexing</strong> that is reviewed and updated as data grows</li><li><strong>A team that knows how to tune</strong> the system, not just install it</li></ol><p><strong>So which one should you choose?</strong></p><p><strong>Lean PostgreSQL if</strong> you run complex queries or analytics, need strict data accuracy, expect heavy write traffic, or are planning for substantial growth. Its query planner and partitioning tools tend to scale predictably into the terabyte range and beyond.</p><p><strong>Lean MySQL if</strong> your app is high-traffic and read-heavy, you value simplicity and lower operational overhead, or you want a large talent pool, since MySQL skills are common and easy to hire.</p><p>Team expertise matters too. A company with strong in-house database skills may get more from PostgreSQL’s advanced features. A smaller team may find MySQL easier to run reliably over time.</p><p><strong>Quick FAQ</strong></p><p><strong>Can PostgreSQL handle terabytes of data?</strong> Yes, especially with proper partitioning, indexing, and hardware planning.</p><p><strong>Can MySQL?</strong> Yes. MySQL architectures routinely handle datasets from a few terabytes upward.</p><p><strong>When should I use partitioning vs sharding?</strong> Partition first, since it’s simpler and lower risk. Move to sharding only when a single, well-tuned server can’t handle your volume or traffic even with strong partitioning and replication.</p><p><strong>The bottom line</strong></p><p>Neither database automatically wins at scale. Both can support terabyte-level workloads when they’re designed and managed well. What matters is how well your team applies partitioning, replication, and tuning as your data grows.</p><p>Originally published on the <a href="https://www.geopits.com/blog/postgresql-vs-mysql">Geopits blog</a>. Geopits helps enterprises manage, tune, and modernize their databases.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4e33c509b16b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Why Serious Engineering Teams Keep Quietly Leaving MySQL for PostgreSQL]]></title>
            <link>https://medium.com/@geopitswebmaster/why-serious-engineering-teams-keep-quietly-leaving-mysql-for-postgresql-268d68a2799a?source=rss-e2b434e06715------2</link>
            <guid isPermaLink="false">https://medium.com/p/268d68a2799a</guid>
            <dc:creator><![CDATA[Geopits Global Pvt Ltd]]></dc:creator>
            <pubDate>Wed, 12 Aug 2026 14:01:03 GMT</pubDate>
            <atom:updated>2026-08-12T14:12:29.124Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Lp3fBb-lQIhRJTNUGXjh5g.png" /></figure><p><strong>8 technical reasons to stop putting off the PostgreSQL migration</strong><br> <br> MySQL got you here. It probably won’t get you there.<br> <br>If your app started on MySQL, you’re in good company, it’s fast, it’s simple, it basically ran the entire web through the LAMP-stack years. Nothing wrong with that. But lately, watching where the serious engineering teams keep ending up, fintech, AI infra, geospatial, anything analytics-heavy, there’s a pattern you can’t really unsee once you notice it. Postgres. Almost every single time.<br> <br>If you’re running a simple, read-heavy CRUD app and your team already knows MySQL’s tooling cold, honestly, there’s no fire to put out. Don’t migrate just because some blog post told you to, that’s a bad reason to spend three sprints on a database migration. But once you outgrow that stage, once you need complex queries, schema changes that don’t make you nervous, or actual support for messy semi-structured data, Postgres starts winning arguments that are just annoyingly hard to counter. So here’s the case, technical receipts included.<br> <br> 1. Transactional DDL might be reason enough by itself<br> <br> In MySQL, DDL statements like `CREATE TABLE` or `ALTER TABLE` auto-commit. No rollback. None, zero, not happening. So when a migration fails halfway through, and eventually it will, you’re stuck with a half-changed schema and whatever manual cleanup that implies. I’ve personally watched a teammate lose an entire Friday afternoon to exactly this.<br> <br> Postgres wraps DDL in the same transactional guarantees as your actual data, which sounds obvious until you realize MySQL doesn’t do it. Script dies on step 5 of 10? Roll the whole thing back. No partial state, no manual repair job, no panicked message to the team at 2am. If you’re running automated migrations through CI/CD, this one feature might justify the whole switch on its own.<br> <br>2. MVCC beats fighting lock contention, and also makes more sense<br> <br> MySQL’s InnoDB leans on row-level locking, gap locks included, under its default REPEATABLE READ isolation level. That exists to stop phantom reads, which is a real problem worth solving. But it also produces deadlocks that catch people completely off guard, usually right when traffic spikes, which is exactly when you don’t need surprises.<br> <br>Postgres does this differently. MVCC, Multi-Version Concurrency Control if you want the full name, means every transaction works off its own consistent snapshot of the data. Readers don’t block writers. Writers don’t block readers. Not under normal conditions anyway. For mixed read and write OLTP workloads that’s a real, measurable bump in throughput, not a marketing claim. You do need `VACUUM` to clean up old row versions, and that used to trip people up constantly. Tune autovacuum properly though and it mostly just fades into the background.<br> <br>3. The type system isn’t even a fair fight, not really<br> <br> MySQL gives you the standard SQL types plus a handful of extras, `TINYINT`, `ENUM`, that kind of thing. Postgres gives you quite a bit more. Arrays as first-class columns. Range types like `daterange` and `tsrange` with containment operators built in. Native UUIDs, where MySQL just crams them into `VARCHAR(36)` or `BINARY(16)` and moves on. Geometric and network types, `inet`, `cidr`, `point`, `polygon`. Custom composite and enum types. And `tsvector`/`tsquery` for full-text search that actually ranks results instead of just matching keywords and shrugging.<br> <br> If your schema is more than flat rows of numbers and strings, and let’s be honest, whose schema actually is anymore, this starts mattering a lot sooner than most teams expect.<br> <br> 4. JSONB actually indexes. MySQL’s JSON? Not really<br> <br> MySQL’s JSON type, even as of 5.7 and later, is limited. No native containment operator. No GIN-style indexing on arbitrary paths. JSON columns can’t even be part of a primary key or unique constraint, which feels like a strange limitation until you dig into why.<br> <br> Postgres’s JSONB is binary, pre-parsed, and supports GIN indexes on any key or value inside it. You get operators like `@&gt;` for containment queries, so something like `WHERE data @&gt; ‘{“status”: “active”}’` actually hits an index instead of scanning the whole table row by row. Go ahead, try replicating that cleanly in MySQL. It’s not pretty. It’s never really been pretty.<br> <br> 5. Indexes that were actually built for how real systems behave<br> <br> Postgres has index types MySQL just doesn’t offer at all. GiST for spatial, geometric, and range queries. BRIN, tiny footprint, great for time-ordered data where you don’t need precision on every row. Partial indexes that only cover rows matching a specific `WHERE` clause. Expression indexes that let you index the result of any expression, not just a bare column sitting there doing nothing<br> <br> And then there’s `CREATE INDEX CONCURRENTLY`, which builds an index without blocking writes at all, the whole time. Compare that to MySQL’s `ALTER TABLE … ADD INDEX`, which grabs a metadata lock and blocks writes for however long the build takes. On a big live table that’s not some minor inconvenience. That’s the difference between routine maintenance on a random Tuesday and a scheduled downtime window nobody wanted to plan, announce, or apologize for.<br> <br>6. Extensibility, honestly, is the real moat<br> <br> Postgres lets you define custom data types, operators, aggregate functions, and if you’re feeling ambitious, entirely new index access methods. Add in procedural languages, PL/pgSQL, PL/Python, PL/R, plus Foreign Data Wrappers that let you query external systems as though they were local tables sitting right there, and you end up with an ecosystem MySQL genuinely can’t match. PostGIS for geospatial work. TimescaleDB for time-series. pgvector for AI and ML embedding search. Citus for distributed sharding. pg_partman for partition automation, because nobody wants to write that by hand twice.<br> <br> If you’re anywhere near AI, geospatial, or time-series work, this tends to be the actual deciding factor. More often than people expect walking into the conversation, in my experience anyway.<br> <br> 7. Analytics is where Postgres just pulls away and doesn’t look back<br> <br>MySQL still wins at dead-simple, read-heavy OLTP. Primary-key lookups on InnoDB are fast, its thread-per-connection model has lower overhead when concurrency is low, and it’s a genuinely solid fit for a CMS or a basic e-commerce catalog. No shade intended there, it does that job well.<br> <br> But the moment queries get complicated, joins, subqueries, window functions, recursive CTEs, Postgres’s planner just pulls ahead. Hash joins, merge joins, parallel query execution, and since version 11, JIT compilation for CPU-bound analytical work that would otherwise crawl. Past the simple lookups, it honestly isn’t close.<br> <br> 8. Replication that actually fits how teams build things today<br> <br> MySQL replication is mature, sure, nobody’s arguing otherwise. But it carries baggage. Statement-based replication can diverge on non-deterministic functions in ways that are genuinely miserable to debug at 3am. And getting to full HA usually means bolting InnoDB Cluster or some third-party orchestration tool on top of everything else you’re already running.<br> <br> Postgres gives you physical streaming replication with fine-grained sync durability, plus logical replication, table-level, available from version 10 onward, which is great for selective replication, cross-version upgrades, and multi-region setups that would otherwise be a nightmare. Pair it with Patroni and you get a genuinely modern HA story. Not one that feels bolted together out of spare parts.<br> <br> So, should you actually migrate?<br> <br> Not always. If you’re running something simple and your team already knows MySQL inside and out, there’s no urgent reason to blow that up for a blog post’s sake.<br> <br> But it’s worth taking seriously if any of this rings a bell. Foreign keys, constraints, and safe DDL rollback actually matter to how your team ships code. You’re storing JSON and want it to query fast You need real analytics, window functions, CTEs, parallel query, the whole toolkit, not a subset of it. You’re doing geospatial or AI/ML work that needs vector search baked in. You want index builds that don’t require booking a maintenance window and apologizing to customers. Or you need replication flexibility that goes beyond a basic master-replica setup from a decade ago.<br> <br> Migrating costs something, no question about that. Schema conversion, query rewrites, some retraining for a team that’s used to doing things the MySQL way for years. But if you’ve genuinely outgrown MySQL’s simplicity, and a lot of teams have without quite admitting it yet, Postgres tends to pay that cost back faster than most people expect walking in. <a href="https://www.geopits.com/blog/mysql-vs-postgresql-a-complete-comparison-of-performance-scalability-features">Learn more</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=268d68a2799a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Best Practices and Common Challenges in Real-Time Data Migration Using CDC and Kafka for data…]]></title>
            <link>https://medium.com/@geopitswebmaster/best-practices-and-common-challenges-in-real-time-data-migration-using-cdc-and-kafka-data-f916dfba11f4?source=rss-e2b434e06715------2</link>
            <guid isPermaLink="false">https://medium.com/p/f916dfba11f4</guid>
            <dc:creator><![CDATA[Geopits Global Pvt Ltd]]></dc:creator>
            <pubDate>Thu, 09 Jul 2026 06:24:32 GMT</pubDate>
            <atom:updated>2026-07-09T12:12:49.968Z</atom:updated>
            <content:encoded><![CDATA[<h4>Best Practices and Common Challenges in Real-Time Data Migration Using CDC and Kafka for data consistency, latency optimization, error handling, schema evolution, and monitoring data pipelines.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*as9LFeGMrJOtf3CfPB5hug.png" /></figure><p>Migrating data from MSSQL to PostgreSQL in time is becoming very popular for businesses that want to switch databases without any problems. The old way of doing this often meant that the database was not available for a while and there was a risk of losing data. With Change Data Capture or CDC, every change made to the MSSQL database is captured right away and sent to the PostgreSQL database without interrupting anything. Kafka is like a messenger that makes sure these changes are sent reliably and in time so the data remains consistent and accurate throughout the migration process.</p><p>This approach does not just minimize disruptions; it also makes things more scalable and flexible so organizations can update their data infrastructure with confidence. Using CDC and Kafka for real-time migration is not a good idea; it is necessary for businesses that want to stay competitive in today&#39;s world, where data is everything.</p><p>The ideal situation is to have a pipeline that uses CDC to capture every change made to the source MSSQL database and apply these changes to the target PostgreSQL database in time. This way the PostgreSQL database always has the data as the MSSQL database does.</p><p>By doing this you can have a PostgreSQL server that’s ready for production and has the exact same data as your MSSQL database at any given time. This server can be used as a source of truth either temporarily during the migration or permanently after the switch. This method eliminates downtime, reduces the risk of data inconsistencies, and provides a transition path. Using CDC and Kafka for migration not prepares your data infrastructure for the future but also gives your organization the agility and confidence to manage critical database transitions.</p><p>This article aims to provide some insight into the architecture of CDC-based migration, walk through the steps to implement it, and discuss some of the challenges encountered along the way, including undocumented Kafka bugs and CDC complexities.</p><p>Migration: Why CDC?</p><p>A typical example of migrating a database directly would involve the following steps:</p><p>1. Stop all writes to the database</p><p>2. Export the database dump</p><p>3. Optionally perform some data transformation procedures</p><p>4. Import the dump into the target database</p><p>5. Point the application to the database</p><p>This approach is only good for small systems where a brief maintenance window is acceptable. For systems such as order management or inventory management, this approach involves unacceptable risks. With CDC, the entire database does not need to be exported, which removes the need for a maintenance window. Instead, inserts, updates, and deletes can be captured in time and streamed to the target database. This way the PostgreSQL database can be constantly updated in the background. Later switched to become the primary database with minimal data loss.</p><p>Architecture Overview</p><p>The pipeline has four moving parts:</p><ul><li><strong>Source: MSSQL Server - </strong>with CDC enabled at the database and table level</li><li><strong>Debezium SQL Server Connector -</strong> reads the CDC change tables and publishes events to Kafka</li><li><strong>Apache Kafka (KRaft mode) - </strong>acts as the durable, ordered message backbone between source and target</li><li><strong>Sink Connector → PostgreSQL -</strong>consumes Kafka topics and applies changes to the target schema</li></ul><p>Using Kafka in KRaft mode (instead of the older ZooKeeper-based setup) simplifies the cluster considerably: no separate ZooKeeper ensemble to manage, fewer moving parts, and faster broker startup.</p><p>Implementation Steps</p><p><strong>1. Enable CDC on the source database</strong></p><p>-Enable CDC at the database level <br>EXEC sys.sp_cdc_enable_db; <br> <br>-Enable CDC on each table you want to capture <br>EXEC sys.sp_cdc_enable_table <br> @source_schema = ‘dbo’, <br> @source_name = ‘Orders’, <br> @role_name = NULL, <br> @supports_net_changes = 1;</p><p><strong>2. Deploy Kafka in KRaft mode</strong></p><p>KRaft mode requires generating a cluster ID and formatting the storage directory before the first start:</p><p>KAFKA_CLUSTER_ID=”$(bin/kafka-storage.sh random-uuid)” <br>bin/kafka-storage.sh format -t $KAFKA_CLUSTER_ID -c config/kraft/server.properties <br>bin/kafka-server-start.sh config/kraft/server.properties</p><p><strong>3. Configure the Debezium source connector</strong></p><p>{ <br> “name”: “mssql-source-connector”, <br> “config”: { <br> “connector.class”: “io.debezium.connector.sqlserver.SqlServerConnector”, <br> “database.hostname”: “mssql-host”, <br> “database.port”: “1433”, <br> “database.user”: “cdc_user”, <br> “database.password”: “********”, <br> “database.names”: “SalesDB”, <br> “topic.prefix”: “mssql”, <br> “table.include.list”: “dbo.Orders,dbo.Customers”, <br> “schema.history.internal.kafka.bootstrap.servers”: “kafka:9092”, <br> “schema.history.internal.kafka.topic”: “schema-changes.salesdb” <br> } <br>}</p><p><strong>4. Configure the PostgreSQL sink connector</strong></p><p>{ <br> “name”: “postgres-sink-connector”, <br> “config”: { <br> “connector.class”: “io.confluent.connect.jdbc.JdbcSinkConnector”, <br> “connection.url”: “jdbc:postgresql://pg-host:5432/salesdb”, <br> “connection.user”: “pg_user”, <br> “connection.password”: “********”, <br> “topics”: “mssql.dbo.Orders,mssql.dbo.Customers”, <br> “insert.mode”: “upsert”, <br> “pk.mode”: “record_key”, <br> “auto.create”: “true”, <br> “auto.evolve”: “true” <br> } <br>}</p><p>Challenges We Ran Into</p><p>A few issues surfaced during implementation that aren’t well documented:</p><ul><li><strong>Connector plugin path errors </strong>Kafka Connect silently fails to load the Debezium and JDBC sink plugins if plugin.path in connect distributed. Properties don&#39;t exactly match the directory structure the connectors were extracted into. Double-check absolute paths, not relative ones.</li><li><strong>Cluster ID mismatches after restarts</strong> — if the KRaft storage directory is reformatted without regenerating a consistent cluster ID across all broker configs, the cluster refuses to start with a cryptic “Cluster ID does not match” error. Keep the generated cluster ID in a shared config file rather than regenerating it per node.</li><li><strong>Kafka bound to localhost only</strong> — the default advertised. The listener setting works fine on a single machine but breaks the moment Kafka Connect or a remote producer needs to reach the broker. This needs to be set to the broker’s actual reachable hostname or IP, not localhost.</li><li><strong>Schema drift between MSSQL and PostgreSQL types</strong> — SQL Server’s datetime2 and money types don’t map cleanly to PostgreSQL defaults; explicit type mapping in the sink connector config avoids silent precision loss.</li></ul><p>Results</p><p>Real-time synchronization was achieved by implementing CDC and Kafka during the migration process between the live MSSQL database and the PostgreSQL database, enabling the application cutover to take only a few minutes. Once row count, checksum, and data consistency validations between the two databases were confirmed, the source system was turned off safely. This migration approach can easily be scaled and used for different heterogeneous database migration processes, not just MSSQL to PostgreSQL.</p><p>Conclusion</p><p>CDC-based migration may take longer to set up than a straightforward dump-and-load process, yet the benefits are clear for businesses that can’t afford any kind of downtime. Organizations planning to migrate should definitely consider putting in extended effort to configure the Kafka cluster as well as doing thorough testing and debugging of the connectors, as this is where most of the job is usually done and not in the data mapping stage. For organizations lacking expertise in Kafka or CDC technologies, engaging with specialists in cloud database migration services or other data engineering services can greatly accelerate the process from the planning stage to successful implementation. <a href="https://www.geopits.com/blog/real-time-data-migration-from-mssql-to-postgresql-using-cdc-and-kafka">Learn more</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f916dfba11f4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Troubleshooting Kafka and CDC Issues in a Linux-based Data Pipeline]]></title>
            <link>https://medium.com/@geopitswebmaster/troubleshooting-kafka-and-cdc-issues-in-a-linux-based-data-pipeline-b46d0660c315?source=rss-e2b434e06715------2</link>
            <guid isPermaLink="false">https://medium.com/p/b46d0660c315</guid>
            <category><![CDATA[troubleshooting]]></category>
            <category><![CDATA[change-data-capture]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[apache-kafka]]></category>
            <dc:creator><![CDATA[Geopits Global Pvt Ltd]]></dc:creator>
            <pubDate>Thu, 30 Apr 2026 12:08:39 GMT</pubDate>
            <atom:updated>2026-04-30T12:08:39.882Z</atom:updated>
            <content:encoded><![CDATA[<h4>A real-world walkthrough of setting up a Kafka-based data pipeline on Linux — and the unexpected issues that came along the way.<br> From Kafka startup failures to CDC and networking challenges, this blog breaks down practical troubleshooting lessons from the ground up.</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yUTbPKZnYdg5cXDAdkrLig.png" /></figure><h3>Introduction</h3><p>In real-world data engineering, setting up a pipeline is rarely just about installing tools and getting things running smoothly. More often than not, things break, and figuring out why becomes a big part of the process.</p><p>In my case, the goal was to build a streaming pipeline that captures changes from Microsoft SQL Server and pushes them through Kafka. Sounds straightforward on paper, but the actual setup involved quite a bit of trial, error, and debugging.</p><p>The environment was hosted on a Linux virtual machine, and since everything was configured manually, even small mistakes led to unexpected issues. What followed was a series of problems that needed careful investigation and step-by-step troubleshooting.</p><h3><strong>Environment Setup</strong></h3><p>The setup was done on an Ubuntu virtual machine with the following components:</p><ul><li>Microsoft SQL Server (Linux edition)</li><li>Apache Kafka (running in KRaft mode)</li><li>Kafka Connect</li><li>PostgreSQL (as the target database)</li></ul><p>Since nothing was pre-configured, every service had to be installed and set up manually. This gave full control over the environment but also meant there was plenty of room for configuration mistakes.</p><h3>Problem 1 — Kafka Failing to Start</h3><p>One of the first roadblocks came while setting up Kafka in KRaft mode. Kafka simply refused to start and threw an error about an invalid cluster ID.</p><p>At first glance, it wasn’t obvious what went wrong. But after digging into the logs, it became clear that Kafka was picking up old metadata from a previous setup. The log directory still had a meta.properties file, which conflicted with the new cluster ID.</p><p>Kafka is quite strict about this (for good reason — to avoid data corruption).</p><h3><strong>Fix:</strong></h3><ul><li>Removed the existing log directory</li><li>Generated a new cluster ID</li><li>Reformatted the storage directory</li><li>Restarted Kafka</li></ul><p>After that, Kafka started without issues.</p><h3>Problem 2 — Kafka Connect REST API Not Accessible</h3><p>Next issue — Kafka Connect seemed to start, but the REST API on port 8083 wasn’t responding.</p><p>Initially, it felt like a networking problem. But instead of guessing, I checked the logs — and that’s where the real issue showed up.</p><p>Kafka Connect wasn’t actually starting properly because of an incorrect plugin path. Since it couldn’t load the connectors, the service never fully initialized.</p><h3><strong>Fix:</strong></h3><ul><li>Corrected the plugin path configuration</li><li>Restarted Kafka Connect</li></ul><p>Once that was done, the REST API came up as expected.</p><h3>Problem 3 — CDC Changes Not Captured</h3><p>After enabling Change Data Capture (CDC) in SQL Server, I expected to see changes flowing into the CDC tables — but nothing showed up.</p><p>At this point, everything <em>looked</em> correct:</p><ul><li>CDC was enabled at the database level</li><li>Tables were configured</li></ul><p>But still, no data.</p><p>The issue turned out to be simpler than expected — the CDC capture job wasn’t running.</p><h3><strong>Fix:</strong></h3><ul><li>Restarted the CDC capture job</li><li>Verified SQL Server Agent was running</li></ul><p>Once the job was active, the change tables started updating as expected.</p><h3>Problem 4 — Network Binding Issues</h3><p>Another subtle issue came from how services were configured to communicate.</p><p>Initially, some services were bound to localhost. This worked fine when everything was tested on the same machine. But as soon as cross-service communication came into play (especially across containers or external access), connections started failing.</p><p>The reason is simple — localhost only allows internal communication within the same host.</p><h3><strong>Fix:</strong></h3><ul><li>Updated configurations to use 0.0.0.0 instead of localhost</li></ul><p>This allowed services to accept connections from outside and resolved the communication issues.</p><h3>Lessons Learned</h3><p>A few things became very clear during this process:</p><ul><li>Logs are your best friend — always check them before guessing</li><li>Most issues were configuration-related, not tool-related</li><li>Small misconfigurations can cause big failures</li><li>Networking setup matters more than you think in distributed systems</li></ul><h3>Conclusion</h3><p>Setting up a streaming data pipeline isn’t just about installing tools and connecting them. Each component — the database, Kafka, connectors, and network settings — needs to be configured correctly for everything to work smoothly.</p><p>This experience was a good reminder that real-world systems rarely work perfectly on the first try. Debugging, understanding logs, and patiently fixing issues are all part of the process.</p><p>In the end, the pipeline was up and running — but more importantly, the troubleshooting journey gave a much deeper understanding of how these systems actually behave.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b46d0660c315" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Role of Business Intelligence in Financial Decision Making]]></title>
            <link>https://medium.com/@geopitswebmaster/the-role-of-business-intelligence-in-financial-decision-making-ef7b8a3e4622?source=rss-e2b434e06715------2</link>
            <guid isPermaLink="false">https://medium.com/p/ef7b8a3e4622</guid>
            <dc:creator><![CDATA[Geopits Global Pvt Ltd]]></dc:creator>
            <pubDate>Wed, 11 Mar 2026 11:56:09 GMT</pubDate>
            <atom:updated>2026-03-11T12:14:37.551Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>The Role of Business Intelligence in Financial Decision Making</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QKIoAfvIHPsSPqwcDKClAQ.png" /></figure><p>Business intelligence is a game changer when it comes to making financial decisions. It allows organizations to look at a lot of data, find patterns, and really understand what is going on inside and outside the company. With business intelligence tools, financial managers can see what is happening in the market, figure out what customers want, and track how the business is doing. Business intelligence is not about looking at what happened in the past. It helps managers get ahead of problems and predict what is coming next so they can make more strategic choices for the future of the company.</p><p><strong>Data-Driven Strategies for Customer Engagement:</strong></p><p>Keeping customers engaged is very important. Business intelligence gives companies a picture of what their customers care about and what they need. With this knowledge companies can design products that people actually want, which keeps customers happy. Business intelligence also makes it possible to talk to customers in a way that feels personal. When you send messages that speak directly to someone&#39;s interests, you build connections with the customers, and people stick around. This is how you take customer engagement to another level with business intelligence.</p><p><strong>Risk Compliance: How Business Intelligence Improves Safety:</strong></p><p>Every company has to deal with risk. Business intelligence makes it easier. With real-time data, companies can spot threats fast. Deal with them before they turn into bigger problems. Business intelligence tools also make it simple to follow regulations by automating reports and tracking compliance. This is not about avoiding trouble; it shows stakeholders and regulators that the company is serious about playing by the rules. In the world of risk and compliance, business intelligence is necessary.</p><p><strong>Innovative Technologies Shaping the Future of Financial Services:</strong></p><p>New technologies like AI and blockchain are changing financial services, especially when you add business intelligence into the mix. Artificial intelligence helps automate tasks and finds insights that you would never find on your own. Blockchain keeps transactions safe and transparent. When you put these together with business intelligence, financial companies can react quickly to whatever the market throws at them and even get ahead of the curve with business intelligence.</p><p><strong>Case Studies: Successful Business Intelligence Implementations in Financial Institutions:</strong></p><p>Some of the lessons come from seeing real companies put business intelligence to work. One bank used business intelligence to overhaul its loan process and got more efficient results. Another firm used business intelligence to step up its risk assessments and ended up with financial outcomes. These stories prove how much business intelligence can transform a company. For any organization looking to run and grow, business intelligence is essential.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ef7b8a3e4622" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Next-Generation Data Engineering: The Autonomous Approach]]></title>
            <link>https://medium.com/@geopitswebmaster/next-generation-data-engineering-the-autonomous-approach-02182d9ddd49?source=rss-e2b434e06715------2</link>
            <guid isPermaLink="false">https://medium.com/p/02182d9ddd49</guid>
            <category><![CDATA[data]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[manuals]]></category>
            <category><![CDATA[autonomous]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Geopits Global Pvt Ltd]]></dc:creator>
            <pubDate>Tue, 10 Mar 2026 07:12:26 GMT</pubDate>
            <atom:updated>2026-03-10T07:14:48.231Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zQf0Sb13RAe6fUqLOl1V0w.png" /></figure><p><strong>People are talking about data engineering a lot. At first it sounds like another technology term that people use. If you look closer, the idea of autonomous data engineering is really pretty simple, and it makes a lot of sense. In companies, data engineers do the tasks over and over in data pipelines. They have to get data from places, clean it, change it, and get it ready for other teams to use. These steps are really important. They can be really boring and take up a lot of time. Data engineers spend a lot of time doing these tasks. That is where autonomous data engineering comes in. Autonomous data engineering tries to make this process easier for data engineers. With the help of intelligence and machine learning, many parts of the data pipeline can be done automatically. Instead of doing every step by hand, systems can do a lot of these tasks on their own, and data engineers can just watch over everything. For teams that work with data, autonomous data engineering can be really helpful. If they do not have to spend time doing work, they can focus on more important things like making the system better, making it work faster, or helping other teams use data more effectively. Another good thing about data engineering is that automated systems are more reliable. They do the tasks the same way every time, which helps reduce small mistakes that can happen when people do the work. Over time, this can make data pipelines more stable. Datasets are more trustworthy for making decisions. Autonomous data engineering is also good for companies that are getting bigger. As companies grow, they make data, and it gets harder to manage it all by hand. Autonomous systems make it easier to handle the work without having to rebuild everything. Really, autonomous data engineering is not about using words; it is about making data operations work better. By automating tasks that are repeated over and over and making systems reliable, organizations can spend time fixing things and coming up with new ideas. Autonomous data engineering is what makes this possible. That is why people are so interested in data engineering. Autonomous data engineering can really change how companies work with data. People are interested in data engineering because autonomous data engineering is really useful.</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=02182d9ddd49" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PostgreSQL Slow Delete Query]]></title>
            <link>https://medium.com/@geopitswebmaster/postgresql-slow-delete-query-59706b024c85?source=rss-e2b434e06715------2</link>
            <guid isPermaLink="false">https://medium.com/p/59706b024c85</guid>
            <category><![CDATA[backend-development]]></category>
            <category><![CDATA[query-optimization]]></category>
            <category><![CDATA[database-performance]]></category>
            <category><![CDATA[database-design]]></category>
            <dc:creator><![CDATA[Geopits Global Pvt Ltd]]></dc:creator>
            <pubDate>Tue, 03 Feb 2026 10:09:26 GMT</pubDate>
            <atom:updated>2026-03-20T11:52:17.260Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>PostgreSQL Slow Delete Query: Missing Indexes on Foreign Keys</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7SHNj6whKgaFte5RcJNBvQ.png" /></figure><p><strong>Introduction</strong></p><p>A critical delete operation is timing out for hours. Replication lag spiraling. CPU maxed at 95%. And the culprit? A missing index on a self-referencing foreign key. Here’s how a single overlooked detail nearly took down a production database — and how to prevent it.</p><p><strong>The Crisis</strong></p><p>One day, a delete query that should run in seconds was stuck after an hour. Each cancellation triggered a full rollback. The team had maybe 2–3 hours before things got critical.</p><p><strong>The symptoms were brutal:</strong></p><ul><li>Delete queries: timing out after 3600+ seconds</li><li>CPU: stuck at 85–95%</li><li>Replication lag: growing 100+ seconds per minute</li><li>Users: experiencing constant timeouts</li><li>Database: effectively offline</li></ul><p>The table had 20+ million rows. Every second counted.</p><p><strong>Root Cause</strong></p><p>Using EXPLAIN ANALYZE, the investigation revealed the problem immediately: <strong>full table scans</strong>.</p><p>The table had a self-referencing foreign key (hierarchical data: parent references same table). For every delete, PostgreSQL had to validate: “Does anything in this table reference the row I’m deleting?”</p><p>Without an index, PostgreSQL scanned all 20 million rows. Every single time.</p><pre>DELETE FROM table_name WHERE column_id = 123;<br>-- → Full table scan of 20M rows<br>-- → Table locked for hours<br>-- → CPU exhausted<br>-- → Everything else blocked</pre><p><strong>The Fix</strong></p><p>Create an index on the foreign key column:</p><pre>CREATE INDEX idx_table_fk_column  <br><br>ON table_name(column_id); </pre><p><strong>That’s it.</strong></p><p>With the index:</p><ul><li>Foreign key validation: O(log n) instead of O(n)</li><li>Query execution: 3 seconds instead of hours</li><li>CPU: 8% instead of 95%</li><li>Replication lag: resolved in 5 minutes</li></ul><p><strong>Why This Matters</strong></p><p>Self-referencing foreign keys without indexes are performance bombs. PostgreSQL can’t validate constraints efficiently, forcing full table scans on every delete operation.</p><p><strong>The math:</strong></p><ul><li>Without index: 20 million row scans × multiple deletes = hours of work</li><li>With index: logarithmic lookups × multiple deletes = seconds</li></ul><p>For large tables, this difference is the difference between working and broken.</p><p><strong>Before &amp; After</strong></p><p><strong>Before the index:</strong></p><ul><li>Delete time: 3600+ seconds</li><li>CPU: 95%</li><li>Replication lag: Growing</li><li>Status: Critical</li></ul><p><strong>After the index:</strong></p><ul><li>Delete time: 3 seconds</li><li>CPU: 8%</li><li>Replication lag: Resolved</li><li>Status: Healthy</li></ul><p><strong>Key Lesson</strong></p><p><strong>Always index foreign key columns. No exception.</strong></p><p>For self-referencing foreign keys, especially, they’re checking the same table they’re modifying. Without an index, you’re asking PostgreSQL to scan millions of rows on every operation.</p><p><strong>Quick Checklist</strong></p><ul><li>Audit tables with foreign keys for missing indexes</li><li>Check for self-referencing foreign keys (highest priority)</li><li>Review slow delete query execution plans</li><li>Create indexes on all foreign key columns</li><li>Test large deletes in staging first</li><li>Set monitoring alerts for long delete operations</li></ul><p><strong>Schema Design Best Practice</strong></p><pre>CREATE TABLE hierarchy (<br>    id BIGINT PRIMARY KEY,<br>    parent_id BIGINT REFERENCES hierarchy(id),<br>    data TEXT<br>);<br><br>-- Create index immediately (don&#39;t skip this!)<br>CREATE INDEX idx_hierarchy_parent_id <br>ON hierarchy(parent_id);</pre><p><strong>Conclusion</strong></p><p>A missing index seems insignificant until it prevents your entire database from working. This single oversight caused a production crisis affecting thousands of users. The fix took 30 seconds. The lesson: pay attention to foreign key indexes — they matter more than you think. Facing similar challenges? <a href="https://www.geopits.com/contact">Let’s connect.</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=59706b024c85" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PostgreSQL Partition Auto-Purge Issue]]></title>
            <link>https://medium.com/@geopitswebmaster/postgresql-partition-auto-purge-issue-6cbae565bf1a?source=rss-e2b434e06715------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cbae565bf1a</guid>
            <category><![CDATA[performance-optimization]]></category>
            <category><![CDATA[database-administration]]></category>
            <category><![CDATA[aws-rds]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Geopits Global Pvt Ltd]]></dc:creator>
            <pubDate>Tue, 03 Feb 2026 09:43:44 GMT</pubDate>
            <atom:updated>2026-07-10T09:29:50.338Z</atom:updated>
            <content:encoded><![CDATA[<h3><strong>PostgreSQL Partition Auto-Purge Issue: Diagnosis and Solutions for AWS RDS Environments</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D-FnSakeYDdi6ojkn76ubg.png" /></figure><p><strong>Introduction</strong></p><p>Managing table partitions in PostgreSQL is a crucial aspect of database maintenance, particularly when working with large datasets that continually grow. One of the most common challenges database administrators face is automating the cleanup of old partitions to maintain optimal database performance and storage efficiency.</p><p>You’re about to discover what happened when a client’s automatic partition purging system stopped working across multiple tables. I’ll show you the root causes we uncovered, how we investigated the problem, and the custom solution we built to fix it permanently.</p><p><strong>The Problem: Auto-Purge Not Triggering</strong></p><p>The client had configured their PostgreSQL database to purge old partitions using the popular <strong>pg_partman</strong> extension automatically. But they discovered that automatic purging wasn’t working for three critical partition tables. This meant old data was accumulating, consuming valuable storage space, and potentially impacting query performance.</p><p><strong>Initial Observations</strong></p><ul><li>Three partition tables configured for auto-purging</li><li>The automatic purge process was never triggered</li><li>Manual purging wasn’t an option for their operational workflow</li><li>Data retention policies were being violated</li><li>Storage costs were increasing unnecessarily</li></ul><p><strong>Investigation Phase: Understanding the Root Causes</strong></p><p>We investigated both the configuration and system limitations, and what we found was enlightening:</p><p><strong>The First Problem: Partition Type Incompatibility</strong></p><p>The first critical discovery was that <strong>two of the three partition tables used hash-based partitioning</strong>, but one used range-based partitioning.</p><p>This is a crucial limitation: <strong>pg_partman only supports range-based partitioning</strong>. Hash partitions are designed for even data distribution across partitions based on a hash function, while range partitions distribute data based on value ranges (dates, IDs, etc.).</p><p>Why does this matter? Auto-purging works by identifying and dropping old partitions based on age or value ranges — a concept that only makes sense with range-based partitioning. Hash-based partitions don’t have an inherent “age” or ordering, making them unsuitable for automatic purging strategies.</p><p><strong>The Second Problem: AWS RDS Environment Limitations</strong></p><p>The second significant obstacle was the deployment environment itself. The client’s PostgreSQL instance was hosted on <strong>AWS RDS (Relational Database Service)</strong>.</p><p>While AWS RDS is a powerful managed database service, it comes with specific restrictions on which PostgreSQL extensions you’re allowed to install, and which features you’re allowed to enable:</p><ul><li><strong>pg_cron extension</strong>: Not available in AWS RDS for managing scheduled jobs</li><li><strong>pg_agent (background worker)</strong>: Cannot be implemented due to RDS restrictions</li><li><strong>Custom background processes</strong>: Not supported in the RDS environment</li></ul><p>These restrictions meant that even if we had range-based partitions, we couldn’t implement the automated background processes that pg_partman relies on to trigger automatic purging operations.</p><p><strong>The Challenge: Multiple Constraints</strong></p><p>We faced a combination of obstacles that made traditional solutions impossible:</p><ol><li>Half of the partition tables couldn’t use pg_partman due to their hash-based design</li><li>AWS RDS couldn’t support the background agent infrastructure needed for automation</li><li>Manual purging was not a sustainable long-term solution</li><li>The client needed a reliable, automated approach</li></ol><p>Traditional solutions wouldn’t work. We needed a creative approach that worked within these constraints.</p><p><strong>The Solution: Custom Function-Based Purging with Crontab</strong></p><p>After detailed discussions with the client and receiving approval for a customized approach, we implemented a function-based purging strategy combined with external cron scheduling.</p><p><strong>How It Works</strong></p><p><strong>Step 1: Create PostgreSQL Functions for Purging</strong></p><p>We developed custom PL/pgSQL functions that encapsulate the partition purging logic for each table type:</p><pre>-- Example function for range-based partitions<br>CREATE OR REPLACE FUNCTION purge_range_partitions(<br>    table_name TEXT, <br>    retention_days INTEGER<br>)<br>RETURNS TABLE(dropped_partitions INT, freed_space TEXT) AS $$<br>DECLARE<br>    partition_record RECORD;<br>    dropped_count INT := 0;<br>BEGIN<br>    FOR partition_record IN<br>        SELECT schemaname, tablename FROM pg_tables<br>        WHERE schemaname = &#39;public&#39; <br>        AND tablename LIKE table_name || &#39;%&#39;<br>        AND tableowner = &#39;postgres&#39;<br>    LOOP<br>        -- Logic to identify and drop old partitions<br>        -- Based on age relative to retention_days<br>        IF should_drop_partition(partition_record.tablename, retention_days) THEN<br>            EXECUTE &#39;DROP TABLE IF EXISTS &#39; || partition_record.tablename;<br>            dropped_count := dropped_count + 1;<br>        END IF;<br>    END LOOP;<br>    <br>    RETURN QUERY SELECT dropped_count, pg_size_pretty(pg_total_relation_size(table_name));<br>END;<br>$$ LANGUAGE plpgsql;</pre><p><strong>Step 2: Create Functions for Hash-Based Partitions</strong></p><p>For hash-based partitions, we created separate logic that purges based on explicit date columns or metadata rather than partition structure:</p><pre>-- Example function for hash-based partitions<br>CREATE OR REPLACE FUNCTION purge_hash_partitions(<br>    table_name TEXT,<br>    created_date_column TEXT,<br>    retention_days INTEGER<br>)<br>RETURNS TABLE(rows_deleted BIGINT) AS $$<br>DECLARE<br>    deleted_rows BIGINT;<br>BEGIN<br>    EXECUTE format(&#39;DELETE FROM %I WHERE %I &lt; NOW() - INTERVAL &#39;&#39;%L days&#39;&#39;&#39;,<br>                   table_name, created_date_column, retention_days)<br>    INTO deleted_rows;<br>    <br>    RETURN QUERY SELECT deleted_rows;<br>END;<br>$$ LANGUAGE plpgsql;</pre><p><strong>Step 3: External Scheduling with Crontab</strong></p><p>Instead of relying on PostgreSQL’s background workers, we implemented scheduling at the operating system level using crontab.</p><p>On the EC2 instance hosting the RDS client application (or using AWS Lambda), we created a cron job:</p><pre># /etc/cron.d/postgres_partition_purge<br># Run partition purge at 2 AM UTC daily<br>0 2 * * * postgres /usr/local/bin/purge_partitions.sh<br><br># /usr/local/bin/purge_partitions.sh<br>#!/bin/bash<br><br>PGUSER=&quot;postgres&quot;<br>PGPASSWORD=&quot;your_secure_password&quot;<br>PGHOST=&quot;your-rds-instance.rds.amazonaws.com&quot;<br>PGDATABASE=&quot;your_database&quot;<br><br>export PGUSER PGPASSWORD PGHOST PGDATABASE<br><br>psql &lt;&lt; EOF<br>SELECT purge_range_partitions(&#39;events&#39;, 90);<br>SELECT purge_hash_partitions(&#39;user_activity&#39;, &#39;created_at&#39;, 60);<br>SELECT purge_hash_partitions(&#39;transactions&#39;, &#39;transaction_date&#39;, 180);<br>EOF<br><br># Log the execution<br>echo &quot;Partition purge completed at $(date)&quot; &gt;&gt; /var/log/postgres_purge.log</pre><p><strong>Implementation Benefits</strong></p><p>Our approach solved multiple problems at once:</p><p><strong>1. Works with All Partition Types</strong></p><ul><li>Supports both range and hash-based partitions</li><li>Adapts to different data retention requirements</li></ul><p><strong>2. No RDS Restrictions</strong></p><ul><li>Doesn’t require pg_cron or pg_agent</li><li>Uses only standard PostgreSQL functions</li><li>Leverages external scheduling that respects RDS limitations</li></ul><p><strong>3. Highly Customizable</strong></p><ul><li>Each partition type can have different retention policies</li><li>Easy to adjust retention periods</li><li>Detailed logging of purged partitions</li></ul><p><strong>4. Cost-Effective</strong></p><ul><li>Reduces storage costs by removing old data</li><li>Improves query performance by reducing table sizes</li><li>Minimal computational overhead</li></ul><p><strong>5. Operational Visibility</strong></p><ul><li>Detailed logging integrates with monitoring systems to catch failures immediately</li><li>Monitoring and alerting catches failures immediately</li></ul><p><strong>Results and Outcomes</strong></p><p>The results spoke to them. Within the first month of deployment:</p><p><strong>Successful Resolution</strong></p><ul><li>All three partition tables now have automated purging working correctly</li><li>Old partitions are reliably removed according to retention policies</li><li>No manual intervention required</li></ul><p><strong>Performance Improvements</strong></p><ul><li>Reduced table sizes improved query performance by 15–30%</li><li>Storage consumption stabilized</li><li>Database I/O operations decreased</li></ul><p><strong>Operational Excellence</strong></p><ul><li>Predictable maintenance window (2 AM UTC)</li><li>Comprehensive logging for compliance audits</li><li>Easy to modify retention policies without code changes</li></ul><p><strong>Key Insights for Database Administrators</strong></p><p><strong>1. Understand Your Partition Strategy</strong></p><p>Before implementing auto-purging, ensure you understand which partitioning method you’re using. Range-based partitioning is ideal for time-based or sequential data purging, while hash-based partitioning requires alternative approaches.</p><p><strong>2. Know Your Platform Limitations</strong></p><p>AWS RDS is excellent for managed databases, but it has restrictions on background workers and certain extensions. Always verify what’s supported before designing your automation strategy.</p><p><strong>3. Solutions Aren’t Always Off-the-Shelf</strong></p><p>While pg_partman is an excellent tool, it’s not a universal solution. Sometimes you need to combine multiple approaches — in this case, custom functions + external scheduling — to achieve your goals.</p><p><strong>4. Test Thoroughly in Non-Production</strong></p><p>Always test automated purging logic on non-production databases first. Data loss mistakes are permanent. Our implementation included comprehensive tests before deployment.</p><p><strong>5. Implement Monitoring and Logging</strong></p><p>Automated processes should never run silently. Implement detailed logging, monitoring, and alerting to catch issues immediately.</p><p><strong>Conclusion</strong></p><p>This experience shows that effective database maintenance isn’t always about using the latest tools — it’s about understanding your constraints, your data, and your requirements. By combining PostgreSQL’s custom functions with external scheduling, we created a solution that works perfectly within AWS RDS limitations.</p><p>If you’re facing similar partition management challenges, especially in cloud environments with managed database services, this hybrid approach is worth implementing. It’s flexible, cost-effective, and you’ll deploy it relatively quickly. <a href="https://www.geopits.com/postgresql-dba-managed-services"><strong>Talk to </strong></a>us to audit your Amazon RDS PostgreSQL partitions and auto‑purge strategy so you can avoid surprise storage costs and performance regressions.”</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cbae565bf1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>