160 points · by gesaint · 5y ago · 57 comments
Can I just expect things like full text search to work? https://www.postgresql.org/docs/13/textsearch.html
What about additional but supplied modules like ltree? https://www.postgresql.org/docs/current/ltree.html
I ask as I saw a related article https://www.cockroachlabs.com/blog/full-text-indexing-search... recently and damn it looks close... has anyone migrated a prod system that uses the above? What did you encounter?
Every release has improved the compatibility story at an impressive rate.
The 20.2 released added partial indexes and enums, which helped close the gap in our app(though, enums don't support binary encoding yet, so might not work with your pg driver (1))
Things that are still an issue for us (all can be worked around):
1 - Can't defer foreign key checks
2 - No pg_trgm
3 - Can't tell if an upsert was an insert or an update
4 - No triggers (this is pretty huge)
From memory this is because there is no natural binary encoding, you could use the int number of the member in the enum but then you would need to communicate the enum members to the client in some way. PostgreSQL network protocol currently doesn't have such out of band information/metadata support.
When we ran PostgreSQL, I was using barman for PITR and that was fine. But getting PostgreSQL in HA? My confidence in relation to how critical that piece is? Nope. Even just trying to handle upgrades with no downtime scared me. If I had to do it, I'd look at repmgr.
The story is completely different with CockroachDB. We have 3 instances and taking down an instance (or the server it's on) for maintenance is no problem. The setup also probably couldn't be easier. Most importantly, if an instance goes down in the middle of the night: our app keeps working.
I would seriously consider if you need CockroachDB - if you need that level of scaling you should also consider Cassandra (or Cassandra like) solutions as they will scale better but you will have to architect your app to think in this way (i.e. your app generates the views of the data it needs).
If you don't need to scale yet use Postgres. Every piece of complexity has a cost and Cockroach while incredibly clever adds complexity that you might not understand or desire to manage over time. A nice interface won't help you when replication between clusters breaks in production.
That is literally explained in more than 40% of the article.
Generally though, I would not say that full compatibility should even be desired. A k/v database simply works differently from a strictly relational database. There are things like shard IDs, avoiding hot spots, deciding on how to paginate data.
Going too much into "PostgreSQL" replacement will eventually hurt CRDB because too much focus will go into making legacy enterprise SQL (along the lines of https://news.ycombinator.com/item?id=25454635) work on this system. It's the forklift approach of moving to the cloud. This becomes clear when skimming through the docs:
- https://www.cockroachlabs.com/blog/how-to-choose-db-index-ke...
- https://www.cockroachlabs.com/docs/stable/performance-best-p...
- https://www.cockroachlabs.com/docs/stable/limit-offset.html
- https://www.cockroachlabs.com/docs/v20.2/selection-queries#p...
I think many of the "light SQL" patterns are really great - things like SELECT or WHERE, which e.g. DynamoDB can simply not solve without ElasticSearch. But all in all, I am very excited for CRDB to get more industry acceptance, and I think their cloud offering could also become very interesting - a competitor to Google BigTable / CloudSpanner, AWS DynamoDB or Cloud SQL.
> At the highest level, CockroachDB converts clients' SQL statements into key-value (KV) data, which is distributed among nodes and written to disk.
https://www.cockroachlabs.com/docs/stable/architecture/overv...
CREATE TABLE kv (key STRING PRIMARY KEY, value STRING);
But calling that a "key-value" store is disingenuous at best.
I cannot help but being saddened by this. It is really hard to understand how not knowing how to interface directly to the part of the system that holds the ultimate reason we write a program (handling data), and probably the performance bottleneck of that system when it scales, is beneficial to a professional developer.
Maybe they do know, but different approach turns out more productive for them.
For such "no true Scotsman" argument that "real developers write their SQL" I really like "ad absurdum" that "real developers write in machine code".
Which are all the same reasons that it's my goto database.
I don't build software anymore, but the last project I worked on for money was a query engine, and the project founders were pretty open about the fact that whenever they were unclear about the behavior required by the SQL spec, they looked at the PostgreSQL docs and behavior to get pointed in the right direction.
https://www.cockroachlabs.com/docs/stable/licensing-faqs.htm...
It likely does not. As a CockroachDB user, you can freely use CockroachDB or embed it in your applications (irrespective of whether you ship those applications to customers or run them as a service). The only thing you cannot do is offer CockroachDB as a service without buying a license.
- - - - -
Cockroach is asking not to take open source and start offering it as a service. Which sounds like completely reasonable thing to do!
Of late there has been plenty of fear mongering when it comes to licensing. I wonder if this is some paid blogs from cloud companies which helps form some opinions or the age old open source license-and-principles which hold little water with predatory cloud companies around.
But i just wrote "be aware of it", with that license i don't consider it "Free Software", just imagine Apache or Nginx would do that. On the other hand I'm totally fine if they want to protect themself from leeches like Amazon/Google/Oracle/IBM.
Nginx will likely do something similar, very soon. It's not that long ago when F5 bought them, with clear plans to offer paid-only features while the core itself remains open.
Give it another 5 years and I expect nginx to propagate some of those special features to the open-source version, but with the restriction that you can't offer them as a service vendor without a specific license.
the BSL is not an open source license, but I can see where they are coming from, and I don't have a problem with it. With the one exception than I bet it will slow adoption, which is really just selfish on my part, because I want to use it and it will be an easier sell the more people are aware of it. Honestly I'm hoping that postgres just adopts the best parts of cockroach and i won't need to keep bringing it up to grossed out managers.
I wish more people could pause and appreciate this.
I understand little on how an open source license gets approved by OSI body etc. But Im sure there is a need to mitigate threats from AWS and likes.
We can't be far from today from where AWS takes a github URL as input and starts offering it as its own service!
Feels like you could play a game of chicken with them. I know many big companies would probably stick to postgres with this in mind.
And also makes it feel like they might just change the license later
Them pretending that their use of the BSL doesn't impact end users and end-user freedom is marketing department BS.
They are free to license the software they develop under whatever license they want. I appreciate their past and future open source contributions and the technical achievements they have made, but their use of the BSL license rather than an open source license makes their product highly undesirable in my business.
All this being said, it sounds like you've got a better vision for how projects like this should get funded and built. How should society fund projects like CRDB? I think there's a very wide range of reasonable answers that fall in different parts of the fantasy spectrum. For now, in 2020s American capitalism, the BSD license approach, at least to my tastes (which are hecka biased), feels pretty good.
For a single node, strictly K/V workload, does CDB offer any advantages over Pebble? Does pebble have similar concurrent write issues like an SQLite? I wouldn’t think so because it’s split into multiple files.
Then one step further, again for a purely KV workload, if all I need to do is add/delete/update/find a key, would a solution like Couchbase be useful compared to Pebble?
If you even linked an article I would love a starting point.
So separating the layers like you do is only possible if there is an XA protocol between the layers. Neither K8s nor Ceph support that.
I use a postgresql connector to execute some postgresql specific sql statement on CockroachDB. That's a baseline quality for "compatible".