# Query optimisation resulting in a significant performance improvement

**URL:** https://forum.duplicati.com/t/query-optimisation-resulting-in-a-significant-performance-improvement/14202
**Category:** Developer
**Created:** [April 4, 2022, 11:57am UTC](https://forum.duplicati.com/t/query-optimisation-resulting-in-a-significant-performance-improvement/14202 "2022-04-04T11:57:00Z")
**Posts on this page:** 1
**Showing post:** 2

<div class="post-metadata">

### Author: ![ts678](https://forum.duplicati.com/letter_avatar_proxy/v4/letter/t/8491ac/32.png) [@ts678](https://forum.duplicati.com/u/ts678)
#### Post date: [April 4, 2022, 1:17pm UTC](https://forum.duplicati.com/t/query-optimisation-resulting-in-a-significant-performance-improvement/14202/2 "2022-04-04T13:17:03Z")

</div>

> [@PaulHop](#):
>
> These changes have improved query performance by 37%. Due to the significant reduction in server resourcing required for the optimised query, in real-world scenarios, for a backup with ~500 versions, this has consistently reduced total backup time from 20-22 minutes to around 6 minutes.

Impressive work and great writeup! Unfortunately, someone better at SQL than I am should take a look. Possibly I can add some Duplicati-specific thoughts (eventually) because I know some better than SQL.

> [@PaulHop](#):
>
> I also see other opportunities for performance and integrity gains in the database. If people are keen I can look at making these changes

@tarianjed is raising performance too, getting a change in master and [2.0.6.101\_canary\_2022-03-13](https://github.com/duplicati/duplicati/releases/tag/v2.0.6.101-2.0.6.101_canary_2022-03-13).

> Improved database query performance, thanks [@jedthe3rd](https://github.com/jedthe3rd)

[Identified another slow query during backup](https://forum.duplicati.com/t/identified-another-slow-query-during-backup/14005)

[DB Query Performance Testing, Fixes, and Maintainability](https://forum.duplicati.com/t/db-query-performance-testing-fixes-and-maintainability/14018)

> [@PaulHop](#):
>
> This change will be released as a pull request shortly, when I have time

I feel very fortunate that Duplicati now has two great people doing SQL, and I wonder if you could work together not just on performance, but on integrity, maintainability, etc. Maybe also review pull requests?

Current staff is very depleted (from attrition) of people who know their way around SQL. It’s unfortunate. Automated unit tests run when a PR goes in, but they don’t catch everything. Expert review is important.

There are also, frankly, still some backup integrity issues that people hit (though it used to be far worse). Because SQL is so central to Duplicati, SQL expertise is important to trying to either figure out what had happened (difficult, especially if it’s reported externally), improve defensive C# or SQL code, and so on.

---

_[View the full topic](https://forum.duplicati.com/t/query-optimisation-resulting-in-a-significant-performance-improvement/14202)._
