C
C
c-darwin2016-09-13 13:40:27
PostgreSQL
c-darwin, 2016-09-13 13:40:27

Is it worth doing a nosql highload with several billion rows to get away from add column?

Users can create their own tables, store and receive data through our API.
There may be several billion data. Horizontal sharding will be used. shard = 1 master and 2 slaves.
If a user already has several billion rows and decides to add a column, then he must announce this a week in advance. Because on all shards, you will need to do the following:
1. Stop replication to slaves 1 and 2, add column to slaves 1 and 2
2. Enable replication to slaves 1 and 2.
3. Replace master with slave 1.
4. Upload from slave 2 DB on the old master.
5. As a result, everyone has a new column and fresh data, while the master did not disappear from the network.
Actually a question. If everything is moved to leveldb, then it will be possible to get rid of add column, but won't this add new, more serious problems?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Melkij, 2016-09-13
@c-darwin

And why stop replication and other strange things to add a column in postgresql?
Add a default null column. Transactionally, instantly. If the column should not be null, then after adding the column, change its default, then update the existing rows in small batches, then drop null.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question