Comments (6)
Having the sequence live on the master is essentially a must right now, as INSERT
statements are commutable: conditions could arise wherein two racing INSERT
commands result in different sequence values across replicas. Perhaps that's an argument for looking into logical replication, but the feature wasn't mature enough for us to investigate earlier in pg_shard
's lifecycle.
Right now we eagerly evaluate any "constant expressions" during planning, e.g. we transform char_length('Jason')
into the integer 5
. Certain other functions could reasonably be supported by eagerly evaluating them on the master during planning, even things like rand
or in your case, nextval
. Since sequence values are never rolled back, our loose transactional semantics don't even get in the way here.
For the immediate future, we could expand the types of expressions we eagerly evaluate, or even offer a special eager
function to allow users to force eager evaluation of functions on the master.
from pg_shard.
Nothing stands out in my mind about special support for this kind of thing in 9.5… do you have a quick link to a pgsql-hackers thread on the topic? I'm a pretty heavy lurker in that list but don't remember anything about this.
from pg_shard.
Jason: there's some stuff buried in the Bi-directional replication code which allows replicas to pull "chunks" of sequences, in effect allowing for distributed sequences. However, this doesn't at all solve the consistency issue between shards.
Maybe we'd be better off implementing a UUID which is compatible with pg_shard instead, something which will be consistent yet unique across shards. Not quite sure how that would work, though.
from pg_shard.
Maybe we should borrow code from here? https://github.com/OptionsHouse/shard_manager
Shaun has a fairly advanced distributed ID-generation widget. We may need to work out licensing issues though.
from pg_shard.
implementing this would be highly appriciated.
from pg_shard.
Support sequences is definitely a nice to have.
Thanks for pg_shard
it's a huge improvement for postgresql.
from pg_shard.
Related Issues (20)
- Allow IMMUTABLE functions in modification commands HOT 8
- DISTINCT and JSON field selection HOT 2
- Does pg_shard support user defined functions? HOT 3
- Does pg_shard encrypt the messages between nodes? HOT 3
- build issue HOT 2
- Support UNLOGGED tables HOT 2
- Schema support incomplete? HOT 1
- Support RETURNING in modification commands HOT 3
- sync-metadata does not support quoted column names HOT 1
- Zapier Test
- Default to CitusDB SELECT plan when within CitusDB
- Let CitusDB invalidate pg_shard's shard interval cache
- Make zero-shard SELECT consistent with CitusDB
- Support "UPSERT"
- Support prepared statements HOT 2
- 1.2.1 build error against PostgreSQL 9.4 HOT 5
- 1.2.1 build error against PostgreSQL 9.5 HOT 2
- cant read data from master [issue moved to pg_shard mailing list]
- Cannot read data in partition sets HOT 3
- Handling bigserial / auto-increment [Moved to mailing list] HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pg_shard.