<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Luis Núñez</title>
    <description>The latest articles on DEV Community by Luis Núñez (@luisenr).</description>
    <link>https://dev.to/luisenr</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4046241%2F62ea3e98-d95a-42be-b649-4b8dce3fe977.png</url>
      <title>DEV Community: Luis Núñez</title>
      <link>https://dev.to/luisenr</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/luisenr"/>
    <language>en</language>
    <item>
      <title>A Practical Guide to Azure PostgreSQL: Migration, Replicas, and Tuning ☁️🐘</title>
      <dc:creator>Luis Núñez</dc:creator>
      <pubDate>Sat, 25 Jul 2026 02:12:00 +0000</pubDate>
      <link>https://dev.to/luisenr/hands-on-azure-configuring-migrating-and-optimizing-postgresql-flexible-server-3fpl</link>
      <guid>https://dev.to/luisenr/hands-on-azure-configuring-migrating-and-optimizing-postgresql-flexible-server-3fpl</guid>
      <description>&lt;p&gt;In this post, I summarize my hands-on experience completing the &lt;strong&gt;Microsoft Applied Skills: Configure and migrate to Azure Database for PostgreSQL&lt;/strong&gt; assessment. &lt;/p&gt;

&lt;p&gt;Using &lt;strong&gt;Azure Portal&lt;/strong&gt;, &lt;strong&gt;pgAdmin&lt;/strong&gt;, and &lt;strong&gt;PostgreSQL&lt;/strong&gt;, I walked through the core architectural tasks of setting up, securing, migrating, replicating, and optimizing a managed relational database in the cloud.&lt;/p&gt;




&lt;h2&gt;
  
  
  🛠️ Step-by-Step Lab Execution
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Security &amp;amp; Monitoring Setup
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Authentication:&lt;/strong&gt; Configured dual authentication on Azure Database for PostgreSQL Flexible Server (&lt;code&gt;psql63693133&lt;/code&gt;), enabling Microsoft Entra ID alongside native PostgreSQL authentication.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Network Isolation:&lt;/strong&gt; Isolated server traffic within &lt;code&gt;VNET1/subnet1&lt;/code&gt; by creating a &lt;strong&gt;Private Endpoint&lt;/strong&gt; (&lt;code&gt;psql63693133-pe&lt;/code&gt;).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Diagnostics:&lt;/strong&gt; Configured &lt;strong&gt;Diagnostic Settings&lt;/strong&gt; (&lt;code&gt;logs-to-loganalytics&lt;/code&gt;) to route &lt;code&gt;PostgreSQL Sessions data&lt;/code&gt; logs to an Azure &lt;strong&gt;Log Analytics Workspace&lt;/strong&gt; (&lt;code&gt;loganalytics1&lt;/code&gt;).&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  2. Migration &amp;amp; Handling the B-Tree Index Error
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Data Restore:&lt;/strong&gt; Restored the &lt;code&gt;adventureworks&lt;/code&gt; sample database to Azure using pgAdmin's restore tool.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Real-World Error:&lt;/strong&gt; During &lt;code&gt;pg_restore&lt;/code&gt;, a known error occurred due to the PostgreSQL B-tree index row size limit:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;ERROR: index row size 2896 exceeds btree version 4 maximum 2704 for index "IX_ProductReview_ProductID_Name"
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Resolution &amp;amp; Impact:&lt;/strong&gt; This error was non-fatal. Because PostgreSQL restores table rows before creating secondary indexes, all schema structures and data were successfully imported. Only the secondary index on &lt;code&gt;productreview.comments&lt;/code&gt; failed due to text size limits.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  3. Cross-Region Read Replication
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;High Availability:&lt;/strong&gt; Created a Read Replica (&lt;code&gt;psql63693133-replica&lt;/code&gt;) to offload read-heavy workloads and increase resiliency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Paired Region:&lt;/strong&gt; Deployed the replica in &lt;strong&gt;Canada Central&lt;/strong&gt; (the paired region for the primary server located in &lt;strong&gt;Canada East&lt;/strong&gt;).&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  4. Query Performance Optimization
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;EXPLAIN Plan:&lt;/strong&gt; Analyzed the &lt;code&gt;public.address1()&lt;/code&gt; function in pgAdmin, extracted its underlying SQL query, generated the &lt;strong&gt;EXPLAIN&lt;/strong&gt; execution plan, and exported the visual output.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Index Creation:&lt;/strong&gt; Identified a sequential scan bottleneck on &lt;code&gt;person.address&lt;/code&gt; and resolved it by creating a targeted index:
&lt;/li&gt;
&lt;/ul&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;INDEX&lt;/span&gt; &lt;span class="n"&gt;IX_Address_StateProvinceID&lt;/span&gt; 
&lt;span class="k"&gt;ON&lt;/span&gt; &lt;span class="n"&gt;person&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;address&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;stateprovinceid&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  💡 Key Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Private Endpoints First:&lt;/strong&gt; Always restrict database traffic to private virtual networks before migrating production data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Understand Migration Logs:&lt;/strong&gt; Non-critical index failures (like B-tree row limits on text columns) do not invalidate full data restores.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Analyze Before Scaling:&lt;/strong&gt; Using &lt;code&gt;EXPLAIN&lt;/code&gt; to spot missing indexes solves query bottlenecks without needing to increase expensive server compute tiers.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  🚀 Try It Yourself
&lt;/h2&gt;

&lt;p&gt;Put your hands-on cloud skills to the test with the official assessment module on Microsoft Learn:&lt;/p&gt;

&lt;p&gt;👉 &lt;a href="https://learn.microsoft.com/credentials/applied-skills/configure-and-migrate-to-azure-database-for-postgresql/?wt.mc_id=studentamb_578610" rel="noopener noreferrer"&gt;Microsoft Applied Skills: Configure and migrate to Azure Database for PostgreSQL&lt;/a&gt;&lt;/p&gt;

</description>
      <category>azure</category>
      <category>postgres</category>
      <category>database</category>
      <category>cloud</category>
    </item>
  </channel>
</rss>
