DBMS vs NOSQL

NOSQLDB categories

key / value pairs, sharded arrays, and document-oriented
approaches)

google App data stores. Its syntax in Python is simple and clear, and it was specifically
created to be easy to use and reminiscent of relational databases, while only providing the
services typical of key/value stores base on a massively scalable cloud computing service.


NOSQL DB benefits

the benefits of various non-relational approaches will be explained
in depth, in terms of simplicity (fewer services lead to less complexity), scalability
(weaker integrity assumptions lead to more dimensions of concurrency), and raw
performance (fewer features means fewer layers to pass through).


SQL vs NOSQL

Example,


How google App data engine do?

definition

class Position(db.Model):
job_title = db.StringProperty(multiline=False)
open_date = db.DateTimeProperty(auto_now_add=False)
close_date = db.DateTimeProperty(auto_now_add=False)
salary = db.StringProperty(multiline=False)
description = db.StringProperty(multiline=True)
...
class Applicant(db.Model):
position = db.ReferenceProperty(Position)
name = db.StringProperty(multiline=False)
birth_date = db.DateTimeProperty(auto_now_add=False)
address = db.StringProperty(multiline=False)
source = db.StringProperty(multiline=False,
choices=set(["employee referral", "recruiter", "advertisement"]))
applied_date = db.DateTimeProperty(auto_now_add=True)
...
Note that, position_id, application_id is generated by system.

Insertion

pos = Position()
pos.job_title = "Accountant"
pos.put()
app = Applicant()
app.position = pos.key()
app.name = "Homer Simpson"
app.put()


A inner join operation

For RDBMS, a select operation is enough.

SELECT P.job_title, A.name, A.birth_date, ...
FROM
Position P
INNER JOIN Applicant A
ON A.position_id = P.position_id
WHERE
P.salary > 100000
AND A.state = 'New Jersey'
ORDER BY
A.name


FLOW: finding relevant job postings on disk and caching them in memory, writing new applicant records to disk, merging the information about positions and applicants in memory, filtering the results by Boolean expressions, sorting the results, etc.

How google app engine do?

positions = Position.all()
positions.filter("open_date <", date.now).filter("close_date >", date.now)
for position in positions:
# display the position in the list ...
applicants = Applicant.all()
applicants.filter("state =", "New Jersey")
for applicant in applicants:
position = applicant.Position()
# show data containing attributes of both position and applicant objects


It should be clear by this point that there is some (potentially large) class of
operations that we can achieve declaratively, with no effort, in a SQL database, which
require significant programming in a non-relational database.


However, the other properties of the data access may shift the balance of this
equation; when the task is not to produce a quick report, but instead to manage
this information for millions of users, in order to produce intermediate structures
that can answer search queries in fractions of a millisecond, the prospect of
writing your own access code in this manner (via, for example, a map/reduce
operation) becomes much more attractive.


Advantages to using non-relational databases

• Semi-Structured Data
• Alternative Model Paradigms
• Multi-valued properties
• Generalized Analytics
• Version History
• Predictable Scalability
• Schema Evolution

Advantages to using RDBMS databases

• Ease of expression - writing queries is fast and easy, assuming those requirements
are within the purview of what SQL can do natively.
• Concurrency and Transactions - ACID properties
• Eventual Consistency
• Normalized Updates and relational integrity
• Standardization
• Access Control
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值