a curated list of database news from authoritative sources

October 09, 2025

Advanced observability and troubleshooting with Amazon RDS event monitoring pipelines

AWS provides a wide range of monitoring solutions for your Amazon RDS and Amazon Aurora instances, such as Amazon CloudWatch, Amazon CloudWatch Database Insights, and AWS CloudTrail. Amazon RDS event monitoring pipelines make troubleshooting operational events like reboots, errors, and failovers more efficient. In this post, we present a solution to get a head start on troubleshooting by sending an email after a reboot or failover with the last 10 minutes of important CloudWatch metrics, top queries, and related API calls performed on the instance.

A Guide to Redis Performance Best Practices

Getting started with Redis? Read this first. Redis makes it very easy to get started, but if you want Redis to keep up when things get busy, there’s a bit more to take care of. Anyone can spin up a test server, but production workloads demand reliability and performance planning. That’s where the details matter. […]

October 08, 2025

OLAP databases: what's new and what's best in 2025

Compare the leading OLAP databases including ClickHouse, Apache Druid, Pinot, and StarRocks. Learn what changed in 2025 with vector search, lakehouse formats, and serverless ingestion becoming standard features.

A quick review of different ClickHouse® MCP servers

There's more than one ClickHouse MCP Server. We compare popular ClickHouse MCP server implementations including the official clickhouse-mcp, Tinybird MCP Server, and Altinity MCP.

OLTP vs OLAP: when to use each (and when to use both)

Learn the key differences between OLTP and OLAP databases, when to use each type, and how modern architectures combine them to serve both operational and analytical workloads.

Tiga: Accelerating Geo-Distributed Transactions with Synchronized Clocks

