HotCarbon 2026

Databases Are Blind to Energy

Andres Navarro Pedregal (ETH Zurich), Tobias Rahn (ETH Zurich), Michal Friedman (ETH Zurich)

This transcript was made by AI. The open source speech recognition model Whisper (large-v3-turbo) transcribed the recording with faster-whisper. Names and technical terms were checked against the paper, but it can still contain mistakes. The recording is the reference.

0:01 So we have a virtual presentation next. I'm Andres Navarro-Pedregal, first year PhD student in the Chores Group in ETH Zurich. And today I'm going to present to you our latest research in sustainable databases. First of all, I want to thank the organizers of the HotCarbon Workshop and also the anonymous reviewers to make this possible. And my co-authors, Tobias Rahn and Professor Michal Friedman. In this presentation, I want to talk to you about our latest research and our approach to try to understand what are the software trade-offs that we can make to lower the energy consumption of the different databases, given the same hardware. So first of all, why do we care about this? So in the recent years, we have seen exponential growth in the energy consumption of the latest data centers.

0:50 Currently, they are consuming around 1.5% of the world's total electricity, and they are expected to double in 2030. And if we think about our first intuition, how to lower this number, the first intuition that comes to mind, at least for me, is that we can use more efficient hardware. So the first approach is that we usually want to have more efficient hardware to reduce energy consumption. However, we are running software, and we don't understand the energy effects that those software that we're running on have. So for that, we wanted to understand the software part of the databases, as those are one of the workloads that are usually run in almost every data center, and they are one of the most predominant workloads. So for this, we wanted to understand how do we measure the energy consumption of different software parts of the databases, and we found that there are two main problems with how we measure databases currently.

1:50 The first measurement is the first problem is that all the benchmarks that we have for databases, such as TPC-Energy, usually only measure the total energy consumption of the computer. And we don't go into the details about which query is consuming the most, so we don't have the knowledge on how can we optimize with these queries. Then, another issue is that we usually run these databases with a default configuration, where these configurations are only chosen for safety reasons, compatibility reasons, or performance reasons, and they are never chosen for energy. The main reason is that, as we don't have energy measurements, then we cannot optimize for it, so we wanted to change this. And for this, we wanted to understand what's the energy cost of the different software choices that we make in the databases, and if we can see some clear patterns or trade-offs that we can make to lower the energy consumption of these workloads.

2:49 So, in this presentation, I'm going to talk to you about the methodology and some findings that we have seen. So, first of all, we wanted to run all the workloads in one machine, given a fixed hardware, what are the different software trade-offs that we make, and change only one setting at a time. In this study, we look at the following four settings. The first setting is the database engine. So, for this, we change the database engine, and we use different database architectures, and as I will explain later, to understand if different software tools consume different amount of energy. Then, we want to understand what's the durability guarantees and what's the durability trade-offs that we can make to lower the energy consumption. And also, if creating indexes in these databases is always an energy or performance optimization, or there are workloads where we don't see these performance gains or energy gains.

3:48 And finally, we wanted to understand what's the effect of the query plan with energy consumption of the databases to see if there's some room for improvement here. In order to study this, we use the following metric, which is the energy per transaction. We use this metric as we wanted to understand what's the efficiency of the different databases, and not only understand what's the total consumption of the whole energy. So, for this, we divide the energy consumed by the software components, and then we divide it by the total transactions they preformed. So, this gives us the efficiency, that means how many watts we expend per each transaction, and we can further compare the different workloads, much more precise than if we only look at the total energy consumption of these database workloads.

4:37 In order to model the total energy of the software components, we measure the CPU and DRAM with RAPL, reading the RAPL registers with different energy tools, as I will talk to you about later. And also, we added what's the consumption of the disk to take that into account. So, with this, we can understand what are the software, we can understand and compare the different software choices, and how they differ in the energy efficiency, not by only running in a specific time frame.

