<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>Mariadb on Özkan Pakdil Software Engineer</title>
    <link>https://ozkanpakdil.github.io/tags/mariadb/</link>
    <description>Recent content in Mariadb on Özkan Pakdil Software Engineer</description>
    <image>
      <title>Özkan Pakdil Software Engineer</title>
      <url>https://ozkanpakdil.github.io/images/papermod-cover.png</url>
      <link>https://ozkanpakdil.github.io/images/papermod-cover.png</link>
    </image>
    <generator>Hugo -- 0.148.2</generator>
    <language>en</language>
    <copyright>Özkan Pakdil</copyright>
    <lastBuildDate>Wed, 23 Sep 2026 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://ozkanpakdil.github.io/tags/mariadb/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>MariaDB vs MySQL vs PostgreSQL: an mpazari Benchmark</title>
      <link>https://ozkanpakdil.github.io/posts/my_collections/2026/2026-09-23-mysql-vs-mariadb/</link>
      <pubDate>Wed, 23 Sep 2026 00:00:00 +0000</pubDate>
      <guid>https://ozkanpakdil.github.io/posts/my_collections/2026/2026-09-23-mysql-vs-mariadb/</guid>
      <description>A controlled MariaDB 10.3, MySQL 8.0, and PostgreSQL 12 comparison using the real mpazari.com application and production-sized data.</description>
      <content:encoded><![CDATA[<p>I recently compared MariaDB, MySQL, and PostgreSQL using the real
<a href="https://www.mpazari.com">mpazari.com</a> application. The goal was not to produce a synthetic
database benchmark. I wanted to answer a more practical question: <strong>does MariaDB really have an
advantage when an application sends many simple queries?</strong></p>
<p>This question came up after reading an argument that PostgreSQL is obviously faster than MySQL,
but that MariaDB should be faster for applications with many simple queries, while PostgreSQL is
probably better for complex joins. The suggestion was that a MariaDB versus PostgreSQL comparison
would be more interesting than a PostgreSQL versus MySQL comparison.</p>
<p>I had already migrated mpazari.com from MySQL 8 to PostgreSQL 12. That migration made the server
feel much lighter, but it did not answer the MariaDB part of the question. So I restored the same
data into MariaDB and MySQL and compared those results with the earlier PostgreSQL run.</p>
<h2 id="the-application">The application</h2>
<p>mpazari.com is a Turkish motorcycle classifieds site. The application is a Spring Boot 4 / Java
25 GraalVM native image with hand-written SQL. The home page is not a single complicated query;
it performs several small reads for listings, taxonomy data, counts, and footer information.</p>
<p>The database is modest by production standards, but it is real application data rather than a
generated benchmark dataset:</p>
<ul>
<li>31 tables</li>
<li>20,750 rows in <code>motor_ilanlar</code></li>
<li>approximately 111 MB of data used by the tested workload</li>
<li>roughly five simple database queries per home-page request</li>
</ul>
<p>That makes this a useful test for this particular workload, not a universal ranking of database
engines.</p>
<h2 id="test-setup">Test setup</h2>
<p>I used the same Hetzner server for both runs: 8 cores, 32 GB of RAM, and Ubuntu 20.04. The system
was otherwise idle, with the load average below 1 before the tests.</p>
<p>The important comparison details were:</p>
<ul>
<li>The same pre-cutover dump was restored into MariaDB and MySQL: 31 tables and 20,750
<code>motor_ilanlar</code> rows.</li>
<li>The same application build and runtime settings were used for the MariaDB and MySQL runs.</li>
<li>The application was freshly restarted before each main run.</li>
<li>MariaDB and MySQL listened only on <code>127.0.0.1</code>.</li>
<li>MySQL ran in Docker with <code>--network host</code>, so there was no NAT or proxy hop.</li>
<li>MariaDB used port 3306 and MySQL used port 3307.</li>
<li>k6 ramped to 50 virtual users for one minute, held that load for five minutes, and ramped down
for one minute. Each iteration loaded the home page and slept for one second.</li>
</ul>
<p>The PostgreSQL numbers come from an earlier same-box benchmark against the live stack. That stack
speaks PostgreSQL-dialect SQL, and its PostgreSQL instance hosts several sites&rsquo; databases, so the
PostgreSQL result is useful context rather than a perfectly engine-pure comparison.</p>
<p>The k6 thresholds were <code>p(95) &lt; 200 ms</code> and <code>p(99) &lt; 500 ms</code>.</p>
<h2 id="main-benchmark">Main benchmark</h2>
<table>
  <thead>
      <tr>
          <th>Metric</th>
          <th style="text-align: right">MariaDB 10.3.39</th>
          <th style="text-align: right">MySQL 8.0.42</th>
          <th style="text-align: right">PostgreSQL 12*</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Average</td>
          <td style="text-align: right"><strong>125.52 ms</strong></td>
          <td style="text-align: right">132.40 ms</td>
          <td style="text-align: right">156.97 ms</td>
      </tr>
      <tr>
          <td>p(95)</td>
          <td style="text-align: right"><strong>129.73 ms</strong></td>
          <td style="text-align: right">139.43 ms</td>
          <td style="text-align: right">171.86 ms</td>
      </tr>
      <tr>
          <td>p(99)</td>
          <td style="text-align: right">182.13 ms</td>
          <td style="text-align: right"><strong>150.07 ms</strong></td>
          <td style="text-align: right">177.16 ms</td>
      </tr>
      <tr>
          <td>Maximum</td>
          <td style="text-align: right">229.31 ms</td>
          <td style="text-align: right">243.90 ms</td>
          <td style="text-align: right">287.17 ms</td>
      </tr>
      <tr>
          <td>Requests</td>
          <td style="text-align: right"><strong>16,025</strong></td>
          <td style="text-align: right">15,930</td>
          <td style="text-align: right">15,590</td>
      </tr>
      <tr>
          <td>Failed requests</td>
          <td style="text-align: right">0%</td>
          <td style="text-align: right">0%</td>
          <td style="text-align: right">0%</td>
      </tr>
      <tr>
          <td>Database RSS peak</td>
          <td style="text-align: right"><strong>141 MB</strong></td>
          <td style="text-align: right">411 MB</td>
          <td style="text-align: right">1.7 GB**</td>
      </tr>
      <tr>
          <td>Load average, 1-minute average / peak</td>
          <td style="text-align: right"><strong>0.88 / 1.34</strong></td>
          <td style="text-align: right">1.27 / 2.01</td>
          <td style="text-align: right">&ndash;</td>
      </tr>
  </tbody>
</table>
<p>MariaDB was about 5% faster than MySQL on average and about 7% faster at p(95). PostgreSQL was
about 25% slower than MariaDB on average in the contextual comparison. The MariaDB and MySQL
difference is real, but not dramatic. All three results passed the latency thresholds comfortably.</p>
<p>The more interesting result is the tail: MySQL&rsquo;s p(99) was 150 ms, compared with 182 ms for
MariaDB, while PostgreSQL measured 177 ms. MariaDB won the average and p(95), but MySQL handled
the slowest one percent of requests more consistently in this run.</p>
<p>* PostgreSQL was measured in the earlier live-stack run, with different SQL text and a shared
cluster.</p>
<p>** The production PostgreSQL instance hosts several sites&rsquo; databases, so its CPU and memory
cannot be attributed to this workload alone.</p>
<h2 id="a-smaller-cpu-comparison">A smaller CPU comparison</h2>
<p>I also ran a smaller 15-VU test for two and a half minutes. The databases were equally warm when
this test started.</p>
<table>
  <thead>
      <tr>
          <th>Metric</th>
          <th style="text-align: right">MariaDB 10.3.39</th>
          <th style="text-align: right">MySQL 8.0.42</th>
          <th style="text-align: right">MySQL 8.0.42 (<code>performance_schema=OFF</code>)</th>
          <th style="text-align: right">PostgreSQL 12*</th>
      </tr>
  </thead>
  <tbody>
      <tr>
          <td>Average / p(95)</td>
          <td style="text-align: right"><strong>125.12 / 130.26 ms</strong></td>
          <td style="text-align: right">130.25 / 136.35 ms</td>
          <td style="text-align: right">130.81 / 136.82 ms</td>
          <td style="text-align: right">158.7 / 169.2 ms</td>
      </tr>
      <tr>
          <td>Database CPU average / peak</td>
          <td style="text-align: right"><strong>0.2% / 1.0%</strong></td>
          <td style="text-align: right">6.6% / 9.0%</td>
          <td style="text-align: right">8.3% / 10.0%</td>
          <td style="text-align: right">n/a**</td>
      </tr>
      <tr>
          <td>Database RSS</td>
          <td style="text-align: right"><strong>141 MB</strong></td>
          <td style="text-align: right">411 MB</td>
          <td style="text-align: right">162 MB</td>
          <td style="text-align: right">1.7 GB**</td>
      </tr>
  </tbody>
</table>
<p>* PostgreSQL was measured in the earlier live-stack run.</p>
<p>** PostgreSQL CPU and memory are not attributable to this workload alone because the instance
is shared by several sites.</p>
<p>For this workload, MariaDB used noticeably less CPU. The application sends many uncomplicated
queries, and MariaDB&rsquo;s executor appears to handle them with less overhead. This is the result
that most closely matches the original claim.</p>
<p>The CPU numbers should not be interpreted as a general statement that MySQL is expensive. The
tested request rate was low and the database was mostly waiting. At this scale, a few percentage
points of CPU do not affect the SLA, but they may matter on a smaller server or at a much higher
request rate.</p>
<h2 id="memory-and-performance_schema">Memory and <code>performance_schema</code></h2>
<p>The first MySQL run used 411 MB of resident memory, compared with 141 MB for MariaDB. That looks
like a large difference, but the defaults are not equivalent: MariaDB ships with
<code>performance_schema</code> disabled, while MySQL enables it by default.</p>
<p>With <code>performance_schema</code> disabled, MySQL used 162 MB. That is much closer to MariaDB&rsquo;s 141 MB,
so the original memory comparison was mostly a configuration difference rather than an inherent
900 MB advantage for one engine.</p>
<h2 id="what-this-does-and-does-not-prove">What this does and does not prove</h2>
<p>This benchmark supports a narrow conclusion:</p>
<blockquote>
<p>For this application, with many simple queries and a small, fully resident dataset, MariaDB
10.3 was slightly faster on average and used less CPU than MySQL 8.0. The available PostgreSQL
context was slower on this box, but it was not an engine-pure comparison.</p></blockquote>
<p>It does not prove that MariaDB is always faster than MySQL or PostgreSQL. It also does not show
how any engine would behave with large joins, analytical queries, writes under contention,
replication, different indexes, or a much larger dataset.</p>
<p>There is also a version caveat. MariaDB 10.3 is a 2019-generation release, while MySQL 8.0.42
is current. A comparison with MariaDB 10.6 or 11.x might produce different CPU and latency
results. MySQL 8 features such as CTEs and window functions were not relevant to this workload.</p>
<h2 id="conclusion">Conclusion</h2>
<p>The simple-query prediction held for mpazari.com. MariaDB was approximately 5% faster than MySQL
on average, 7% faster at p(95), and used much less CPU in the smaller comparison. The contextual
PostgreSQL result was approximately 25% slower than MariaDB on average, although its different
SQL dialect and shared cluster make that comparison directional rather than definitive. MySQL
had the better p(99) in the main run, and its apparent memory disadvantage largely disappeared
when <code>performance_schema</code> was disabled.</p>
<p>The differences are interesting, but they are not large enough to make the database engine the
bottleneck here. Both databases passed the SLA easily. For this application, schema design,
indexes, caching, connection handling, and the rest of the server stack are more important than
choosing between MariaDB and MySQL based on a 5% average-latency difference.</p>
<p>So the answer to the original question is: <strong>yes, MariaDB can be faster for many simple queries,
and this real application showed that pattern. PostgreSQL was slower in the available contextual
run, but that result needs a like-for-like rerun before making a strong engine-level claim. The
MariaDB advantage over MySQL was small, workload-specific, and not enough to make MySQL an
unreasonable choice.</strong></p>
]]></content:encoded>
    </item>
  </channel>
</rss>
