Database Intro 2
-Select * from links where votes > 10
-order by votes desc/asc
-append = 添える
-Joins = multiple tables
select link * from link, user where link, user-id=user.id and user.name='spez'
-Indexes
seguential scans(slow with lots of data) : links [link1, link2, link3, ]
indexes(increase the speed of queries) : index {1:link1, 2:link2, 3:link3, }
def build_link_index():
index{}
for l in links
index[ l.id]=l return index
-Indexes for sorting
hashtable - not sorted, constant time
tree- sorted, lookups are slower
-Reddit Hotness Algo - hot_idx
-ACID
Atomacity - all parts of transaction succeed or fail together
Consistensy - the database will always be consistent
Isolation - No transaction can interfere with another
Durability - once the transaction is comitted, it won't be lost
-Replication Lag
-Google App Engine Datastore 難しすぎて今はパス
Tables - entities / columns are not fixed / all have an ID / parents & ancestors