TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

A Comprehensive Guide to Moving from SQL to RethinkDB

55 pointsby TheMissingPieceabout 10 years ago

5 comments

NDizzleabout 10 years ago
After spending a decade working with Lotus Domino, I think all of these people who are willingly going back to document style databases are insane.<p>Being able to fiddle with your schema on the fly isn&#x27;t necessarily a good thing. Brainstorm, plan, execute. Or just slap another field on the end of the document. Whichever sounds better for the long term health of your data!
评论 #9335079 未加载
评论 #9335171 未加载
评论 #9335044 未加载
评论 #9335452 未加载
评论 #9335159 未加载
mberningabout 10 years ago
I love me some document based databases. But I find it ridiculous how much FUD there is out there about them. After being severely burned by some &quot;It&#x27;s not fully ACID&quot; types in my organization I am seriously reluctant to even use them on projects where they are ideally suited. Sorry for the rant. I think they are wonderful tools, but I also think people should know about the political implications of using them in organizations where &#x27;old fashioned&#x27; or conservative thinking might come in and ruin their day.
评论 #9335358 未加载
评论 #9335214 未加载
评论 #9335076 未加载
评论 #9335039 未加载
jimmytucsonabout 10 years ago
Some of these examples are not equivalent. For example,<p><pre><code> r .db(&#x27;dragonball&#x27;) .table(&#x27;characters&#x27;) .filter(function(row){ return row(&#x27;maxStrength&#x27;).gt(700000).and(row(&#x27;species&#x27;).contains(&#x27;Saiyan&#x27;)); }) .orderBy(r.desc(&#x27;maxStrength&#x27;)); </code></pre> presumably returns one row per character, whereas<p><pre><code> SELECT c.* FROM characters c INNER JOIN character_species cs ON c.id = cs.character_id INNER JOIN species s ON cs.species_id = s.id WHERE max_strength &gt; 700000 AND s.name = &#x27;Saiyan&#x27; ORDER BY max_strength DESC; </code></pre> returns <i>at least</i> one row per character. Rather, the equivalent SQL (depending on what syntax is available) might be:<p><pre><code> SELECT c.* FROM characters c WHERE max_strength &gt; 700000 AND EXISTS (SELECT NULL FROM character_species cs INNER JOIN species s ON cs.species_id = s.id WHERE c.id = cs.character_id AND s.name = &#x27;Saiyan&#x27;) ORDER BY max_strength DESC; </code></pre> The above returns one row per character, no matter how many matching entries there are in `character_species` or `species`.<p>Pursuing this a little further then, suppose you wanted to expand your search to include humans and androids. In SQL, only a slight modification is needed:<p><pre><code> SELECT c.* FROM characters c WHERE max_strength &gt; 700000 AND EXISTS (SELECT NULL FROM character_species cs INNER JOIN species s ON cs.species_id = s.id WHERE c.id = cs.character_id AND s.name IN (&#x27;Saiyan&#x27;, &#x27;Human&#x27;, &#x27;Android&#x27;)) ORDER BY max_strength DESC; </code></pre> I shudder to think what that would look like in functional form. Something like this?<p><pre><code> r .db(&#x27;dragonball&#x27;) .table(&#x27;characters&#x27;) .filter(function(row){ return row(&#x27;maxStrength&#x27;).gt(700000).and(row(&#x27;species&#x27;).contains(&#x27;Saiyan&#x27;)).or(row(&#x27;species&#x27;).contains(&#x27;Human&#x27;)).or(row(&#x27;species&#x27;).contains(&#x27;Android&#x27;)); }) .orderBy(r.desc(&#x27;maxStrength&#x27;)); </code></pre> But how would it know how to group the disjunctions?<p>In my very limited experience, examples like these always look so tantalizing until you start taking them a little further and then you quickly realize there&#x27;s no such thing as a free lunch. In this case, you pay for the flexibility of RethinkDB with the expressiveness SQL.
评论 #9335810 未加载
baldfatabout 10 years ago
I still struggle for why someone would go RethinkDB over Hardoop. If you have the &quot;Big Data&quot; issue for using a Non-SQL DB (Another struggle of mine to find a clear case for its use).<p>Why go RethinkDB when you limit what you can do with your data at the start. You can&#x27;t do so things but the big one for me is you really can&#x27;t do statistical analysis (Author pointed it out in the article). Why have a Non-SQL that really hinders the biggest selling point for the non-SQL DB? Wouldn&#x27;t it just be better to use a SQL and expand the scheme horizontally???<p>Serious question that I don&#x27;t understand.
评论 #9334943 未加载
评论 #9335008 未加载
robodaleabout 10 years ago
...and why the hell would you want to do this.