Open Source Days 2012
A structured set of data held in a computer, esp. one that is accessible in various ways.
All clients see the same data at the same time
Every request recieves a response about whether the operation was successfull or failed
Works despite network partitions
·
Continues to operate despite arbitratry message loss
(Then work very very hard to fake the last!)
SELECT
[ALL | DISTINCT | DISTINCTROW ]
[HIGH_PRIORITY] [STRAIGHT_JOIN] [SQL_SMALL_RESULT] [SQL_BIG_RESULT]
[SQL_BUFFER_RESULT] [SQL_CACHE | SQL_NO_CACHE] [SQL_CALC_FOUND_ROWS]
select_expr [, select_expr …]
[FROM table_references
[WHERE where_condition]
[GROUP BY {col_name | expr | position}
[ASC | DESC], … [WITH ROLLUP]]
[HAVING where_condition]
[ORDER BY {col_name | expr | position}
[ASC | DESC], …]
[LIMIT {[offset,] row_count | row_count OFFSET offset}]
[PROCEDURE procedure_name(argument_list)]
[INTO OUTFILE 'file_name' export_options
| INTO DUMPFILE 'file_name'
| INTO var_name [, var_name]]
[FOR UPDATE | LOCK IN SHARE MODE]]
put(document, [key]) → key
get(key) → document
delete(key, …)
create_index(document_part)
· query_index(…)
query(some_query_language)
map(key1, value1)
→ [(key2, value2), …]
reduce(key2, [value2])
→ [value3, …]
def map(document_name, text): for word in text.split(): yield (word, 1)
… Shuffle output …def reduce(word, count): yield (word, sum(count))
PUT /dbname/_design/viewname/
Then query with:GET /dbname/_design/viewname/_view/all \ ?and_some_modifiers
put(key, value)
get(key)
delete(key)
get_all()
w=3
and r=3
→ ~ consistent system
w=1
and r=5
→ fast write, slow reads
w=5
and r=1
→ slow write, fast reads
w=1
and r=1
→ cache
create_table(table, column_prefixes)
put(table, row, prefix:column, value)
get(table, [row], [prefix:[column]])
scan(table, row_start, row_end, [prefix:[column]])
delete(table, …)
row | cf1 | cf2 | ||||||
cf1:col2 | cf1:col2 | cf2:col3 | cf2:col1 | cf2:col2 | cf2:col3 | |||
a | value1 | value2 | value3 | value4 | ||||
b | value5 | value6 | value7 | |||||
c | value8 | value9 | value10 | value11 | ||||
d | value12 | value13 | value14 | value15 | ||||
… | … | … |
URL | data | meta | ||||
data:content | meta:headers | meta:c-t | meta:speed | |||
com.web.service | {"foo": "bar", …} | Accept: … | application/json | 0.1s | ||
org.o-s-d.www | <html xmlns="http://… | Charset: utf-8… | text/html char… | 1.18s | ||
dk.sbhr | <doctype html>\n<html… | Age: 0… | 0.44s | |||
dk.sbhr/about | <doctype html>\n<html… | Host: sbhr.dk… | 0.71s | |||
… | … | … |
read < write < lock
Morten Siebuhr