Live data from Hacker News

How to Build Your Distributed Database

citusdata.com

11–20 of 24 posts

Re: How to Build Your Distributed Database

#11
post #8

Can someone explain why one can't simply average the individual average results as the author wrote below: "" No, we can't run averages on worker nodes, and then average those out. We need to have each worker node compute their sum(order_value) and count(order_value), and then sum(sum()) / sum(count()) on the coordinator node. ""? Thank you.

Set 1 (5,4,3) = 4 average

Set 2 (5,7) = 6 average

Average of average (4,6) = 5

Average of Set 1 + Set 2 (5,4,3,5,7) = 4.8

Re: How to Build Your Distributed Database

#12
post #6

I'd be interested in what Datomic's approach looks like in comparison.

A top of mind comparison.

Citus is a distributed relational database vs. Datanomic is a non-relational database.

Citus uses SQL as its query language vs. Datanomic uses Datalog.

Both support joins.

Citus is built on PostgreSQL as its data storage layer. Datanomic supports multiple storage layers.

There are more differences that can be found via Google.

Re: How to Build Your Distributed Database

#13
post #5

Let me ask you this - how would I use citusdb in such a way that it does not become a tax on my growth? In other words, big data usually precedes big revenue, but most data products are priced per datum not per revenue. So to put in indelicately, who can afford this and if they could, why would they? (after all those who could afford it, eg: bloomberg have strong reasons not to)

Umur from Citus here. Our goal is to make CitusDB an enabler for your growth by making scaling out simple for you and your dev, ops and analyst teams. If we've made it a tax instead and haven't saved you significant time, effort and complexity in the process, we're not doing our job. At a practical level, we offer several ways to accomplish this: - We provide free, open-source extensions on standard PostgreSQL (pg_sh…

What are the advantages of CitusDB over Oracle RAC?

Your pricing page tells me you will charge me as much as you think I can afford, so Oracle kind of is the elephant in the room here.

Re: How to Build Your Distributed Database

#14
post #6

I'd be interested in what Datomic's approach looks like in comparison.

From what I gather, underneath Datomic is an event sourcing database, which is a model that already scales "for free". Further optimization is the fact the query engine lies on the application, so if you have N application servers you have N CPUs available for querying - as opposed to overloading a master server or having to provision read slaves.

It can be used for event sourcing, but it does prune past data (for single-value values, compared to set-like values) in the current database indexes. Old data is still available in older indexes.

Re: How to Build Your Distributed Database

#15
post #6

I'd be interested in what Datomic's approach looks like in comparison.

AFAIK, Datomic doesn't have the same kind of distributed load management out of the box for you, where you can do analytical queries over the whole data set.

Datomic is designed such that load from analytic queries is local to the quering machine (apart from storage retrieval which can be cached and replicated), thus it does not need to be ran on a shadow server or some distanced system from the live production system.

Because the data is immutable in Datomic, there is no need for worrying about locks on tables or documents for contention of future writes--since it reads the data at the time of the query starting from immutable files (joined with the database transaction 'novelty' buffer/log since the last database indexing operation).

It is also up to the querying machine to store the conclusions from such queries in whatever way they like. (If this means going to another datomic instance, or put on HDFS or GFS, by all means.)

Re: How to Build Your Distributed Database

#16
post #8

Can someone explain why one can't simply average the individual average results as the author wrote below: "" No, we can't run averages on worker nodes, and then average those out. We need to have each worker node compute their sum(order_value) and count(order_value), and then sum(sum()) / sum(count()) on the coordinator node. ""? Thank you.

It's not just averages, it's division in general.

Division is not commutative, as the article says. A simple example referring to the article's diagram of boxes:

orders_2013 has sum(price) = 10, with 3 records

orders_2014 has sum(price) = 11, with 5 records

orders_2015 has sum(price) = 31, with 7 records

Average on each node, and average them:

( (10/3)+(11/5)+(31/7) ) / 3 = 3.32063492063

Sum the price individually on each node, take the counts on each node, sum them on the master node, and divide on the master node:

(10+11+31)/(3+5+7) = (10+11+31)/15 = 3.46666666667

hence, running division on each node is not the same as finding the division across all orders. (replace my use of division with "average" and it's the same concept).

Re: How to Build Your Distributed Database

#17
post #13
post #5

Earlier quoted context omitted.

Umur from Citus here. Our goal is to make CitusDB an enabler for your growth by making scaling out simple for you and your dev, ops and analyst teams. If we've made it a tax instead and haven't saved you significant time, effort and complexity in the process, we're not doing our job. At a practical level, we offer several ways to accomplish this: - We provide free, open-source extensions on standard PostgreSQL (pg_sh…

What are the advantages of CitusDB over Oracle RAC? Your pricing page tells me you will charge me as much as you think I can afford, so Oracle kind of is the elephant in the room here.

One big difference seems to be that Oracle RAC uses a shared disk for each node. This means you need a fast disk. Oracle ships a lot of data between RAC nodes so you need a fast interconnect between your nodes (e.g. infiniband).

Re: How to Build Your Distributed Database

#20
Interesting... it's actually associativity that matters for this class of distributed query execution problems (in particular, for AVG). While a/b != b/a indeed violates commutativity, the reason AVG doesn't distribute is that AVG(a, b, c, d, e) != AVG(AVG(a, b), AVG(c, d, e)), i.e. (1 + 2 + 3 + 4 + 5)/5 != ((1 + 2)/2 + (3 + 4 + 5)/3)/2. Notice that we're not reversing the order of any operations, merely the way in which they are grouped. Sum "scales" because a + b + c + d + e = (a + b) + (c + d + e) -> you can imagine computing a + b on one node and c + d + e on another, and then combining their sums together. GROUP_CONCAT (an aggregate that concatenates strings) is a good example of a non-commutative aggregate operation that is still associative. In fact, on a system that is distributed on non-overlapping ranges, you can straightforwardly merge a GROUP_CONCAT() operation because GROUP_CONCAT(a,b,c,d,e) = GROUP_CONCAT(GROUP_CONCAT(a,b), GROUP_CONCAT(c,d,e)).
Post reply on HN