This paper (to appear at SOSP'25) is one of the latest efforts exploring the dream of a one-round commit for geo-replicated databases. TAPIR tried to fuse concurrency control and consensus into one layer. Tempo and Detock went further using dependency graphs. 

Aleksey and I did our usual thing. We recorded our first blind read of the paper. I also annotated a copy while reading, which you can access here.

We liked the paper overall. This is a thoughtful piece of engineering, not a conceptual breakthrough. It uses future timestamps to align replicas in a slightly new way, and the results are solid. But the presentation needs refinement and stronger formalization. (See our livereading video about how these problems manifested themselves.) Another study to add to my survey, showing how, with modern clocks, time itself is becoming a coordination primitive.


The Big Idea

Tiga claims to do strictly serializable, fault-tolerant transactions in one wide-area round trip (1-WRTT) most of the time by predicting/tracking the future commit times of the transactions. Instead of waiting for messages to arrive and then ordering them, Tiga assigns each transaction a future timestamp at submission.

If all goes well, the transaction arrives before that timestamp at all replicas, waits until the local clock catches up, and then executes in order.

There is no dependency graph to track. Synchronized clocks and flight-of-message prediction promise to still get us strict serializability with 1-WRTT for most cases. Well, at least for more cases than the competition. You don't need to outrun the bear, but just the other campers.

This is essentially the Deadline-Ordered Multicast (DOM) idea from the Nezha paper. Figures 1–2 in the paper show the contrast with Tapir. Tapir commits optimistically and fails when transactions arrive in different orders at different regions. Tiga fixes this by giving both transactions predetermined timestamps: all servers delay execution until their clocks reach those timestamps, ensuring consistent order.

Tiga also merges consensus and concurrency control into a single timestamp-based protocol. I think the "Unanimous 2PC: Fault-tolerant Distributed Transactions Can be Fast and Simple" is a very relevant protocol to compare with here, but unfortunately, Tiga fails to cite U2PC.


Algorithm in a Nutshell

In the best case (steps 1-3), Tiga commits a transaction in 1-WRTT, essentially by predicting the correct global order instead of discovering it. If the prediction falters, steps 4-6 reconcile timestamps and logs, recovering correctness at the cost of another half to one full round trip.

1. Timestamp Initialization: The coordinator uses the measured one-way delays (OWDs) to each replica to predict when the transaction should arrive everywhere. It assigns the transaction a future timestamp t = send_time + max_OWD + Δ, where Δ is a small safety headroom (≈10 ms). This t represents the intended global serialization time. The coordinator then multicasts the transaction T and its timestamp to all shards.

2. Optimistic Execution: Upon receipt, each server buffers T in a priority queue sorted by timestamp. When the local clock reaches t, followers simply release T (they do not execute yet) while leaders execute T optimistically, assuming their local timestamp ordering will hold. The green bars in Figure 3 mark this optimistic execution phase.

3. Quorum Check of Fast Path: The coordinator collects fast-replies from a super quorum on each shard (the leader + f + ⌈f / 2⌉ followers). If the replies agree on the same log hash and timestamp, T is fast-committed. This completes the ideal 1-WRTT commit: half a round from coordinator to replicas, half back. (The other leader-inclusive paper I remember is Nezha, prior work to this one.)

4. Timestamp Agreement: Sometimes leaders execute with slightly different timestamps due to delays or clock drift. They then exchange their local timestamps to compute a common agreed value (the maximum). If all timestamps already match, the process costs 0.5 WRTT. If some leaders lag, another half round (total 1-WRTT) ensures alignment. If any executed with an older timestamp, that execution is revoked and T is re-executed at the new agreed time (slow path). This phase corresponds to the curved inter-leader arrows in the figure.

5. Log Synchronization: After leaders finalize timestamps, they propagate the consistent log to their followers. Followers update their logs to match the leader’s view and advance their sync-point. This ensures replicas are consistent before commit acknowledgment. The figure shows this as another 0.5 WRTT of leader-to-follower synchronization.

6. Quorum Check of Slow Path: Finally, the coordinator verifies that enough followers (≥ f) have acknowledged the synchronized logs. Once that quorum is reached, T is committed via the slow path. Even in this fallback case, the total latency stays within 1.5–2 WRTTs.

I am skipping details and optimizations. Leaders across many shards being located in the same datacenter/AZ is an optimization to improve the latency of timestamp-agreement (that this paper seem to have borrowed from the recent OSDI'25 Mako paper.) This then opens the door for a preventive flavor of the Tiga workflow as shown in Figure 6.

Evaluation Highlights

Running on Google Cloud across three regions, Tiga outperforms Janus, Tapir, and Calvin+ by 1.3–7x in throughput and 1.4–4x lower latency. In low-contention microbenchmarks, it easily sustains 1-WRTT commits. Under high contention, Calvin+ catches up somewhat but with 30% higher latency. Calvin+ replaces Calvin's Paxos-based consensus layer with Nezha, saving at least 1-WRTT in committing transactions. A lot of work must have gone into these evaluation results.




October 07, 2025

Celebrating a New Chapter: Percona Welcomes Peter Farkas as its New Chief Executive Officer

Today, we are excited to announce that Peter Farkas will serve as Percona’s new Chief Executive Officer, where he will build on the company’s long-standing track record of success with an eye toward continuous innovation and growth.  As a former Perconian with a wealth of technical expertise and over a decade of experience leading successful […]

October 06, 2025

My time at Oracle: functional and design specification reviews

I worked at Oracle from 1997 to 2005 for 3 years on the app server team in Portland and the last 5 on DBMS query execution in Redwood Shores. I had a good time there, made many friends and learned a lot.

They had an excellent process for functional and design specification reviews. Like many, I am wary of (too much) process but this wasn't too much. It was just enough.

At a high level, you would write and then get a review for the functional spec. The review was an in-person meeting. Once that was resolved the process would repeat for the design spec. You were expected to write a good spec -- it was better for one person (the author) to spend much time on it to avoid wasting time for the many readers. Many specs would be revisited long after the review because there is turnover and specs are easier to read than source code.

We used FrameMaker to write the specs on Solaris workstations. That was a long time ago. The functional spec I wrote for IEEE754 datatypes was more than 50 pages because I had to document every aspect of PL/SQL and SQL that would be impacted by it (there were so many functions to document). The design spec I wrote for a new sort algorithm was also quite long because I had already implemented the algorithm to collect performance results to justify the effort. The patent attorney copied much of that design doc into the patent resulting in a patent that might be more readable than average.

For each specification you setup a meeting a few weeks out and shared the spec with people who might attend the meeting. In many cases there was feedback via email or in person prior to the meeting that could be resolved before the meeting. But in some cases there was feedback that wouldn't get resolved until the meeting.

It is important to split the functional and design specs, and their reviews. It helps with efficiency and the design review might change a lot based on the outcome of the functional spec review.

There are a variety of responses to the feedback, and all of that was added to an appendix of the spec (both the feedback and the response). Common responses include:

  • good point
    • I will change my spec as you suggest
  • no thank you
    • I disagree and will not change my spec as you suggest. Hopefully this isn't the response to all feedback but some people like to bike shed and/or get in the way of progress. When I rewrote the sort algorithm, I used something that was derived from quicksort and quicksort implementations have worse than expected performance on some input sequences. The algorithm I used was far better than vanilla quicksort in that regard, but it didn't eliminate the risk. However, the performance improvement over the existing code was so large (the white paper claims 5X faster) that I sad no thank you and the project got done. But I did spend some time doing the math to show how likely (or unlikely) the worst cases were. I needed a tool with arbitrary precision math to for that because the numbers are small and might have ended up using a Scheme implementation.
  • good point, but
    • I won't change my spec, but I have a workaround for the problem you mention. For IEEE754 datatypes, a few people objected because a few infrequently and fading platforms for the DBMS did not have hardware support for IEEE754. My solution was to use functions for each IEEE754 operation that were trivial for platforms with IEEE754 HW support -- things like double multiply_double(x, y) { return x*y } but could be implemented as needed on the platforms that lacked IEEE754 via a software implementation of IEEE754.

October 05, 2025

Measuring scaleup for Postgres 18.0 with sysbench

This post has results to measure scaleup for Postgres 18.0 on a 48-core server.

tl;dr

  • Postgres continues to be boring (in a good way)
  • Results are mostly excellent
  • A few of the range query tests have a scaleup that is less than great but I need time to debug

Builds, Configuration & Hardware

The server has an AMD EPYC 9454P 48-Core Processor with AMD SMT disabled, 128G of RAM and SW RAID 0 with 2 NVMe devices. The OS is Ubuntu 22.04.

I compiled Postgres 18.0 from source and the configuration file is here.

Benchmark

I used sysbench and my usage is explained here. To save time I only run 32 of the 42 microbenchmarks 
and most test only 1 type of SQL statement. Benchmarks are run with the database cached by Postgres. Each microbenchmark is run for 300 seconds.

The benchmark is run with 1, 2, 4, 8, 12, 16, 20, 24, 32, 40 and 48 clients. The purpose is to determine how well Postgres scales up.

Results

The microbenchmarks are split into 4 groups -- 1 for point queries, 2 for range queries, 1 for writes. For the range query microbenchmarks, part 1 has queries that don't do aggregation while part 2 has queries that do aggregation. 

I still use relative QPS here, but in a different way. The relative QPS here is:
(QPS at X clients) / (QPS at 1 client)

The goal is to determine scaleup efficiency for Postgres. When the relative QPS at X clients is a value near X, then things are great. But sometimes things aren't great and the relative QPS is much less than X. One issue is data contention for some of the write-heavy microbenchmarks. Another issue is mutex and rw-lock contention.

Perf debugging via vmstat and iostat

I use normalized results from vmstat and iostat to help explain why things aren't as fast as expected. By normalized I mean I divide the average values from vmstat and iostat by QPS to see things like how much CPU is used per query or how many context switches occur per write. And note that a high context switch rate is often a sign of mutex contention.

Those results are here but can be difficult to read.

Charts: point queries

The spreadsheet with all of the results is here.

While results aren't perfect, they are excellent. Perfect results would be to get a scaleup of 48 at 48 clients and here the result is between 40 and 42 in most tests. The worst-case is for hot-points where the scaleup is 32.57 at 48 clients. Note that the hot-points test has the most data contention of the point-query tests, as all queries fetch the same rows.

From the vmstat metrics (see here) I don't see an increase in mutex contention (more context switches, see the cs/o column) but I do see an increase in CPU (cpu/o). When compared to a test that has better scaleup, like points-covered-pk, there I also don't see an increase in mutex contention and do see an increase in CPU overhead (see cpu/o) but the CPU increase is smaller (see here).

Charts: range queries without aggregation

The spreadsheet with all of the results is here.

The results again are great, but not perfect. The worst case is for range-notcovered-pk where the scaleup is 32.92 at 48 clients. The base case is for scan where the scaleup is 46.56 at 48 clients.

From the vmstat metrics for range-notcovered-pk I don't see any obvious problems. The CPU overhead (cpu/o, CPU per query) increases by 1.08 (about 8%) from 1 to 48 clients while the context switches per query (cs/o) decreases (see here).

Charts: range queries with aggregation

The spreadsheet with all of the results is here.

Results for range queries with aggregation are worse than for range queries without aggregation. I hope to try and explain that later. A perfect result is scaleup equal to 48. Here, 3 of 8 tests have scaleup less than 3, 4 have scaleup between 30 and 40, and the best case is read-only_range=10 with a scaleup of 43.35.

The worst-case was read-only-count with a scaleup of 21.38. From the vmstat metrics I see that at CPU overhead (cpu/o, CPU per query) increases by 2.08 at 48 clients vs 1 client while context switches per query (cs/o) decrease (see here). I am curious about that CPU increase as isn't as bad for the other range query tests, for example see here where it is no larger than 1.54. The query for read-only-count is here.

Later I hope to explain why read-only-count, read-only-simple and read-only-sum don't do better.

Charts: writes

The spreadsheet with all of the results is here.

The worst-case is update-one where scaleup is 2.86 at 48 clients. The bad result is expected as having many concurrent clients update the same row is an anti-pattern with Postgres. The scaleup for Postgres on that test is a lot worse than for MySQL where it was ~8 with InnoDB. But I am not here for Postgres vs InnoDB arguments.

Excluding the tests that mix reads and writes (read-write-*) the scaleup is between 13 and 21. This is far from great but isn't horrible. I run with fsync-on-commit disabled which highlights problems but is less realistic. So for now I am happy with this results.



October 03, 2025

First/Last per Group: PostgreSQL DISTINCT ON and MongoDB DISTINCT_SCAN Performance

On Stack Overflow, the most frequent question for PostgreSQL is: "Select first row in each GROUP BY group?". I've written about it previously, presenting multiple alternatives and execution plans: How to Select the First Row of Each Set of Grouped Rows Using GROUP BY.
Solving this problem in a way that's both straightforward and high-performing can be challenging with SQL databases. However, MongoDB's aggregation provides a simple syntax and an efficient execution plan. When you use $first or $last alongside $sort and $group, MongoDB can perform an efficient loose index scan, which is similar to an index skip scan, reading only what is necessary for the result.

PostgreSQL

With PostgreSQL, the DISTINCT ON ... ORDER BY syntax is the easiest for the developer, but not the best for performance.

create table demo (
 primary key (a, b, c),
  a int, b timestamptz,
  c float,
  d text
);
-- insert a hundred thousand rows
insert into demo
 select 
  a,
  now() as b,
  random() as c,
  repeat('x',5) as d
 from generate_series(1,5) a
    , generate_series(1,20000) c
 -- ignore bad luck random;
 on conflict do nothing
;
-- run 10 more times (now() will be different):
\watch count=9
vacuum analyze demo;

In PostgreSQL 18, all rows are read, but most are eliminated so that only one row remains per group:

explain (buffers, analyze, verbose, costs off)
select
 distinct on (b) a, b, c, d
from demo
where a=1
order by b, c
;

                                             QUERY PLAN
----------------------------------------------------------------------------------------------------
 Unique (actual time=0.025..94.601 rows=10.00 loops=1)
   Output: a, b, c, d
   Buffers: shared hit=199959
   ->  Index Scan using demo_pkey on public.demo (actual time=0.024..77.263 rows=200000.00 loops=1)
         Output: a, b, c, d
         Index Cond: (demo.a = 1)
         Index Searches: 1
         Buffers: shared hit=199959
 Planning Time: 0.077 ms
 Execution Time: 94.622 ms

Although the DISTINCT ON ... ORDER BY syntax is straightforward, it is not efficient here: the number of rows processed (rows=200,000.00) and buffers read (Buffers: shared hit=199,959) is excessive compared to the result size (rows=10.00).

If you want to avoid unnecessary reads, you have to write a complex recursive CTE:

with recursive skip_scan as (
 (
  -- get the first row
  select * from demo
  where a=1
  order by b,c limit 1
 ) union all (
  -- get the next row
  select demo.*
  from skip_scan , lateral(
   select * from demo
   where demo.a = skip_scan.a and demo.b > skip_scan.b
   order by b,c limit 1
  ) demo
 )
)
select * from skip_scan
;

This simulates an index loose scan with nested loops, iterating from a recursive WITH clause.

MongoDB aggregation

In MongoDB, using an aggregation pipeline makes it easy and efficient to get either the first or last document from each group.

I create a collection and fill it with similar data:

// Create collection and compound unique index to mimic PRIMARY KEY(a, b, c)
db.demo.drop();
db.demo.createIndex(
  { a: 1, b: 1, c: 1 },
  { unique: true }
);

// Function to insert bulk records
function insertDemoBatch() {
  const batch = [];
  const now = new Date();
  for (let a = 1; a <= 5; a++) {
    for (let j = 1; j <= 20000; j++) {
      batch.push({
        a: a,
        b: now,                   // similar to now()
        c: Math.random(),         // random float [0,1)
        d: 'x'.repeat(5)          // repeat string
      });
    }
  }
  try {
    db.demo.insertMany(batch, { ordered: false }); // ignore duplicates
  } catch (e) {
    print(`Insert completed with some duplicates ignored: ${e.writeErrors?.length ?? 0} errors`);
  }
}

// Run 10 times — now() will be different each run
for (let i = 0; i < 10; i++) {
  insertDemoBatch();
}

Here is the aggregation that groups and keeps the first value of each group:

db.demo.aggregate([
  { $match: { a: 1 } },         // equivalent to WHERE a=1
  { $sort: { b: 1, c: 1 } },    // equivalent to ORDER BY b, c
  { $group: {
      _id: "$b",                 // equivalent to DISTINCT ON (b)
      a: { $first: "$a" },       
      b: { $first: "$b" },
      c: { $first: "$c" },
      d: { $first: "$d" }      
  }},
  { $project: {                  // equivalent to SELECT a, b, c, d
      _id: 0, a: 1, b: 1, c: 1, d: 1 
  }},
]).explain("executionStats");

The execution plan is efficient, reading only one document per group (totalDocsExamined: 10) and seeking to the end of each group (keysExamined: 11) in the index scan:

...
        executionStats: {                                                                                                                                                                            
          executionSuccess: true,
          nReturned: 10,
          executionTimeMillis: 0,
          totalKeysExamined: 11,
          totalDocsExamined: 10,
          executionStages: {
            isCached: false,
            stage: 'FETCH',
            nReturned: 10,
            executionTimeMillisEstimate: 0,
            works: 11,
            advanced: 10,
            needTime: 0,
            needYield: 0,
            saveState: 1,
            restoreState: 1,
            isEOF: 1,
            docsExamined: 10,
            alreadyHasObj: 0,
            inputStage: {
              stage: 'DISTINCT_SCAN',
              nReturned: 10,
              executionTimeMillisEstimate: 0,
              works: 11,
              advanced: 10,
              needTime: 0,
              needYield: 0,
              saveState: 1,
              restoreState: 1,
              isEOF: 1,
              keyPattern: { a: 1, b: 1, c: 1 },
              indexName: 'a_1_b_1_c_1',
              isMultiKey: false,
              multiKeyPaths: { a: [], b: [], c: [] },
              isUnique: true,
              isSparse: false,
              isPartial: false,
              indexVersion: 2,
              direction: 'forward',
              indexBounds: {
                a: [ '[1, 1]' ],
                b: [ '[MinKey, MaxKey]' ],
                c: [ '[MinKey, MaxKey]' ]
              },
              keysExamined: 11
            }
          }
        }
      },
      nReturned: Long('10'),
...

MongoDB uses DISTINCT_SCAN in aggregation when the pipeline starts with a $sort and $group using $first or $last. The planner checks for a matching index that has the correct sort order, adjusting the scan direction if needed. If the conditions are met, MongoDB rewrites the pipeline to use DISTINCT_SCAN and $groupByDistinct, optimizing by skipping to the relevant index entries and retrieving only needed documents.

This pattern is common in real‑world queries such as:

  • Latestor earliest measure for each metric in a time‑series database
  • Last contract with each supplier
  • Last purchase from each client
  • Most recent transaction for each account
  • Earliest login event for each user
  • Lowest‑paid employee in each department

The Invisible Curriculum of Research

Courses, textbooks, and papers provide the formal curriculum of research. But there is also an invisible curriculum. Unwritten rules and skills separate the best researchers from the rest.

I did get an early education on this thanks to my advisor, Anish. He kept mentioning "taste", calling some of my observations and algorithms "cute", and encouring me to be more curious and creative and to develop my "taste". 

Slowly, I realized that what really shapes a research career isn't written in any textbook or taught in any course. You learn it by osmosis from mentors, and through missteps: working on the wrong problem, asking shallow questions, botching a project, giving up too soon. But if you can absorb these lessons faster, you will find research more fulfilling. The visible curriculum teaches you how to build a car. The invisible curriculum teaches you where to go, who to ride with, and how to keep going when the road turns uphill.

After 25 years of experience, I can name five big items on that curriculum. And with some sleight of hand, make these into the 5Cs of the invisible curriculum: curiosity/taste, clarity/questions, craft, community, and courage/endurance.


Curiosity/Taste

"Do only what only you can do"

-- Dijkstra's advice to a promising researcher, who asked how to select a topic for research

Most problems are not worth solving. They may be technically tricky but irrelevant, or they may be easy and uninteresting. Developing taste means knowing which questions combine depth, tractability, and importance.

I believe curiosity and taste have an innate part: you can't replicate the twinkle in Gouda's eye when he is onto an interesting research problem. But they can also be cultivated. You build them by reading broadly, revisiting classic papers, and asking senior researchers not just what was done, but why it mattered at the time. Over the years, I have seen researchers chase technically impressive but tasteless problems that led nowhere. The best researchers have a finely tuned compass that points toward ideas with lasting value.


Clarity/Questions

If I had an hour to solve a problem and my life depended on the solution, I would spend the first 55 minutes determining the proper question to ask. For once I know the proper question, I could solve the problem in less than five minutes. 

--A. Einstein

The best researchers are the best question-askers. Any good researcher can solve the problems handed to them. The real skill is asking sharper, deeper questions that reframe an area and make others stop and think, "Yes, that's the question we should be asking".

Good questions are uncomfortable: they expose blind spots, disrupt comfortable assumptions, and make traditionalists nervous. They are generative and open new directions. If you want to stand out, learn to ask better questions.


Craft

Details make perfection, and perfection is not a detail.

-- Leonardo da Vinci

Research ideas live or die by execution. I have seen brilliant insights fail because the paper was unreadable, the system was sloppy, or the evaluation was unconvincing. Craft is about how you write papers, present talks, code systems, or design experiments. Craft matters as much as the idea itself.

Craft looks boring from the outside: rewriting a paragraph five times, running experiments three different ways, making your figures clean and interpretable. But craft is what makes an idea visible, persuasive, and reproducible. Without it, your work never takes off.


Community

"None of us is as smart as all of us."

-- Ken Blanchard

Research happens in conversation, not isolation. Community is how you learn taste. Whom you share ideas with, who critiques your drafts, who cites you ... all of this shapes your trajectory. Invest in your community: mentor, review, collaborate, and give credit generously. Your reputation compounds faster, and lasts longer, than your h-index.

People skills are very important. There is nothing soft about these skills, these are the hardest skills to master and the most crucial for success. Learn to communicate well. Spend many times more effort than you think sufficient to improve your writing and presentation. Not a second of this work goes to waste. Really, just read through the Writing/Presenting section here.

Finally, maintain high standards. Your name is your currency. Trust is hard to gain and easy to lose.


Courage/Endurance

"Research is to see what everybody else has seen, and to think what nobody else has thought."

-- Albert Szent-Györgyi (Nobel laureate)

"Nothing in this world can take the place of persistence. Talent will not; genius will not; education will not; persistence and determination alone are omnipotent."

-- Calvin Coolidge

Community is important but that doesn't mean you flock like sheep. Incremental work is safe but forgettable. Transformative work requires courage to risk failure, and endurance to push through rejection. Every meaningful project will face resistance: reviewers who don't get it, experiments that collapse, colleagues who tell you it won't work.

Steven Pressfield calls it "turning pro": showing up day after day, even when enthusiasm wanes. The invisible curriculum here is that breakthroughs often come not from brilliance, but from stubborn persistence. The courage to start and the endurance to continue... That is what carries you across the long, dull middle of any project.


If you are looking for more to read, here is more advice:

https://muratbuffalo.blogspot.com/2024/07/advice-to-young.html

https://muratbuffalo.blogspot.com/2020/06/research-writing-and-career-advice.html

How to round timestamps in ClickHouse

Learn how to round timestamps in ClickHouse using toStartOfDay, toStartOfHour, and other built-in functions with syntax examples and performance tips.

How to URL-encode query parameters in ClickHouse

Learn how to safely URL-encode query parameters in ClickHouse using encodeURLFormComponent, including syntax, examples, and performance tips for web applications.

October 02, 2025

How to extract the protocol of a URL in ClickHouse

Learn how to extract URL protocols in ClickHouse using the protocol() function with practical examples, performance tips, and real-time API implementation.

How to round dates in ClickHouse

Master ClickHouse date rounding with toStartOfYear, toStartOfMonth, toStartOfWeek and more - complete guide with syntax, examples, and API integration.

Measuring scaleup for MariaDB with sysbench

This post has results to measure scaleup for MariaDB 11.8.3 on a 48-core server.

tl;dr

  • Scaleup is better for range queries than for point queries
  • For tests where results were less than great, the problem appears to be mutex contention within InnoDB

Builds, Configuration & Hardware

The server has an AMD EPYC 9454P 48-Core Processor with AMD SMT disabled, 128G of RAM and SW RAID 0 with 2 NVMe devices. The OS is Ubuntu 22.04.

I compiled MariaDB 11.8.3 from source and the my.cnf file is here.

Benchmark

I used sysbench and my usage is explained here. To save time I only run 32 of the 42 microbenchmarks 
and most test only 1 type of SQL statement. Benchmarks are run with the database cached by MariaDB. Each microbenchmark is run for 300 seconds.

The benchmark is run with 1, 2, 4, 8, 12, 16, 20, 24, 32, 40 and 48 clients. The purpose is to determine how well MariaDB scales up.

Results

The microbenchmarks are split into 4 groups -- 1 for point queries, 2 for range queries, 1 for writes. For the range query microbenchmarks, part 1 has queries that don't do aggregation while part 2 has queries that do aggregation. 

I still use relative QPS here, but in a different way. The relative QPS here is:
(QPS at X clients) / (QPS at 1 client)

The goal is to determine scaleup efficiency for MariaDB. When the relative QPS at X clients is a value near X, then things are great. But sometimes things aren't great and the relative QPS is much less than X. One issue is data contention for some of the write-heavy microbenchmarks. Another issue is mutex and rw-lock contention.

Perf debugging via vmstat and iostat

I use normalized results from vmstat and iostat to help explain why things aren't as fast as expected. By normalized I mean I divide the average values from vmstat and iostat by QPS to see things like how much CPU is used per query or how many context switches occur per write. And note that a high context switch rate is often a sign of mutex contention.

Charts: point queries

The spreadsheet with all of the results is here.

For point queries

  • tests for which the relative QPS at 48 clients is greater than 40
    • point-query
  • tests for which the relative QPS at 48 clients is between 30 and 40
    • none
  • tests for which the relative QPS at 48 clients is between 20 and 30
    • hot-points, points-covered-si, random-points_range=10
  • tests for which the relative QPS at 48 clients is between 10 and 20
    • points-covered-pk, points-notcovered-pk, points-notcovered-si, random-points_range=100
  • tests for which the relative QPS at 48 clients is less than 10
    • random-points_range=1000
For 5 of the 9 point query tests, QPS stops improving beyond 16 clients. And I assume that mutex contention is the problem.

Results for the random-points_range=Z tests are interesting. They use oltp_inlist_select.lua which does a SELECT with a large IN-list where the IN-list entries can find rows by exact match on the PK. The value of Z is the number of entries in the IN-list. And here MariaDB scales worse with a larger Z (1000) than with a smaller Z (10 or 100), which means that the thing that limits scaleup is more likely in InnoDB than the parser or optimizer.

From the normalized vmstat metrics (see here) for 1 client and 48 clients the number of context switches per query (the cs/o column) grows a lot more from 1 to 48 clients for random-points_range=1000 than for random-points_range=10. The ratio (cs/o at 48 clients / cs/o at 1 client) is 1.46 for random-points_range=10 and then increases to 19.96 for random-points_range=1000. The problem appears to be mutex contention.

Charts: range queries without aggregation

The spreadsheet with all of the results is here.

For range queries without aggregation:

  • tests for which the relative QPS at 48 clients is greater than 40
    • range-covered-pk, range-covered-si, range-notcovered-pk
  • tests for which the relative QPS at 48 clients is between 30 and 40
    • scan
  • tests for which the relative QPS at 48 clients is between 20 and 30
    • none
  • tests for which the relative QPS at 48 clients is between 10 and 20
    • none
  • tests for which the relative QPS at 48 clients is less than 10
    • range-notcovered-si
Only one test has less than great results for scaleup -- range-notcovered-si. QPS for it stops growing beyond 12 clients. The root cause appears to be mutex contention based on the large value for cs/o in the normalized vmstat metrics (see here). For all of the range-*covered-* tests, has the most InnoDB activity per query -- the query isn't covering so it must do PK index access per index entry it finds in the secondary index.

Charts: range queries with aggregation

The spreadsheet with all of the results is here.

For range queries with aggregation:

  • tests for which the relative QPS at 48 clients is greater than 40
    • read-only-distinct, read-only-order, read-only-range=Y, read-only-sum
  • tests for which the relative QPS at 48 clients is between 30 and 40
    • read-only-count, read-only-simple
  • tests for which the relative QPS at 48 clients is between 20 and 30
    • none
  • tests for which the relative QPS at 48 clients is between 10 and 20
    • none
  • tests for which the relative QPS at 48 clients is less than 10
    • none
Results here are excellent, and better than the results above for range queries without aggregation. The difference might mean that there is less concurrent activity within InnoDB because aggregation code is run after each row is fetched from InnoDB.

Charts: writes

The spreadsheet with all of the results is here.

For writes:

  • tests for which the relative QPS at 48 clients is greater than 40
    • none
  • tests for which the relative QPS at 48 clients is between 30 and 40
    • read-write_range=Y
  • tests for which the relative QPS at 48 clients is between 20 and 30
    • update-index, write-only
  • tests for which the relative QPS at 48 clients is between 10 and 20
    • delete, insert, update-inlist, update-nonindex, update-zipf
  • tests for which the relative QPS at 48 clients is less than 10
    • update-one
The best result is for the read-write_range=Y tests which are the classic sysbench transaction that does a mix of writes, point and range queries. 

The worst result is from update-one which suffers from data contention as all updates are to the same row. A poor result is expected here.