Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support UNLOGGED tables #126

Open
ergo70 opened this issue Jul 22, 2015 · 2 comments
Open

Support UNLOGGED tables #126

ergo70 opened this issue Jul 22, 2015 · 2 comments
Labels

Comments

@ergo70
Copy link

ergo70 commented Jul 22, 2015

Could master_create_worker_shards() be extended in order to optionally create UNLOGGED shard placements?

It seems to work when I change them manually but this is tedious. 😄 But it makes a big difference in write speed. Since there are replicas, the risk of UNLOGGED seems to be lower than in a single node database.

@jasonmp85
Copy link
Collaborator

@ergo70: Are you certain you cannot achieve your performance goals through other means? We've seen pretty high insert rates without UNLOGGED by appropriately tuning PostgreSQL settings. I believe UNLOGGED tables are entirely truncated after a server crash, so your data loss would be total without backups (i.e. you'd lose all data in the table, not just data since some point in time).

One bad effect could occur if you execute a SELECT statement that somehow crashes a worker entirely (say, by executing buggy/unsafe extension code). pg_shard would realize the first replica failed to return a result, so it would continue to the second replica. If the bad code is written such that this query always crashes the server, the replica will crash too. You'd lose both replicas of your data just via that read operation. Presumably all of the other shards for this table would also be UNLOGGED, so any other shards on those two workers would also be truncated. This is quite an effect for a SELECT. I'm not saying none of our users are sophisticated enough to be able to responsibly make this choice, but I do think it might need some special treatment, or at least warnings.

The other side of the coin is that this is a PostgreSQL feature and so it's confusing to not support it. All my concerns above would also exist in a single-node setup and PostgreSQL has happily provided UNLOGGED for some time.

What precisely are your write throughput needs (rows/second)? I should be possible to hit them without UNLOGGED, but if that's absolutely impossible we may need to think outside the box.

@jasonmp85 jasonmp85 changed the title Support the creation of shard_placement tables as UNLOGGED Support UNLOGGED tables Jul 27, 2015
@ozgune
Copy link
Contributor

ozgune commented Jul 28, 2015

I'm interested in this feature as well. That way, we could have replicated "in-memory tables" for Postgres. :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants