Yes, there are several distributed-computing projects that let people donate otherwise-idle CPU time to the project.
(Note that with modern computers, that means also donating amount of electricity (30 to 80 Watts), because actually-idle CPUs / GPUs use (much) less power than when fully loaded. If you already heat your home with electricity, having your computer make the heat doesn't cost you anything extra, otherwise it add to your power bill. And extra air-conditioning if you're using more electricity to move the heat out of your house).
I'm sure there are more, those are just the few that I can think of off the top of my head.
distributed.net was one of the early pioneers of this form of distributed computing, where a central server can hand out work units for home computers and otherwise-idle servers to crunch on for hours, eventually sending back a bundle of results and fetching new ones. All of the projects I listed use that same model.
They motivate people to keep their computers contributing by running a leaderboard for contributions, and let users make teams. A little bit of gamification can get people to put in the effort to set up the software on some extra computers that they wouldn't otherwise. (Of course there's also the reward of contributing to something useful or interesting.)
To prevent cheating / corruption, the central servers will sometimes hand out the same block or chunk of data to multiple users, and compare the results. For some problems, the client can compute a proof-of-work result as it goes, basically a hash of some internal result while crunching, which it couldn't compute much more efficiently without having gone through all the steps of the actual computation. This allows the server to detect cheating clients that try to win the leaderboards (or just sabotage the project) by sending back work units as complete without actually having done the work. For some projects, like prime searching, the actual result is just a "no primes in this range", which is obviously trivial to fake.
All of the problems this model is useful for are "embarrasingly parallel": you can work on a subproblem without communicating at all with threads / nodes working on other subproblems.
As @Anonymous says, databases are usually not like this. The only thing I can think of is that maybe they're replicating the database onto every client, instead of having them send queries to a central server? If it's small-ish, and read-mostly, that could make sense. (Think like Git vs. SubVersion for revision control: with a distributed VCS like GIT, everyone has their own copy of the repo and can run searches locally instead of putting load on a central server and needing the latency of a round-trip over the Internet.)
Or possibly the database you're talking about is only distributed over nodes in a tightly-coupled cluster
That's already a thing, I think.
There are also cluster filesystems where a whole cluster of machines have disks that make up one huge filesystem, like PVFS, Lustre. That can be called a distributed filesystem, although distributed does often imply over a less tightly controlled cluster. (There are some distributed filesystems that support having some nodes disconnected without stalling everything, though.)
2
Unless it actually is an embarrassingly parallel problem, like SETI@Home or Mersenne prime searching, where a central server can hand out work units for home computers and otherwise-idle servers to crunch on for hours. Distributed computing has had good success in those few niche problems, like getting people to donate idle CPU time to science, math, or some other problem (like crypto brute force challenged: https://www.distributed.net/RC5)
– Peter Cordes – 2019-01-20T11:58:39.600"Idle time" is an extremely poor way of putting it. While CPUs aren't under load, they don't use as much power. At the end of the day all of these projects cost significant amounts of money to run, rather than the implication that they are simply using otherwise wasted capacity. – Anonymous – 2019-01-21T03:34:25.230
Yes, I'm aware of that. Some of these projects started before idle power saving was such a huge deal. But good point, I should add a caveat to my answer. – Peter Cordes – 2019-01-21T13:03:25.277