Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Don't Use NoSQL

Don't Use NoSQL

Mathias Meyer

January 12, 2012
Tweet

More Decks by Mathias Meyer

Other Decks in Technology

Transcript

  1. “Doesn’t matter what kind of tool it is, at least

    one developer will eventually use it as a queue.” Me, 2012
  2. “Doesn’t matter what kind of database it is, at least

    one developer will eventually use it as a cache.” Me, 2012-01-11
  3. PostgreSQL hstore create table herokaih (id serial primary key, attr

    hstore); create index attr_idx on herokaih using gist (attr); insert into herokaih (attr) values (hstore(ARRAY['name', 'Dylan Egan'])); select attr -> 'language' from herokaih where attr @>'name=>Dylan';
  4. PostgreSQL XML create table herukai (id serial primary key, data

    xml); insert into herukai (data) values ('<herukai><name>Dylan Egan</name><tags><tag>heroku</tag></tags></ herukai>'); select xpath('//herukai/name/text()', data) from herukai; SELECT * from herukai where (xpath('//herukai/name/text()', data)) [1]::text = 'Dylan Egan'::text;
  5. PostgreSQL Arrays create table herokail (id serial primary key, tags

    text[], name varchar(200)); insert into herokail (name, tags) values ('Dylan Egan', ARRAY['meat']); update herokail set tags = array_append(tags, 'beer') where name = 'Dylan Egan'; select name from herokail where tags @> ARRAY['beer'];