5:13 So, our setup is composed for four different dimensions. The first dimension is that we test in two different machines, one machine with a desktop with an HDD, where we have a power meter to make sure that the measurements that we are taking are accurate, and the second one, it's a bigger machine with a cached disk, to understand if our findings scale with the size of the database.

5:39 Then, we also test three different database engines, PostgreSQL and MariaDB, which are client-server architectures, and also SQLite, which is an embedded database. We test under two different workloads, TPC-C, which is an OLTP workload, specifically done for transaction, and also TPC-H, for big analytical queries, or OLAP.

6:08 And then, how we measure energy? We tested different RAPL-based tools to measure the energy consumption of the CPU and the DRAM. And we make sure that the measurements that we are getting are accurate against a wall power meter. And we also model the disk energy by the idle energy of the disk, plus the active energy. And we validated everything against a wall power meter and subtracted the baseline, so we take only the software components, the energy consumption of the software components. One of the things we want to highlight is that, even though we don't get exact numbers, we make sure to get consistent trends across all tools, because obtaining exact numbers with energy, it's a challenge. So, we wanted to make sure that the trends fall always.

7:00 So, first of all, for the first workload, we wanted to understand what's the energy consumption of the different database architectures, and what's the efficiency of them. Here, you can see a TPC-C workload run on the three different databases, and also split into the different tables, or different workloads. And you can see the y-axis is the energy cost of the transaction perception. One of the insights that we can see here is that if we focus on the read-only workloads, such as order status or delivery, then we can see that SQLite uses up to three times less energy than MariaDB, or up to two times less energy than PostgreSQL. The reason for this is that SQLite employs a very simple and slim architecture, where there's no server overhead or IPC, which makes it very efficient for reads.

7:53 If we take a look at write-heavy workloads, such as new order or payment, we can see that SQLite uses up to 11.6 times more energy than PostgreSQL, and similar, or 12 times more than MariaDB. The main reason here is that SQLite syncs to the disk every commit down to it, so the CPU time takes a long time. Now, we want to understand what are the durability trade-offs that we can make for the different databases, and what's the energy impact of those. So for this, we run TPC-C benchmarks on PostgreSQL and SQLite, and we disable the synchronous commits. That means that we compare synchronous versus asynchronous commits. Asynchronous commits, just for the ones that don't know, are that when you perform a write, it will always wait for the disk to be written persistently, which means that it will be durable to crashes.

8:52 And for asynchronous commits, then we make sure that we don't need to commit to the disk, so we skip the durability on the disk, which means that we will lose the latest commits. It's worth noting that it will be different for PostgreSQL or SQLite. For SQLite, as every write will go to the disk, if we are not committing to the disk instantly, we might crash the database. However, on PostgreSQL, as we are using a write-ahead log, then that means that even though we are not committing to a disk, in a case where there's a crash, we will only lose the 10 latest transactions, as they are not committing to the write-ahead log disk file. So, this means that there are different durability guarantees for different architectures.

9:36 So, it's very important to understand what are these trade-offs and how are they architecturally implemented to understand the trade-offs before seeing the energy impact. So, in the graph here, we can see on the PostgreSQL the energy cost of enabling or disabling synchronous commits. And here, we can compare write-heavy workloads only. And we can see that if we disable the synchronous commits, that means that not all transactions will be durable. Then, we can gain up to six times the energy. However, if we take a look at SQLite, as we disable the synchronous commits, then we can get up to 90 times the energy consumption. However, the problem with SQLite is that we can corrupt the database. This means that if we are disabling the durability, we can save up to 90%, but the problem is that we might corrupt the database.

10:32 So, it comes with several trade-offs. Then, we wanted to understand what's the difference between indexing and not indexing different databases and how we can query them. So, for this, we ran TPC-H benchmarks on SQLite, and then we added indexes into several queries and compared the energy cost of the two.

