{"id":20665,"date":"2023-07-18T14:03:05","date_gmt":"2023-07-18T12:03:05","guid":{"rendered":"https:\/\/chartmogul.com\/blog\/?p=20665"},"modified":"2023-08-10T16:38:39","modified_gmt":"2023-08-10T14:38:39","slug":"how-migrating-our-database-eliminated-data-processing-incidents","status":"publish","type":"post","link":"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/","title":{"rendered":"How Migrating Our Database Eliminated Data Processing Incidents"},"content":{"rendered":"\n<h2 class=\"wp-block-heading\">TL;DR<\/h2>\n\n\n\n<p>We sharded one of the core ChartMogul databases and changed its tables\u2019 partitioning scheme from LIST to HASH. This way we managed to:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Remove a single point of failure (SPOF) from our architecture&nbsp;<\/li>\n\n\n\n<li>At least triple query performance<\/li>\n\n\n\n<li>Reduce AWS RDS costs by 10%, and&nbsp;<\/li>\n\n\n\n<li>Eliminate all incidents deriving from that part of the system<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Context<\/h2>\n\n\n\n<p>ChartMogul receives millions of webhooks from various billing systems daily, normalizes and stores them in aggregated tables, and&nbsp; then presents subscription analytics as metrics and charts. This is a full scale extract-transform-load (ETL) process, with various modules performing different data transformations and storing data into their corresponding databases, as presented in the figure below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/previous-architecture.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"435\" src=\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/previous-architecture-1024x435.png\" alt=\"previous architecture \" class=\"wp-image-20672\" srcset=\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/previous-architecture-1024x435.png 1024w, https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/previous-architecture-300x127.png 300w, https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/previous-architecture-1536x653.png 1536w, https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/previous-architecture-2048x870.png 2048w, https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/previous-architecture-540x230.png 540w, https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/previous-architecture-720x306.png 720w, https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/previous-architecture-1920x816.png 1920w, https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/previous-architecture-300x127@2x.png 600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>We <a href=\"https:\/\/chartmogul.com\/blog\/moving-chartmogul-to-aws-and-kubernetes\/\" target=\"_blank\" rel=\"noreferrer noopener\">migrated to AWS<\/a> over a year ago, and most modules of ChartMogul\u2019s application are part of a Ruby on Rails monolith using Sidekiq for background job processing and AWS RDS (Postgres) for the aforementioned databases. A few years ago, ChartMogul was in hyper growth, which increased the volume of processed and stored data. To handle the increasing load, ChartMogul engineers decided to horizontally scale the platform database by adding more shards.&nbsp;<\/p>\n\n\n\n<p>However, the ingestion database continued to operate under a single Postgres instance (and a read replica) as it was already partitioned using <a href=\"https:\/\/www.postgresql.org\/docs\/current\/ddl-partitioning.html\" target=\"_blank\" rel=\"noreferrer noopener\">Postgres\u2019 LIST partitioning scheme<\/a>. Ingestion database tables were partitioned based on the account_id column (a unique internal identifier of each ChartMogul account) and each account received a partition per table in that database. As ChartMogul continued to grow with an increasing number of accounts and more complex integrations and features, LIST partitioning became unsustainable. Despite temporary mitigations to group most accounts under default partitions or scale up the instance (and increase the associated costs), we encountered incidents caused by:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Extreme read IOPS due to heavy queries processing hundreds of thousands or millions of records,<\/li>\n\n\n\n<li>Out of memory issues due to large and inefficient indexes<\/li>\n\n\n\n<li>Stale Postgres statistics requiring regular vacuum operations<\/li>\n\n\n\n<li>Administrative tasks related to partitions: attaching or detaching some partitions caused ACCESS EXCLUSIVE locks on the parent table<\/li>\n<\/ul>\n\n\n\n<p>Despite continued efforts to optimize these queries and tasks, fine-tune the AWS RDS parameters, and optimize the normalization processing code, that specific instance was still a SPOF for our application and the most expensive AWS RDS instance. So in late 2022, we decided to migrate its tables under the sharded platform database and leverage from that scaled architecture to:&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Remove the SPOF and reduce costs<\/li>\n\n\n\n<li>Have smaller tables and indexes<\/li>\n\n\n\n<li>Optimize performance, and<\/li>\n\n\n\n<li>Reduce incidents<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Decisions<\/h2>\n\n\n\n<p>The first decision we made was easy: replace LIST with HASH partitioning [4] for the migrated tables. The main advantage is we mix big and small accounts randomly and we don&#8217;t have to do manual interventions. The only point of debate was the number of partitions, taking into account our current distribution, future load, and the need to change their number again (which we wanted to avoid). After some thorough simulation we opted for 30 partitions for our largest table, which would result in tables of ~2.5GB (95% percentile).&nbsp;<\/p>\n\n\n\n<p>As for the migration tool, a few options were on the table. Internal tools had been developed to migrate tables and data between databases but these were operated on account level and were only used for offline migrations. However, our goal was to migrate the whole database with zero downtime, so we quickly discarded this option.&nbsp;<\/p>\n\n\n\n<p><a href=\"https:\/\/aws.amazon.com\/dms\/\" target=\"_blank\" rel=\"noreferrer noopener\">AWS Database Migration Service<\/a> (DMS) was the next option; it\u2019s the standard tool for live database migrations in AWS as it supports batch and incremental loading. We expected it would be very efficient for a Postgres to Postgres migration on identical tables, and we wouldn\u2019t have to deal with inconsistent data types or other usual conflicts that come up in a cross-database migration. Our only additional requirement would be migrating from a single database into five different ones, hence the need to apply relevant rules to filter data either based on the partitioned table list or the account_id column. After verifying that <a href=\"https:\/\/docs.aws.amazon.com\/dms\/latest\/userguide\/CHAP_Tasks.CustomizingTasks.TableMapping.SelectionTransformation.Selections.html\" target=\"_blank\" rel=\"noreferrer noopener\">AWS DMS supports both types of rules<\/a>, we did some quick experimentation in our beta environment and with production clones before agreeing to move forward with this approach.<\/p>\n\n\n\n<p>We have five platform shards, so we decided to migrate accounts to their corresponding shard, ideally one shard per day. This method would allow us to thoroughly check for issues on the first migrated shard, and fine-tune DMS settings before migrating the remaining shards.&nbsp; This way, we could avoid the overhead and potential performance issues from starting five replication slots in a running database to support five concurrent migration tasks.&nbsp;&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Migration<\/h2>\n\n\n\n<p>We planned for the migration to take a week. The first task was to migrate the ingestion-related code to work in a sharded-database context under a feature flag. This would ensure that the batch of migrated accounts only utilized the platform database when they had their feature flag set. We created the new tables and partitions for each platform shard excluding the indexes, as these would slow down batch loading according to AWS DMS recommendations. Code was also updated to redirect new accounts\u2019 ingestion data directly into the platform database, which meant we would only have to migrate data for existing accounts.<\/p>\n\n\n\n<p>Next, we prepared a script which would generate the AWS DMS rules for all accounts to be migrated in one shard. The script would prepare table rules based on table partition (if the account had a separate one) or column rules on the default partition. The initial run for a single shard produced a JSON file with size &gt;2MB, which would reach AWS API limits and was not recommended by <a href=\"https:\/\/docs.aws.amazon.com\/dms\/latest\/userguide\/CHAP_Troubleshooting.html#CHAP_Troubleshooting.General.TableLimit\" target=\"_blank\" rel=\"noreferrer noopener\">AWS DMS documentation<\/a>. We had to fine-tune it to only consider accounts with data in any of the tables being migrated.&nbsp;<\/p>\n\n\n\n<p>Each shard followed this checklist:&nbsp;<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Generate and apply the AWS DMS rules for all accounts to be migrated.<\/li>\n\n\n\n<li>Start the batch loading task and wait for it to be completed.<\/li>\n\n\n\n<li>Create indexes and statistics.<\/li>\n\n\n\n<li>Resume the AWS DMS replication task and wait for replication lag to catch up.<\/li>\n\n\n\n<li>Audit the tables by checking counts, samples and do performance checks on the fly. This was a blocking point: if something was consistently wrong even after retries we aborted the migration for that shard.<\/li>\n\n\n\n<li>Stop Sidekiq for the migrated shard, switch feature flags, and resume Sidekiq. This ensured no new data was processed while switching flags, the delay on data processing was only a few minutes, and migrated accounts had no downtime.<\/li>\n\n\n\n<li>Wait a couple minutes and then stop the DMS task.<\/li>\n<\/ol>\n\n\n\n<p>We timed the migration on a production clone and the end-to-end flow would require two hours with pessimistic batch load task settings (4 tables in parallel, 50k rows batch size) not to overload the live platform database shard.<\/p>\n\n\n\n<p>We ran the first migration on the shard where the ChartMogul account is persisted. Batch loading completed successfully within two hours, except for one small table which failed with no meaningful error logs. Luckily, the table was easy to migrate by exporting and importing with <a href=\"https:\/\/www.postgresql.org\/docs\/current\/app-pgdump.html\" target=\"_blank\" rel=\"noreferrer noopener\">pg_dump<\/a> while Sidekiq was down. We later found out that some code was updating both the shard and the original database, which led to failed synchronization. Fortunately, this was just a timestamp and had no impact on data. Another issue was our chosen AWS DMS settings for batch loading caused high CPU usage on the platform shard, impacting front-end response time. We lowered them even further to 3 tables and 30k rows batch size and increased the batch loading time to 3\u20134 hours to ensure the front end would not be impacted.<\/p>\n\n\n\n<p>Despite these hiccups, audits were green, query performance was great, and our checks to selected test accounts passed, so we were 100% confident this would work smoothly in all shards. <strong>As planned, we successfully migrated all five shards within a week. <\/strong>Afterwards, the team removed all references of the ingestion database from the codebase, and removed the unnecessary feature flag. 5,000 lines of code (LOC) were deleted.&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Results<\/h2>\n\n\n\n<p>Our updated architecture is presented in the following figure:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><a href=\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/new-architecture.png\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"479\" src=\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/new-architecture-1024x479.png\" alt=\"new architecture \" class=\"wp-image-20673\" srcset=\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/new-architecture-1024x479.png 1024w, https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/new-architecture-300x140.png 300w, https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/new-architecture-1536x719.png 1536w, https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/new-architecture-2048x958.png 2048w, https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/new-architecture-720x337.png 720w, https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/new-architecture-1920x898.png 1920w, https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/new-architecture-300x140@2x.png 600w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n\n\n\n<p>After the successful migration we measured <strong>5\u00d7 improvement in simple select queries<\/strong> and <strong>3\u00d7 improvement in select queries with joins<\/strong>, while most of the table partitions were below 3GB each. Before, ingestion-related queries were among the top five heavy queries in our AWS RDS Performance Insights, now, they don\u2019t even appear on the list. The ingestion and its replica instances were made obsolete, resulting in <strong>reduced<\/strong> <strong>AWS RDS costs by 10%<\/strong> by removing the most expensive instance (and its replica) from our system. Most importantly, <strong>incidents related to data normalization have been eliminated since April 2023<\/strong>.&nbsp;<\/p>\n\n\n\n<p>Over the years, our team has transitioned from committing to solutions with a \u2018quick fix\u2019 to taking a more deliberate approach by engaging in RFC discussions, and performing PoCs. Our recent migration was a testament to this transformation, demonstrating the success of the ChartMogul engineering team.<\/p>\n\n\n\n<p>In upcoming posts, we\u2019ll explore various engineering and data architecture topics: ongoing migrations, and our strategic approach to scaling our crucial database, the analytics DB (which currently serves as our last SPOF).&nbsp;<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">Other links<\/h2>\n\n\n\n<p>ChartMogul Import API: <a href=\"https:\/\/dev.chartmogul.com\/reference\/introduction-import-api\">https:\/\/dev.chartmogul.com\/reference\/introduction-import-api<\/a><br>ChartMogul data model: <a href=\"https:\/\/dev.chartmogul.com\/docs\/system-overview\">https:\/\/dev.chartmogul.com\/docs\/system-overview<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>TL;DR We sharded one of the core ChartMogul databases and changed its tables\u2019 partitioning scheme from LIST to HASH. This way we managed to:&nbsp; Context ChartMogul receives millions of webhooks from various billing systems daily, normalizes and stores them in aggregated tables, and&nbsp; then presents subscription analytics as metrics and charts. This is a full &hellip;<\/p>\n","protected":false},"author":91,"featured_media":20668,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[13],"tags":[282],"class_list":["post-20665","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-how-we-build","tag-engineering"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.8 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Migrating Our Database | ChartMogul<\/title>\n<meta name=\"description\" content=\"We sharded one of the core ChartMogul databases and changed its tables\u2019 partitioning scheme from LIST to HASH.\" \/>\n<meta name=\"robots\" content=\"index, follow\" \/>\n<link rel=\"canonical\" href=\"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Migrating Our Database | ChartMogul\" \/>\n<meta property=\"og:description\" content=\"We sharded one of the core ChartMogul databases and changed its tables\u2019 partitioning scheme from LIST to HASH.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/\" \/>\n<meta property=\"og:site_name\" content=\"ChartMogul\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/chartmogul\" \/>\n<meta property=\"article:published_time\" content=\"2023-07-18T12:03:05+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-08-10T14:38:39+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/blog_LIST_to_HASH_Database-1-1024x427.png\" \/>\n\t<meta property=\"og:image:width\" content=\"1024\" \/>\n\t<meta property=\"og:image:height\" content=\"427\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"George Petropoulos\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@chartmogul\" \/>\n<meta name=\"twitter:site\" content=\"@chartmogul\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"George Petropoulos\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/\"},\"author\":{\"name\":\"George Petropoulos\",\"@id\":\"https:\/\/chartmogul.com\/blog\/#\/schema\/person\/46ce2f3d9e5d1a1d703c889ef43220f6\"},\"headline\":\"How Migrating Our Database Eliminated Data Processing Incidents\",\"datePublished\":\"2023-07-18T12:03:05+00:00\",\"dateModified\":\"2023-08-10T14:38:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/\"},\"wordCount\":1547,\"publisher\":{\"@id\":\"https:\/\/chartmogul.com\/blog\/#organization\"},\"image\":{\"@id\":\"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/blog_LIST_to_HASH_Database-1.png\",\"keywords\":[\"engineering\"],\"articleSection\":[\"How we Build\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/\",\"url\":\"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/\",\"name\":\"Migrating Our Database | ChartMogul\",\"isPartOf\":{\"@id\":\"https:\/\/chartmogul.com\/blog\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/blog_LIST_to_HASH_Database-1.png\",\"datePublished\":\"2023-07-18T12:03:05+00:00\",\"dateModified\":\"2023-08-10T14:38:39+00:00\",\"description\":\"We sharded one of the core ChartMogul databases and changed its tables\u2019 partitioning scheme from LIST to HASH.\",\"breadcrumb\":{\"@id\":\"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/#primaryimage\",\"url\":\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/blog_LIST_to_HASH_Database-1.png\",\"contentUrl\":\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/blog_LIST_to_HASH_Database-1.png\",\"width\":3000,\"height\":1250,\"caption\":\"(blog)_LIST_to_HASH_Database (1)\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/chartmogul.com\/blog\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How Migrating Our Database Eliminated Data Processing Incidents\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/chartmogul.com\/blog\/#website\",\"url\":\"https:\/\/chartmogul.com\/blog\/\",\"name\":\"ChartMogul\",\"description\":\"Get all your SaaS &amp; Subscription Metrics with a Single Click! MRR, churn, LTV and much more.\",\"publisher\":{\"@id\":\"https:\/\/chartmogul.com\/blog\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/chartmogul.com\/blog\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/chartmogul.com\/blog\/#organization\",\"name\":\"ChartMogul\",\"url\":\"https:\/\/chartmogul.com\/blog\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/chartmogul.com\/blog\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2019\/05\/ChartMogul-Logo.png\",\"contentUrl\":\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2019\/05\/ChartMogul-Logo.png\",\"width\":278,\"height\":52,\"caption\":\"ChartMogul\"},\"image\":{\"@id\":\"https:\/\/chartmogul.com\/blog\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/chartmogul\",\"https:\/\/x.com\/chartmogul\",\"https:\/\/www.linkedin.com\/company\/chartmogul\/\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/chartmogul.com\/blog\/#\/schema\/person\/46ce2f3d9e5d1a1d703c889ef43220f6\",\"name\":\"George Petropoulos\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/chartmogul.com\/blog\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/george-petropoulos.png\",\"contentUrl\":\"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/george-petropoulos.png\",\"caption\":\"George Petropoulos\"},\"description\":\"Engineering Manager\",\"url\":\"https:\/\/chartmogul.com\/blog\/author\/georgechartmogul-com\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Migrating Our Database | ChartMogul","description":"We sharded one of the core ChartMogul databases and changed its tables\u2019 partitioning scheme from LIST to HASH.","robots":{"index":"index","follow":"follow"},"canonical":"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/","og_locale":"en_US","og_type":"article","og_title":"Migrating Our Database | ChartMogul","og_description":"We sharded one of the core ChartMogul databases and changed its tables\u2019 partitioning scheme from LIST to HASH.","og_url":"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/","og_site_name":"ChartMogul","article_publisher":"https:\/\/www.facebook.com\/chartmogul","article_published_time":"2023-07-18T12:03:05+00:00","article_modified_time":"2023-08-10T14:38:39+00:00","og_image":[{"width":1024,"height":427,"url":"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/blog_LIST_to_HASH_Database-1-1024x427.png","type":"image\/png"}],"author":"George Petropoulos","twitter_card":"summary_large_image","twitter_creator":"@chartmogul","twitter_site":"@chartmogul","twitter_misc":{"Written by":"George Petropoulos","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/#article","isPartOf":{"@id":"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/"},"author":{"name":"George Petropoulos","@id":"https:\/\/chartmogul.com\/blog\/#\/schema\/person\/46ce2f3d9e5d1a1d703c889ef43220f6"},"headline":"How Migrating Our Database Eliminated Data Processing Incidents","datePublished":"2023-07-18T12:03:05+00:00","dateModified":"2023-08-10T14:38:39+00:00","mainEntityOfPage":{"@id":"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/"},"wordCount":1547,"publisher":{"@id":"https:\/\/chartmogul.com\/blog\/#organization"},"image":{"@id":"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/#primaryimage"},"thumbnailUrl":"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/blog_LIST_to_HASH_Database-1.png","keywords":["engineering"],"articleSection":["How we Build"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/","url":"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/","name":"Migrating Our Database | ChartMogul","isPartOf":{"@id":"https:\/\/chartmogul.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/#primaryimage"},"image":{"@id":"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/#primaryimage"},"thumbnailUrl":"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/blog_LIST_to_HASH_Database-1.png","datePublished":"2023-07-18T12:03:05+00:00","dateModified":"2023-08-10T14:38:39+00:00","description":"We sharded one of the core ChartMogul databases and changed its tables\u2019 partitioning scheme from LIST to HASH.","breadcrumb":{"@id":"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/#primaryimage","url":"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/blog_LIST_to_HASH_Database-1.png","contentUrl":"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/blog_LIST_to_HASH_Database-1.png","width":3000,"height":1250,"caption":"(blog)_LIST_to_HASH_Database (1)"},{"@type":"BreadcrumbList","@id":"https:\/\/chartmogul.com\/blog\/how-migrating-our-database-eliminated-data-processing-incidents\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/chartmogul.com\/blog\/"},{"@type":"ListItem","position":2,"name":"How Migrating Our Database Eliminated Data Processing Incidents"}]},{"@type":"WebSite","@id":"https:\/\/chartmogul.com\/blog\/#website","url":"https:\/\/chartmogul.com\/blog\/","name":"ChartMogul","description":"Get all your SaaS &amp; Subscription Metrics with a Single Click! MRR, churn, LTV and much more.","publisher":{"@id":"https:\/\/chartmogul.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/chartmogul.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/chartmogul.com\/blog\/#organization","name":"ChartMogul","url":"https:\/\/chartmogul.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/chartmogul.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2019\/05\/ChartMogul-Logo.png","contentUrl":"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2019\/05\/ChartMogul-Logo.png","width":278,"height":52,"caption":"ChartMogul"},"image":{"@id":"https:\/\/chartmogul.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/chartmogul","https:\/\/x.com\/chartmogul","https:\/\/www.linkedin.com\/company\/chartmogul\/"]},{"@type":"Person","@id":"https:\/\/chartmogul.com\/blog\/#\/schema\/person\/46ce2f3d9e5d1a1d703c889ef43220f6","name":"George Petropoulos","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/chartmogul.com\/blog\/#\/schema\/person\/image\/","url":"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/george-petropoulos.png","contentUrl":"https:\/\/chartmogul.com\/blog\/wp-content\/uploads\/2023\/07\/george-petropoulos.png","caption":"George Petropoulos"},"description":"Engineering Manager","url":"https:\/\/chartmogul.com\/blog\/author\/georgechartmogul-com\/"}]}},"_links":{"self":[{"href":"https:\/\/chartmogul.com\/blog\/wp-json\/wp\/v2\/posts\/20665","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chartmogul.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chartmogul.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chartmogul.com\/blog\/wp-json\/wp\/v2\/users\/91"}],"replies":[{"embeddable":true,"href":"https:\/\/chartmogul.com\/blog\/wp-json\/wp\/v2\/comments?post=20665"}],"version-history":[{"count":6,"href":"https:\/\/chartmogul.com\/blog\/wp-json\/wp\/v2\/posts\/20665\/revisions"}],"predecessor-version":[{"id":20677,"href":"https:\/\/chartmogul.com\/blog\/wp-json\/wp\/v2\/posts\/20665\/revisions\/20677"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chartmogul.com\/blog\/wp-json\/wp\/v2\/media\/20668"}],"wp:attachment":[{"href":"https:\/\/chartmogul.com\/blog\/wp-json\/wp\/v2\/media?parent=20665"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chartmogul.com\/blog\/wp-json\/wp\/v2\/categories?post=20665"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chartmogul.com\/blog\/wp-json\/wp\/v2\/tags?post=20665"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}