10:53 And for here, for this one, you can see three different queries, as they are the most interesting ones. And you can see that without indexes, usually consume much more energy than without indexes, which makes sense. That means that creating indexes will always be a better choice if we are making read-heavy workloads, as we don't have to traverse the database every time. And finally, we wanted to understand what are the different query plans. So, what's the energy impact of implementing different query plans? And for this, we ran TPC-H benchmarks with a scaling factor of 0.1 in the desktop. And here, you can see MariaDB and PostgreSQL because they are the most similar in database architecture. However, they implement different query plans. In these three queries, we can see that the energy costs of them are lower for PostgreSQL.

11:44 That means that PostgreSQL is more energy efficient than MariaDB, up to 6.4%. So, the impact that the query plan has on the database is substantial. So, this means that we can continue doing some research on more or different query plans and understand what's the energy impact of them, and even make energy or carbon-aware query plans.

12:11 We also run a bigger workload on the bigger machines, and we can see that these gaps grow up to 620 times on the Q9, for example. So, they go from 6 times to 620 times with bigger workloads. So, they hold on bigger workloads, basically. So, all in all, we have seen that there's an energy gap in every software choice that we make. So, we have to be very careful on what software choices we're making and make sure that we raise the number so we measure the energy that the software changes make. One of the claims that we want to make is that all measurements can be done right now. So, we just need to take the energy, and then we can show that we can lower the energy consumption of the different databases of software by just measuring the energy and using more performant architectures, such as creating indexes, using better query plans, or even disable some durability guarantees if we don't need to.

13:12 One of the two claims that we want to make is that once we enable this energy per transaction, and then we measure it, then we can enable new research areas, such as energy aware query planning, which prior work has shown that it can have up to 20% savings in energy. And also, we can enable carbon-aware scheduling to defer or reroute queries that are very energy intensive to lower carbon hours. And finally, we can test these assumptions in new hardware with different memory hierarchies or accelerators and see if this software changes hold on different types of hardware.

13:52 So, in conclusion, we tested on the same machine different software knobs or configurations, and we saw that there are huge energy trade-offs that we can make, and we can have savings up to 90 times per cent if we change durability guarantees, indexes, or query plans. Also, we have seen that the default configurations are not the most energy efficient, so it's very important to measure them, and by reporting what's per transaction or the efficiency of these databases, along throughput and latency, then we can make these differences actionable.

14:27 So, thank you very much for listening, and hope you have any, and I'm open for any questions. Optimized for latency, we might see an energy reduction for free. But across any of the dimensions that you tested, did you ever see kind of a negative correlation where you can increase latency, but somehow save on energy? So, for ours, we didn't look at the latency mainly, we looked at the performance or throughput, but our experiments were limited to three-hour windows, so we did not look at the latency, but that can be an interesting topic to see. What we tested is mainly the efficiency of the databases, but we did not take a look. It can be an interesting future work. Yeah, thank you for listening. We'll look for examples where we would do something differently if we were to consider energy as a first-order metric. So, I'm really curious to see what we might find with databases. Yeah, so the main area we found an interesting point to do further research on. It's on the durability guarantees and what does that mean for energy, because it improves performance and also the energy efficiency, but the thing is that you have to know the workload that you're running to make sure that the configuration that you run on the database is according to your

16:14 guarantees that you want. But there are some examples of workloads like logging that you might want to reduce the durability guarantees while decreasing the energy consumption. Did that answer the question? Yeah, yeah, you did. Thank you. Okay, thank you. So, I had one. Will you see any split between the CPU versus RAM versus disk power? Or any interesting trends there? What do you mean? Can you... Like, are there specific queries that consume more CPU versus more disk, which was unexpected? There are some queries that consume more CPU, and there are other queries that are bounded by the disk latency to read. So, if there's a query that is reading a lot of times to the disk, depends on the way the disk is handled, then you get a lot of idle time in the CPU, which increases drastically the energy efficiency. But the main bottlenecks that we had running these workloads were disk readouts. So, this was the main bottleneck on these database workloads.

17:30 Any other questions? Is that clear? Yeah, makes sense. Thank you. Okay. Thank you guys. Other questions? Okay. If not, we can thank Andres again virtually.